Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 1 | From 027b649fdb831868e71be01cafdacc49a5f419ab Mon Sep 17 00:00:00 2001 |
| 2 | From: Mark Wielaard <mark@klomp.org> |
| 3 | Date: Fri, 17 Nov 2023 14:01:21 +0100 |
| 4 | Subject: [PATCH 1/4] valgrind-monitor.py regular expressions should use raw |
| 5 | strings |
| 6 | |
| 7 | With python 3.12 gdb will produce the following SyntaxWarning when |
| 8 | loading valgrind-monitor-def.py: |
| 9 | |
| 10 | /usr/share/gdb/auto-load/valgrind-monitor-def.py:214: |
| 11 | SyntaxWarning: invalid escape sequence '\[' |
| 12 | if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str): |
| 13 | |
| 14 | In a future python version this will become an SyntaxError. |
| 15 | |
| 16 | Use a raw strings for the regular expression. |
| 17 | |
| 18 | https://bugs.kde.org/show_bug.cgi?id=476708 |
| 19 | (cherry picked from commit 0fbfbe05028ad18efda786a256a2738d2c231ed4) |
| 20 | |
| 21 | Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=027b649fdb831868e71be01cafdacc49a5f419ab] |
| 22 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 23 | --- |
| 24 | NEWS | 13 +++++++++++++ |
| 25 | coregrind/m_gdbserver/valgrind-monitor-def.py | 2 +- |
| 26 | 2 files changed, 14 insertions(+), 1 deletion(-) |
| 27 | |
| 28 | diff --git a/NEWS b/NEWS |
| 29 | index f11da4be8..ee5b4ff11 100644 |
| 30 | --- a/NEWS |
| 31 | +++ b/NEWS |
| 32 | @@ -1,3 +1,16 @@ |
| 33 | +Branch 3.22 |
| 34 | +~~~~~~~~~~~ |
| 35 | + |
| 36 | +* ==================== FIXED BUGS ==================== |
| 37 | + |
| 38 | +The following bugs have been fixed or resolved on this branch. |
| 39 | + |
| 40 | +476708 valgrind-monitor.py regular expressions should use raw strings |
| 41 | + |
| 42 | +To see details of a given bug, visit |
| 43 | + https://bugs.kde.org/show_bug.cgi?id=XXXXXX |
| 44 | +where XXXXXX is the bug number as listed above. |
| 45 | + |
| 46 | Release 3.22.0 (31 Oct 2023) |
| 47 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 48 | |
| 49 | diff --git a/coregrind/m_gdbserver/valgrind-monitor-def.py b/coregrind/m_gdbserver/valgrind-monitor-def.py |
| 50 | index b4e7b992d..d74b1590c 100644 |
| 51 | --- a/coregrind/m_gdbserver/valgrind-monitor-def.py |
| 52 | +++ b/coregrind/m_gdbserver/valgrind-monitor-def.py |
| 53 | @@ -211,7 +211,7 @@ class Valgrind_ADDR_LEN_opt(Valgrind_Command): |
| 54 | For compatibility reason with the Valgrind gdbserver monitor command, |
| 55 | we detect and accept usages such as 0x1234ABCD[10].""" |
| 56 | def invoke(self, arg_str : str, from_tty : bool) -> None: |
| 57 | - if re.fullmatch("^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str): |
| 58 | + if re.fullmatch(r"^0x[0123456789ABCDEFabcdef]+\[[^\[\]]+\]$", arg_str): |
| 59 | arg_str = arg_str.replace("[", " ") |
| 60 | arg_str = arg_str.replace("]", " ") |
| 61 | eval_execute_2(self, arg_str, |
| 62 | -- |
| 63 | 2.44.0 |
| 64 | |