Skip to content

[lldb] fix(lldb/**.py): fix invalid escape sequences #94034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

e-kwsm
Copy link
Contributor

@e-kwsm e-kwsm commented May 31, 2024

No description provided.

@e-kwsm e-kwsm requested a review from JDevlieghere as a code owner May 31, 2024 19:46
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the lldb label May 31, 2024
@llvmbot
Copy link
Member

llvmbot commented May 31, 2024

@llvm/pr-subscribers-lldb

Author: Eisuke Kawashima (e-kwsm)

Changes

Patch is 94.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94034.diff

73 Files Affected:

  • (modified) lldb/examples/python/crashlog.py (+4-4)
  • (modified) lldb/examples/python/delta.py (+1-1)
  • (modified) lldb/examples/python/gdbremote.py (+2-2)
  • (modified) lldb/examples/python/jump.py (+3-3)
  • (modified) lldb/examples/python/performance.py (+1-1)
  • (modified) lldb/examples/python/symbolication.py (+3-3)
  • (modified) lldb/packages/Python/lldbsuite/test/lldbpexpect.py (+1-1)
  • (modified) lldb/packages/Python/lldbsuite/test/test_runner/process_control.py (+1-1)
  • (modified) lldb/test/API/commands/command/backticks/TestBackticksInAlias.py (+2-2)
  • (modified) lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py (+1-1)
  • (modified) lldb/test/API/commands/expression/test/TestExprs.py (+1-1)
  • (modified) lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py (+1-1)
  • (modified) lldb/test/API/commands/help/TestHelp.py (+3-3)
  • (modified) lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py (+1-1)
  • (modified) lldb/test/API/commands/register/register/TestRegistersUnavailable.py (+2-2)
  • (modified) lldb/test/API/commands/settings/TestSettings.py (+6-6)
  • (modified) lldb/test/API/commands/target/basic/TestTargetCommand.py (+1-1)
  • (modified) lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py (+8-8)
  • (modified) lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py (+8-8)
  • (modified) lldb/test/API/commands/trace/TestTraceDumpInfo.py (+1-1)
  • (modified) lldb/test/API/commands/trace/TestTraceEvents.py (+2-2)
  • (modified) lldb/test/API/commands/trace/TestTraceStartStop.py (+6-6)
  • (modified) lldb/test/API/commands/trace/TestTraceTSC.py (+5-5)
  • (modified) lldb/test/API/driver/quit_speed/TestQuitWithProcess.py (+1-1)
  • (modified) lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py (+1-1)
  • (modified) lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py (+1-1)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py (+3-3)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py (+3-3)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py (+8-8)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py (+1-1)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py (+11-11)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py (+1-1)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py (+1-1)
  • (modified) lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py (+2-2)
  • (modified) lldb/test/API/functionalities/memory-region/TestMemoryRegion.py (+1-1)
  • (modified) lldb/test/API/functionalities/target_var/TestTargetVar.py (+1-1)
  • (modified) lldb/test/API/iohandler/completion/TestIOHandlerCompletion.py (+1-1)
  • (modified) lldb/test/API/lang/c/function_types/TestFunctionTypes.py (+1-1)
  • (modified) lldb/test/API/lang/c/register_variables/TestRegisterVariables.py (+1-1)
  • (modified) lldb/test/API/lang/c/set_values/TestSetValues.py (+2-2)
  • (modified) lldb/test/API/lang/c/strings/TestCStrings.py (+1-1)
  • (modified) lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py (+4-4)
  • (modified) lldb/test/API/lang/cpp/char1632_t/TestChar1632T.py (+4-4)
  • (modified) lldb/test/API/lang/cpp/class_static/TestStaticVariables.py (+2-2)
  • (modified) lldb/test/API/lang/cpp/class_types/TestClassTypes.py (+1-1)
  • (modified) lldb/test/API/lang/cpp/dynamic-value/TestDynamicValue.py (+1-1)
  • (modified) lldb/test/API/lang/cpp/namespace/TestNamespace.py (+2-2)
  • (modified) lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py (+2-2)
  • (modified) lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py (+1-1)
  • (modified) lldb/test/API/lang/mixed/TestMixedLanguages.py (+2-2)
  • (modified) lldb/test/API/lang/objc/foundation/TestObjCMethods.py (+1-1)
  • (modified) lldb/test/API/lang/objc/foundation/TestObjCMethodsNSArray.py (+5-5)
  • (modified) lldb/test/API/lang/objc/foundation/TestObjCMethodsNSError.py (+1-1)
  • (modified) lldb/test/API/lang/objc/foundation/TestObjCMethodsString.py (+5-5)
  • (modified) lldb/test/API/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py (+1-1)
  • (modified) lldb/test/API/lang/objcxx/objc-builtin-types/TestObjCBuiltinTypes.py (+2-2)
  • (modified) lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py (+22-22)
  • (modified) lldb/test/API/linux/aarch64/mte_tag_access/TestAArch64LinuxMTEMemoryTagAccess.py (+80-80)
  • (modified) lldb/test/API/linux/aarch64/mte_tag_faults/TestAArch64LinuxMTEMemoryTagFaults.py (+3-3)
  • (modified) lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py (+2-2)
  • (modified) lldb/test/API/macosx/add-dsym/TestAddDsymDownload.py (+1-1)
  • (modified) lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py (+1-1)
  • (modified) lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py (+1-1)
  • (modified) lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py (+1-1)
  • (modified) lldb/test/API/macosx/simulator/TestSimulatorPlatform.py (+1-1)
  • (modified) lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py (+1-1)
  • (modified) lldb/test/API/python_api/target-arch-from-module/TestTargetArchFromModule.py (+1-1)
  • (modified) lldb/test/API/source-manager/TestSourceManager.py (+1-1)
  • (modified) lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py (+3-3)
  • (modified) lldb/test/API/tools/lldb-server/TestPtyServer.py (+1-1)
  • (modified) lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py (+1-1)
  • (modified) lldb/test/API/types/AbstractBase.py (+3-3)
  • (modified) lldb/utils/lui/sourcewin.py (+1-1)
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 641b2e64d53b1..13e5d77ec6fe2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -294,7 +294,7 @@ class DarwinImage(symbolication.Image):
             except:
                 dsymForUUIDBinary = ""
 
-        dwarfdump_uuid_regex = re.compile("UUID: ([-0-9a-fA-F]+) \(([^\(]+)\) .*")
+        dwarfdump_uuid_regex = re.compile(r"UUID: ([-0-9a-fA-F]+) \(([^\(]+)\) .*")
 
         def __init__(
             self, text_addr_lo, text_addr_hi, identifier, version, uuid, path, verbose
@@ -499,7 +499,7 @@ def find_image_with_identifier(self, identifier):
         for image in self.images:
             if image.identifier == identifier:
                 return image
-        regex_text = "^.*\.%s$" % (re.escape(identifier))
+        regex_text = r"^.*\.%s$" % (re.escape(identifier))
         regex = re.compile(regex_text)
         for image in self.images:
             if regex.match(image.identifier):
@@ -919,7 +919,7 @@ def get(cls):
             version = r"(?:" + super().version + r"\s+)?"
             address = r"(0x[0-9a-fA-F]{4,})"  # 4 digits or more
 
-            symbol = """
+            symbol = r"""
                         (?:
                             [ ]+
                             (?P<symbol>.+)
@@ -1089,7 +1089,7 @@ def parse_normal(self, line):
             self.crashlog.process_identifier = line[11:].strip()
         elif line.startswith("Version:"):
             version_string = line[8:].strip()
-            matched_pair = re.search("(.+)\((.+)\)", version_string)
+            matched_pair = re.search(r"(.+)\((.+)\)", version_string)
             if matched_pair:
                 self.crashlog.process_version = matched_pair.group(1)
                 self.crashlog.process_compatability_version = matched_pair.group(2)
diff --git a/lldb/examples/python/delta.py b/lldb/examples/python/delta.py
index eeb3c177cfa90..f847b95ab119f 100755
--- a/lldb/examples/python/delta.py
+++ b/lldb/examples/python/delta.py
@@ -99,7 +99,7 @@ def parse_log_file(file, options):
     print("# Log file: '%s'" % file)
     print("#----------------------------------------------------------------------")
 
-    timestamp_regex = re.compile("(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$")
+    timestamp_regex = re.compile(r"(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$")
 
     base_time = 0.0
     last_time = 0.0
diff --git a/lldb/examples/python/gdbremote.py b/lldb/examples/python/gdbremote.py
index 40ee15853fdb2..0bbfc1a0f1eed 100755
--- a/lldb/examples/python/gdbremote.py
+++ b/lldb/examples/python/gdbremote.py
@@ -1537,12 +1537,12 @@ def parse_gdb_log(file, options):
     a long time during a preset set of debugger commands."""
 
     tricky_commands = ["qRegisterInfo"]
-    timestamp_regex = re.compile("(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$")
+    timestamp_regex = re.compile(r"(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$")
     packet_name_regex = re.compile("([A-Za-z_]+)[^a-z]")
     packet_transmit_name_regex = re.compile(
         "(?P<direction>send|read) packet: (?P<packet>.*)"
     )
-    packet_contents_name_regex = re.compile("\$([^#]*)#[0-9a-fA-F]{2}")
+    packet_contents_name_regex = re.compile(r"\$([^#]*)#[0-9a-fA-F]{2}")
     packet_checksum_regex = re.compile(".*#[0-9a-fA-F]{2}$")
     packet_names_regex_str = "(" + "|".join(gdb_remote_commands.keys()) + ")(.*)"
     packet_names_regex = re.compile(packet_names_regex_str)
diff --git a/lldb/examples/python/jump.py b/lldb/examples/python/jump.py
index e086df5fd1528..8d52bd9af43f6 100644
--- a/lldb/examples/python/jump.py
+++ b/lldb/examples/python/jump.py
@@ -38,7 +38,7 @@ def parse_linespec(linespec, frame, result):
             )
 
     if not matched:
-        mo = re.match("^\+([0-9]+)$", linespec)
+        mo = re.match(r"^\+([0-9]+)$", linespec)
         if mo is not None:
             matched = True
             # print "Matched +<count>"
@@ -54,7 +54,7 @@ def parse_linespec(linespec, frame, result):
             )
 
     if not matched:
-        mo = re.match("^\-([0-9]+)$", linespec)
+        mo = re.match(r"^\-([0-9]+)$", linespec)
         if mo is not None:
             matched = True
             # print "Matched -<count>"
@@ -79,7 +79,7 @@ def parse_linespec(linespec, frame, result):
             breakpoint = target.BreakpointCreateByLocation(file_name, line_number)
 
     if not matched:
-        mo = re.match("\*((0x)?([0-9a-f]+))$", linespec)
+        mo = re.match(r"\*((0x)?([0-9a-f]+))$", linespec)
         if mo is not None:
             matched = True
             # print "Matched <address-expression>"
diff --git a/lldb/examples/python/performance.py b/lldb/examples/python/performance.py
index 869a0b061cf85..b86b5a52522e0 100755
--- a/lldb/examples/python/performance.py
+++ b/lldb/examples/python/performance.py
@@ -346,7 +346,7 @@ def __init__(self, pid):
 
     def Measure(self):
         output = subprocess.getoutput(self.command).split("\n")[-1]
-        values = re.split("[-+\s]+", output)
+        values = re.split(r"[-+\s]+", output)
         for idx, stat in enumerate(values):
             multiplier = 1
             if stat:
diff --git a/lldb/examples/python/symbolication.py b/lldb/examples/python/symbolication.py
index f6dcc8b9a7943..b16745ee963c9 100755
--- a/lldb/examples/python/symbolication.py
+++ b/lldb/examples/python/symbolication.py
@@ -177,9 +177,9 @@ class Section:
     """Class that represents an load address range"""
 
     sect_info_regex = re.compile("(?P<name>[^=]+)=(?P<range>.*)")
-    addr_regex = re.compile("^\s*(?P<start>0x[0-9A-Fa-f]+)\s*$")
+    addr_regex = re.compile(r"^\s*(?P<start>0x[0-9A-Fa-f]+)\s*$")
     range_regex = re.compile(
-        "^\s*(?P<start>0x[0-9A-Fa-f]+)\s*(?P<op>[-+])\s*(?P<end>0x[0-9A-Fa-f]+)\s*$"
+        r"^\s*(?P<start>0x[0-9A-Fa-f]+)\s*(?P<op>[-+])\s*(?P<end>0x[0-9A-Fa-f]+)\s*$"
     )
 
     def __init__(self, start_addr=None, end_addr=None, name=None):
@@ -557,7 +557,7 @@ def find_images_with_identifier(self, identifier):
             if image.identifier == identifier:
                 images.append(image)
         if len(images) == 0:
-            regex_text = "^.*\.%s$" % (re.escape(identifier))
+            regex_text = r"^.*\.%s$" % (re.escape(identifier))
             regex = re.compile(regex_text)
             for image in self.images:
                 if regex.match(image.identifier):
diff --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
index 998a080565b6b..3279e1fd39f8c 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -104,4 +104,4 @@ def cursor_forward_escape_seq(self, chars_to_move):
         Returns the escape sequence to move the cursor forward/right
         by a certain amount of characters.
         """
-        return b"\x1b\[" + str(chars_to_move).encode("utf-8") + b"C"
+        return b"\x1b\\[" + str(chars_to_move).encode("utf-8") + b"C"
diff --git a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
index 07c17993bc878..8ab219a92d99d 100644
--- a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
+++ b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
@@ -91,7 +91,7 @@ def timeout_to_seconds(timeout):
 
 
 class ProcessHelper(object):
-    """Provides an interface for accessing process-related functionality.
+    r"""Provides an interface for accessing process-related functionality.
 
     This class provides a factory method that gives the caller a
     platform-specific implementation instance of the class.
diff --git a/lldb/test/API/commands/command/backticks/TestBackticksInAlias.py b/lldb/test/API/commands/command/backticks/TestBackticksInAlias.py
index c31a08ac00182..2cb8d225d6d07 100644
--- a/lldb/test/API/commands/command/backticks/TestBackticksInAlias.py
+++ b/lldb/test/API/commands/command/backticks/TestBackticksInAlias.py
@@ -20,7 +20,7 @@ def test_backticks_in_alias(self):
         interp = self.dbg.GetCommandInterpreter()
         result = lldb.SBCommandReturnObject()
         interp.HandleCommand(
-            "command alias _test-argv-cmd expression -Z \`argc\` -- argv", result
+            r"command alias _test-argv-cmd expression -Z \`argc\` -- argv", result
         )
         self.assertCommandReturn(result, "Made the alias")
         interp.HandleCommand("_test-argv-cmd", result)
@@ -28,7 +28,7 @@ def test_backticks_in_alias(self):
 
         # Now try a harder case where we create this using an alias:
         interp.HandleCommand(
-            "command alias _test-argv-parray-cmd parray \`argc\` argv", result
+            r"command alias _test-argv-parray-cmd parray \`argc\` argv", result
         )
         self.assertCommandReturn(result, "Made the alias")
         interp.HandleCommand("_test-argv-parray-cmd", result)
diff --git a/lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py b/lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py
index d27f07717affb..a82141a0792f2 100644
--- a/lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py
+++ b/lldb/test/API/commands/expression/memory-allocation/TestMemoryAllocSettings.py
@@ -30,7 +30,7 @@ def test(self):
         alloc0 = re.search("^.*IRMemoryMap::Malloc.+?0xdead0000.*$", log, re.MULTILINE)
         # Malloc adds additional bytes to allocation size, hence 10007
         alloc1 = re.search(
-            "^.*IRMemoryMap::Malloc\s*?\(10007.+?0xdead1000.*$", log, re.MULTILINE
+            r"^.*IRMemoryMap::Malloc\s*?\(10007.+?0xdead1000.*$", log, re.MULTILINE
         )
         self.assertTrue(alloc0, "Couldn't find an allocation at a given address.")
         self.assertTrue(
diff --git a/lldb/test/API/commands/expression/test/TestExprs.py b/lldb/test/API/commands/expression/test/TestExprs.py
index 41faf07f8cb44..17fd952130ee7 100644
--- a/lldb/test/API/commands/expression/test/TestExprs.py
+++ b/lldb/test/API/commands/expression/test/TestExprs.py
@@ -50,7 +50,7 @@ def build_and_run(self):
     def test_floating_point_expr_commands(self):
         self.build_and_run()
 
-        self.expect("expression 2.234f", patterns=["\(float\) \$.* = 2\.234"])
+        self.expect("expression 2.234f", patterns=[r"\(float\) \$.* = 2\.234"])
         # (float) $2 = 2.234
 
     def test_many_expr_commands(self):
diff --git a/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py b/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
index 3bb45521747d8..69aa674f6ae5d 100644
--- a/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
+++ b/lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
@@ -48,7 +48,7 @@ def test_gui(self):
         self.child.expect_exact("Threads")
 
         # The main thread should be expanded.
-        self.child.expect("#\d+: main")
+        self.child.expect(r"#\d+: main")
 
         # Quit the GUI
         self.child.send(escape_key)
diff --git a/lldb/test/API/commands/help/TestHelp.py b/lldb/test/API/commands/help/TestHelp.py
index f0f5bcb321801..6aaff17fa4ea6 100644
--- a/lldb/test/API/commands/help/TestHelp.py
+++ b/lldb/test/API/commands/help/TestHelp.py
@@ -349,13 +349,13 @@ def test_help_show_tags(self):
         self.expect(
             "help memory read",
             patterns=[
-                "--show-tags\n\s+Include memory tags in output "
-                "\(does not apply to binary output\)."
+                "--show-tags\n\\s+Include memory tags in output "
+                "\\(does not apply to binary output\\)."
             ],
         )
         self.expect(
             "help memory find",
-            patterns=["--show-tags\n\s+Include memory tags in output."],
+            patterns=["--show-tags\n\\s+Include memory tags in output."],
         )
 
     @no_debug_info_test
diff --git a/lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py b/lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py
index fcf61c9775c63..a7f8b38649b22 100644
--- a/lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py
+++ b/lldb/test/API/commands/process/launch-with-shellexpand/TestLaunchWithShellExpand.py
@@ -93,7 +93,7 @@ def test(self):
 
         self.runCmd("process kill")
 
-        self.runCmd("process launch -X true -w %s -- foo\ bar" % (self.getBuildDir()))
+        self.runCmd(r"process launch -X true -w %s -- foo\ bar" % (self.getBuildDir()))
 
         process = self.process()
 
diff --git a/lldb/test/API/commands/register/register/TestRegistersUnavailable.py b/lldb/test/API/commands/register/register/TestRegistersUnavailable.py
index abd3aeace8969..0ccccd2f09712 100644
--- a/lldb/test/API/commands/register/register/TestRegistersUnavailable.py
+++ b/lldb/test/API/commands/register/register/TestRegistersUnavailable.py
@@ -48,12 +48,12 @@ def test_unavailable_registers(self):
             "register read --all",
             patterns=[
                 "(?sm)^general purpose registers:\n"
-                "^\s+rdx = 0x5555555555555555\n"
+                "^\\s+rdx = 0x5555555555555555\n"
                 ".*"
                 "^3 registers were unavailable.\n"
                 "\n"
                 "^supplementary registers:\n"
-                "^\s+edx = 0x55555555\n"
+                "^\\s+edx = 0x55555555\n"
                 ".*"
                 "^12 registers were unavailable."
             ],
diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py
index 385acceb7a8b5..52348bf52507a 100644
--- a/lldb/test/API/commands/settings/TestSettings.py
+++ b/lldb/test/API/commands/settings/TestSettings.py
@@ -186,13 +186,13 @@ def cleanup():
         self.addTearDownHook(cleanup)
 
         self.runCmd("settings show frame-format")
-        m = re.match('^frame-format \(format-string\) = "(.*)"$', self.res.GetOutput())
+        m = re.match(r'^frame-format \(format-string\) = "(.*)"$', self.res.GetOutput())
         self.assertTrue(m, "Bad settings string")
         self.format_string = m.group(1)
 
         # Change the default format to print function.name rather than
         # function.name-with-args
-        format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n"
+        format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\\`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n"
         self.runCmd("settings set frame-format %s" % format_string)
 
         # Immediately test the setting.
@@ -671,7 +671,7 @@ def test_settings_with_trailing_whitespace(self):
         )
         self.runCmd("settings set target.run-args 1 2 3")  # Set to known value
         # Set to new value with trailing whitespaces
-        self.runCmd("settings set target.run-args 3 \  \ ")
+        self.runCmd(r"settings set target.run-args 3 \  \ ")
         self.expect(
             "settings show target.run-args",
             SETTING_MSG("target.run-args"),
@@ -793,11 +793,11 @@ def test_settings_clear_all(self):
         # Check that settings have their default values after clearing.
         self.expect(
             "settings show target.env-vars",
-            patterns=["^target.env-vars \(dictionary of strings\) =\s*$"],
+            patterns=[r"^target.env-vars \(dictionary of strings\) =\s*$"],
         )
         self.expect(
             "settings show target.run-args",
-            patterns=["^target.run-args \(arguments\) =\s*$"],
+            patterns=[r"^target.run-args \(arguments\) =\s*$"],
         )
         self.expect("settings show auto-confirm", substrs=["false"])
         self.expect("settings show tab-size", substrs=["2"])
@@ -894,7 +894,7 @@ def test_experimental_settings(self):
         # showing & setting an undefined .experimental. setting should generate no errors.
         self.expect(
             "settings show target.experimental.setting-which-does-not-exist",
-            patterns=["^\s$"],
+            patterns=[r"^\s$"],
             error=False,
         )
         self.expect(
diff --git a/lldb/test/API/commands/target/basic/TestTargetCommand.py b/lldb/test/API/commands/target/basic/TestTargetCommand.py
index cb7a5f33f6643..f7601700d790f 100644
--- a/lldb/test/API/commands/target/basic/TestTargetCommand.py
+++ b/lldb/test/API/commands/target/basic/TestTargetCommand.py
@@ -74,7 +74,7 @@ def do_target_command(self):
             # Find the largest index of the existing list.
             import re
 
-            pattern = re.compile("target #(\d+):")
+            pattern = re.compile(r"target #(\d+):")
             for line in reversed(output.split(os.linesep)):
                 match = pattern.search(line)
                 if match:
diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
index 05c72945b1439..13d12e3686a17 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
@@ -94,11 +94,11 @@ def test_dwos_loaded_table_output(self):
         self.expect(
             "target modules dump separate-debug-info",
             patterns=[
-                "Symbol file: .*?a\.out",
+                r"Symbol file: .*?a\.out",
                 'Type: "dwo"',
-                "Dwo ID\s+Err\s+Dwo Path",
-                "0x[a-zA-Z0-9]{16}\s+.*main\.dwo",
-                "0x[a-zA-Z0-9]{16}\s+.*foo\.dwo",
+                r"Dwo ID\s+Err\s+Dwo Path",
+                r"0x[a-zA-Z0-9]{16}\s+.*main\.dwo",
+                r"0x[a-zA-Z0-9]{16}\s+.*foo\.dwo",
             ],
         )
 
@@ -118,11 +118,11 @@ def test_dwos_not_loaded_table_output(self):
         self.expect(
             "target modules dump separate-debug-info",
             patterns=[
-                "Symbol file: .*?a\.out",
+                r"Symbol file: .*?a\.out",
                 'Type: "dwo"',
-                "Dwo ID\s+Err\s+Dwo Path",
-                "0x[a-zA-Z0-9]{16}\s+E\s+.*main\.dwo",
-                "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo",
+                r"Dwo ID\s+Err\s+Dwo Path",
+                r"0x[a-zA-Z0-9]{16}\s+E\s+.*main\.dwo",
+                r"0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo",
             ],
         )
 
diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
index 06dc823459184..4e7560338b1d4 100644
--- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
+++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py
@@ -93,11 +93,11 @@ def test_shows_oso_loaded_table_output(self):
         self.expect(
             "target modules dump separate-debug-info",
             patterns=[
-                "Symbol file: .*?a\.out",
+                r"Symbol file: .*?a\.out",
                 'Type: "oso"',
-                "Mod Time\s+Err\s+Oso Path",
-                "0x[a-zA-Z0-9]{16}\s+.*main\.o",
-                "0x[a-zA-Z0-9]{16}\s+.*foo\.o",
+                r"Mod Time\s+Err\s+Oso Path",
+                r"0x[a-zA-Z0-9]{16}\s+.*main\.o",
+                r"0x[a-zA-Z0-9]{16}\s+.*foo\.o",
             ],
         )
 
@@ -119,11 +119,11 @@ def test_shows_oso_not_loaded_table_output(self):
         self.expect(
             "target modules dump separate-debug-info",
             patterns=[
-                "Symbol file: .*?a\.out",
+                r"Symbol file: .*?a\.out",
                 'Type: "oso"',
-                "Mod Time\s+Err\s+Oso Path",
-                "0x[a-zA-Z0-9]{16}\s+E\s+.*main\.o",
-                "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o",
+                r"Mod Time\s+Err\s+Oso Path",
+                r"0x[a-zA-Z0-9]{16}\s+E\s+.*main\.o",
+                r"0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o",
             ],
         )
 
diff --git a/lldb/test/API/commands/trace/TestTraceDumpInfo.py b/lldb/test/API/commands/trace/TestTrac...
[truncated]

@DavidSpickett DavidSpickett changed the title fix(lldb/**.py): fix invalid escape sequences [lldb] fix(lldb/**.py): fix invalid escape sequences Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

Copy link

github-actions bot commented Jun 3, 2024

✅ With the latest revision this PR passed the Python code formatter.

@DavidSpickett
Copy link
Collaborator

The formatter is failing, but I would prefer to keep this change purely addressing the lint warning. Certainly you can update this to reorder the "fr"/"rf" but ignore the rest of its complaints.

Whoever merges this (probably me) can push a reformatting change directly afterwards.

@DavidSpickett
Copy link
Collaborator

I forgot about this, apologies. If you have the time to fix the conflicts, I'll take another look.

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DavidSpickett DavidSpickett merged commit 24abf2c into llvm:main Feb 28, 2025
10 checks passed
Copy link

@e-kwsm Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

cheezeburglar pushed a commit to cheezeburglar/llvm-project that referenced this pull request Feb 28, 2025
@e-kwsm e-kwsm deleted the lldb/W605 branch February 28, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants