These callbacks are set using the following:
breakpoint command add -s lua -o "print('hello world!')"
The user supplied script is executed as:
function (frame, bp_loc, ...)
<body>
end
So the local variables 'frame', 'bp_loc' and vararg are all accessible.
Any global variables declared will persist in the Lua interpreter.
A user should never hold 'frame' and 'bp_loc' in a global variable as
these userdatas are context dependent.
Differential Revision: https://reviews.llvm.org/D91508
19 lines
588 B
Plaintext
19 lines
588 B
Plaintext
# REQUIRES: lua
|
|
# RUN: echo "int main() { return 0; }" | %clang_host -x c - -o %t
|
|
# RUN: %lldb -s %s --script-language lua %t 2>&1 | FileCheck %s
|
|
b main
|
|
breakpoint command add -s lua -o 'return false'
|
|
run
|
|
# CHECK: Process {{[0-9]+}} exited with status = 0
|
|
breakpoint command add -s lua -o 'print(bacon)'
|
|
run
|
|
# CHECK: bacon
|
|
# CHECK: Process {{[0-9]+}} exited with status = 0
|
|
breakpoint command add -s lua -o "return true"
|
|
run
|
|
# CHECK: Process {{[0-9]+}} stopped
|
|
breakpoint command add -s lua -o 'error("my error message")'
|
|
run
|
|
# CHECK: my error message
|
|
# CHECK: Process {{[0-9]+}} stopped
|