[libcxx-commits] [libcxx] WIP [libc++][debugging] P2546R5: Debugging support (PR #81447)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 12 00:02:42 PST 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 1c48c9234b3e30e6ed5b9a0ce68320579bb6fec7...f12e8012559cd1d833c969a5e2dc2190d3aa5f84 libcxx/test/std/utilities/debugging/is_debugger_present_with_debugger_gdb.py libcxx/test/std/utilities/debugging/is_debugger_present_with_debugger_lldb.py libcxx/utils/generate_feature_test_macro_components.py libcxx/utils/libcxx/test/features.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- test/std/utilities/debugging/is_debugger_present_with_debugger_gdb.py 2024-02-12 07:53:57.000000 +0000
+++ test/std/utilities/debugging/is_debugger_present_with_debugger_gdb.py 2024-02-12 08:02:24.800693 +0000
@@ -80,10 +80,11 @@
test_failures = -1
elif test_failures:
print(f"FAILED {test_failures} cases")
exit(test_failures)
+
def main():
"""Main entry point"""
# Start code executed at load time
global test_failures
@@ -112,7 +113,8 @@
test_failures += 1
exit_handler(None)
print(f"Test failures count: {test_failures}")
+
if __name__ == "__main__":
main()
--- test/std/utilities/debugging/is_debugger_present_with_debugger_lldb.py 2024-02-12 07:53:57.000000 +0000
+++ test/std/utilities/debugging/is_debugger_present_with_debugger_lldb.py 2024-02-12 08:02:24.823848 +0000
@@ -16,10 +16,11 @@
# see what "run" printed to check for a warning message, since
# we get taken to our exit handler before we can look.
# Instead check that at least one test has been run by the time
# we exit.
has_run_tests = False
+
def breakpoint_handler(frame, bp_loc, internal_dict):
print("===============> breakpoint_handler")
global has_run_tests
@@ -50,10 +51,11 @@
print("FAIL: Something is wrong in the test framework.")
print(str(e))
test_failures += 1
+
def exit_handler(debugger):
"""Exit handler"""
global test_failures
global has_run_tests
@@ -71,11 +73,13 @@
def __lldb_init_module(debugger, internal_dict):
global test_failures
target = debugger.GetSelectedTarget()
test_bp = target.BreakpointCreateByName("StopForDebugger")
- test_bp.SetScriptCallbackFunction("is_debugger_present_with_debugger_lldb.breakpoint_handler")
+ test_bp.SetScriptCallbackFunction(
+ "is_debugger_present_with_debugger_lldb.breakpoint_handler"
+ )
test_bp.enabled = True
debugger.HandleCommand("run")
test_failures += 1
--- utils/libcxx/test/features.py 2024-02-12 07:53:56.000000 +0000
+++ utils/libcxx/test/features.py 2024-02-12 08:02:25.275630 +0000
@@ -472,10 +472,11 @@
name="buildhost=aix",
when=lambda cfg: platform.system().lower().startswith("aix"),
),
]
+
# Detect whether LLDB is on the system.
def check_lldb(cfg):
lldb_path = shutil.which("lldb")
if lldb_path is None:
return False
@@ -488,10 +489,11 @@
name="host-has-lldb-with-python",
when=check_lldb,
actions=[AddSubstitution("%{lldb}", lambda cfg: shutil.which("lldb"))],
)
]
+
# Detect whether GDB is on the system, has Python scripting and supports
# adding breakpoint commands. If so add a substitution to access it.
def check_gdb(cfg):
gdb_path = shutil.which("gdb")
``````````
</details>
https://github.com/llvm/llvm-project/pull/81447
More information about the libcxx-commits
mailing list