Branch: refs/heads/main
Revision: db1c597c219808ddbfb50d284b81943fa87d5974
Author: jabraham17
Link: Improve Debugger.breakpoint and add Debugger.debugTrap by jabraham17 · Pull Request #27205 · chapel-lang/chapel · GitHub
Log Message:
Improve Debugger.breakpoint and add Debugger.debugTrap (#27205)
Improves the Debugger.breakpoint function and adds a new
Debugger.debugTrap function.
Prior to this PR, the Debugger.breakpoint
function would use a debug
trap (i.e. int3
on x86) to trigger debug breakpoints. While this works
well, if a user has that function and doesn't run inside a debugger,
their code will crash. The new Debugger.breakpoint
makes use of the
debuggerBreakHere
function, which uses debugger commands/breakpoints
to work. This means it won't crash outside of a debugger. This resolves
the future work from Experimental user facing breakpoint function by jabraham17 · Pull Request #23678 · chapel-lang/chapel · GitHub.
However, to maintain the previous behavior (which may be useful to
users), a debug trap can still be generated using Debugger.debugTrap
.
This has the previous behavior of Debugger.breakpoint
, but instead of
being toggled by -g
it is toggled by the config param
Debugger.disableDebugTraps
.
To facilitate testing of this PR (and future PRs), this PR adds
CHPL_RT_DEBUGGER_CMD_FILE
which allows passing a command file with
debugger commands to --lldb
/--gdb
. For now, this is an undocumented
developer-only feature.
Testing
- standard linux64 paratest
-
start_test test/library/standard/Debugger/
with lldb and the
LLVM backend -
start_test test/library/standard/Debugger/
with lldb and the C
backend -
start_test test/library/standard/Debugger/
with gdb and the LLVM
backend -
start_test test/library/standard/Debugger/
with gdb and the C
backend - built and checked docs
[Reviewed by @benharsh]
Diff:
M compiler/AST/primitive.cpp
M compiler/codegen/cg-expr.cpp
M compiler/optimizations/optimizeOnClauses.cpp
M compiler/resolution/preFold.cpp
M frontend/include/chpl/uast/prim-ops-list.h
M frontend/lib/resolution/prims.cpp
M modules/standard/Debugger.chpl
M runtime/src/comm/none/comm-none.c
A test/library/standard/Debugger/breakpoint/.gitignore
A test/library/standard/Debugger/breakpoint/CLEANFILES
A test/library/standard/Debugger/breakpoint/COMPOPTS
A test/library/standard/Debugger/breakpoint/SKIPIF
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.c.good
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.chpl
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.execenv
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.execopts
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.llvm.good
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.prediff
A test/library/standard/Debugger/breakpoint/useBreakpoint-gdb.skipif
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.c.good
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.chpl
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.execenv
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.execopts
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.llvm.good
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.prediff
A test/library/standard/Debugger/breakpoint/useBreakpoint-lldb.skipif
A test/library/standard/Debugger/breakpoint/useBreakpointTestCommands.txt
D test/library/standard/Debugger/check-c-debugger.compopts
D test/library/standard/Debugger/check-c-debugger.skipif
D test/library/standard/Debugger/check-c-nodebugger.skipif
D test/library/standard/Debugger/check-llvm-debugger.compopts
D test/library/standard/Debugger/check-llvm-debugger.prediff
D test/library/standard/Debugger/check-llvm-nodebugger.prediff
R100 test/library/standard/Debugger/CLEANFILES test/library/standard/Debugger/debugTrap/CLEANFILES
R100 test/library/standard/Debugger/NOEXEC test/library/standard/Debugger/debugTrap/NOEXEC
R100 test/library/standard/Debugger/check-c-debugger.chpl test/library/standard/Debugger/debugTrap/check-c-debugger.chpl
R100 test/library/standard/Debugger/check-c-nodebugger.compopts test/library/standard/Debugger/debugTrap/check-c-debugger.compopts
R100 test/library/standard/Debugger/check-c-debugger.good test/library/standard/Debugger/debugTrap/check-c-debugger.good
R100 test/library/standard/Debugger/check-c-debugger.prediff test/library/standard/Debugger/debugTrap/check-c-debugger.prediff
A test/library/standard/Debugger/debugTrap/check-c-debugger.skipif
R100 test/library/standard/Debugger/check-c-nodebugger.chpl test/library/standard/Debugger/debugTrap/check-c-nodebugger.chpl
A test/library/standard/Debugger/debugTrap/check-c-nodebugger.compopts
R100 test/library/standard/Debugger/check-c-nodebugger.good test/library/standard/Debugger/debugTrap/check-c-nodebugger.good
R100 test/library/standard/Debugger/check-c-nodebugger.prediff test/library/standard/Debugger/debugTrap/check-c-nodebugger.prediff
A test/library/standard/Debugger/debugTrap/check-c-nodebugger.skipif
R092 test/library/standard/Debugger/check-llvm-debugger.chpl test/library/standard/Debugger/debugTrap/check-llvm-debugger.chpl
R100 test/library/standard/Debugger/check-llvm-nodebugger.compopts test/library/standard/Debugger/debugTrap/check-llvm-debugger.compopts
R100 test/library/standard/Debugger/check-llvm-debugger.good test/library/standard/Debugger/debugTrap/check-llvm-debugger.good
A test/library/standard/Debugger/debugTrap/check-llvm-debugger.prediff
R100 test/library/standard/Debugger/check-llvm-debugger.skipif test/library/standard/Debugger/debugTrap/check-llvm-debugger.skipif
R092 test/library/standard/Debugger/check-llvm-nodebugger.chpl test/library/standard/Debugger/debugTrap/check-llvm-nodebugger.chpl
A test/library/standard/Debugger/debugTrap/check-llvm-nodebugger.compopts
R100 test/library/standard/Debugger/check-llvm-nodebugger.good test/library/standard/Debugger/debugTrap/check-llvm-nodebugger.good
A test/library/standard/Debugger/debugTrap/check-llvm-nodebugger.prediff
R100 test/library/standard/Debugger/check-llvm-nodebugger.skipif test/library/standard/Debugger/debugTrap/check-llvm-nodebugger.skipif
https://github.com/chapel-lang/chapel/pull/27205.diff