[Lldb-commits] [lldb] [lldb] Realpath symlinks for breakpoints (PR #102223)

via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 9 16:13:43 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r 396343f17b1182ff8ed698beac3f9b93b1d9dabd...d984f5c367fcc07fc1d1b88791562285c3ce0d67 lldb/test/API/functionalities/breakpoint/breakpoint_with_realpath_and_source_map/TestBreakpoint.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- TestBreakpoint.py	2024-08-09 22:52:41.000000 +0000
+++ TestBreakpoint.py	2024-08-09 23:13:07.857254 +0000
@@ -53,82 +53,122 @@
         cwd = os.getcwd()
         print("DEBUG CWD", cwd)
 
         ######################################################################
         # Baseline
-        #---------------------------------------------------------------------
+        # ---------------------------------------------------------------------
         # Breakpoints should be resolved with paths which are in the line-table.
         lldbutil.run_break_set_by_file_and_line(
             self, "main.c", self.line_in_main, num_expected_locations=1, loc_exact=True
         )
         lldbutil.run_break_set_by_file_and_line(
-            self, "symlink1/foo.h", self.line_in_foo, num_expected_locations=1, loc_exact=True
+            self,
+            "symlink1/foo.h",
+            self.line_in_foo,
+            num_expected_locations=1,
+            loc_exact=True,
         )
         lldbutil.run_break_set_by_file_and_line(
-            self, "symlink2/bar.h", self.line_in_bar, num_expected_locations=1, loc_exact=True
+            self,
+            "symlink2/bar.h",
+            self.line_in_bar,
+            num_expected_locations=1,
+            loc_exact=True,
         )
         lldbutil.run_break_set_by_file_and_line(
-            self, "symlink2/qux.h", self.line_in_qux, num_expected_locations=1, loc_exact=True
+            self,
+            "symlink2/qux.h",
+            self.line_in_qux,
+            num_expected_locations=1,
+            loc_exact=True,
         )
 
         ######################################################################
         # Symlinked file
-        #---------------------------------------------------------------------
+        # ---------------------------------------------------------------------
         # - `symlink1/foo.h` is a symlink file, pointing at `real/foo.h`
         # - main.c includes `symlink1/foo.h`.
         # - As a result, the line-table contains a support file `(test_base_dir)/symlink1/foo.h`
         # - Setting a breakpoint for `real/foo.h` won't be resolved, because it doesn't match the above path.
         # - Setting a realpath prefix to the current working directory will cause the above support file to be realpath'ed to `(test_base_dir)/real/foo.h`
         # - Now setting a breakpoint for `real/foo.h` will be resolved.
         lldbutil.run_break_set_by_file_and_line(
-            self, "real/foo.h", self.line_in_foo, num_expected_locations=0, loc_exact=True
+            self,
+            "real/foo.h",
+            self.line_in_foo,
+            num_expected_locations=0,
+            loc_exact=True,
         )
         self.runCmd(f'settings set target.source-realpath-prefixes "{cwd}"')
         lldbutil.run_break_set_by_file_and_line(
-            self, "real/foo.h", self.line_in_foo, num_expected_locations=1, loc_exact=True
+            self,
+            "real/foo.h",
+            self.line_in_foo,
+            num_expected_locations=1,
+            loc_exact=True,
         )
         # Clear settings so that the test below won't be affected.
         self.runCmd("settings clear target.source-realpath-prefixes")
 
         ######################################################################
         # Symlinked directory
-        #---------------------------------------------------------------------
+        # ---------------------------------------------------------------------
         # - `symlink2` is a symlink directory, pointing at `real`.
         # - So, `symlink2/bar.h` will be realpath'ed to `real/bar.h`.
         # - main.c includes `symlink2/bar.h`.
         # - As a result, the line-table contains a support file `(test_base_dir)/symlink2/bar.h`
         # - Setting a breakpoint for `real/bar.h` won't be resolved, because it doesn't match the above path.
         # - Setting a realpath prefix to the current working directory will cause the above support file to be realpath'ed to `(test_base_dir)/real/bar.h`
         # - Now setting a breakpoint for `real/bar.h` will be resolved.
         lldbutil.run_break_set_by_file_and_line(
-            self, "real/bar.h", self.line_in_foo, num_expected_locations=0, loc_exact=True
+            self,
+            "real/bar.h",
+            self.line_in_foo,
+            num_expected_locations=0,
+            loc_exact=True,
         )
         self.runCmd(f'settings set target.source-realpath-prefixes "{cwd}"')
         lldbutil.run_break_set_by_file_and_line(
-            self, "real/bar.h", self.line_in_foo, num_expected_locations=1, loc_exact=True
+            self,
+            "real/bar.h",
+            self.line_in_foo,
+            num_expected_locations=1,
+            loc_exact=True,
         )
         # Clear settings so that the test below won't be affected.
         self.runCmd("settings clear target.source-realpath-prefixes")
 
         ######################################################################
         # Symlink + source-map
-        #---------------------------------------------------------------------
+        # ---------------------------------------------------------------------
         # - `symlink2` is a symlink directory, pointing at `real`.
         # - So, `symlink2/qux.h` will be realpath'ed to `real/qux.h`.
         # - main.c includes `symlink2/qux.h`.
         # - As a result, the line-table contains a support file `(test_base_dir)/symlink2/qux.h`
         # - Setting a realpath prefix to the current working directory will cause the above support file to be realpath'ed to `(test_base_dir)/real/qux.h`
         # - Setting a breakpoint for `to-be-mapped/qux.h` won't be resolved, because it doesn't match the above path.
         # - After setting a source-map, setting the same breakpoint will be resolved, because the input path `to-be-mapped/qux.h` is reverse-mapped to `real/qux.h`, which matches the realpath'ed support file.
         lldbutil.run_break_set_by_file_and_line(
-            self, "real/qux.h", self.line_in_foo, num_expected_locations=0, loc_exact=True
+            self,
+            "real/qux.h",
+            self.line_in_foo,
+            num_expected_locations=0,
+            loc_exact=True,
         )
         self.runCmd(f'settings set target.source-realpath-prefixes "{cwd}"')
         lldbutil.run_break_set_by_file_and_line(
-            self, "to-be-mapped/qux.h", self.line_in_foo, num_expected_locations=0, loc_exact=True
+            self,
+            "to-be-mapped/qux.h",
+            self.line_in_foo,
+            num_expected_locations=0,
+            loc_exact=True,
         )
         self.runCmd('settings set target.source-map "real" "to-be-mapped"')
         lldbutil.run_break_set_by_file_and_line(
-            self, "to-be-mapped/qux.h", self.line_in_foo, num_expected_locations=1, loc_exact=True
+            self,
+            "to-be-mapped/qux.h",
+            self.line_in_foo,
+            num_expected_locations=1,
+            loc_exact=True,
         )
         # Clear settings so that the test below won't be affected.
         self.runCmd("settings clear target.source-realpath-prefixes")

``````````

</details>


https://github.com/llvm/llvm-project/pull/102223


More information about the lldb-commits mailing list