[lldb] Fix Lua/watchpoint_callback.test on Apple SiliconAs Pavel pointed out, on Apple Silicon "b main" stops at a point afterthe variable has already been initialized. This patch updates the test
[lldb] Fix Lua/watchpoint_callback.test on Apple SiliconAs Pavel pointed out, on Apple Silicon "b main" stops at a point afterthe variable has already been initialized. This patch updates the testcase to avoids that. I've also split the test into separate files so itseasier to reproduce the individual scenarios without having to build anyshared state.
show more ...
[lldb] Drop REQUIRES where redundant because of lit.local.cfg
[lldb/lua] Add scripted watchpoints for LuaAdd support for Lua scripted watchpoints, with basic tests.Differential Revision: https://reviews.llvm.org/D105034
[lldb] Don't print script output twice in HandleCommandWhen executing a script command in HandleCommand(s) we currently printits output twiceYou can see this issue in action when adding a breakpo
[lldb] Don't print script output twice in HandleCommandWhen executing a script command in HandleCommand(s) we currently printits output twiceYou can see this issue in action when adding a breakpoint command:(lldb) b mainBreakpoint 1: where = main.out`main + 13 at main.cpp:2:3, address = 0x0000000100003fad(lldb) break command add 1 -o "script print(\"Hey!\")"(lldb) rProcess 76041 launched: '/tmp/main.out' (x86_64)Hey!(lldb) script print("Hey!")Hey!Process 76041 stoppedThe issue is caused by HandleCommands using a temporaryCommandReturnObject and one of the commands (`script` in this case)setting an immediate output stream. This causes the result to be printedtwice: once directly to the immediate output stream and once whenprinting the result of HandleCommands.This patch fixes the issue by introducing a new option to suppressimmediate output for temporary CommandReturnObjects.Differential revision: https://reviews.llvm.org/D103349
[lldb] Simplify check for nill value in breakpoint_function_callback.test
[lldb] Update breakpoint_function_callback.test for different error messageAdjust for the Lua error message printed by Lua 5.4.3.
[lldb] Check for both Lua 5.3 and 5.4 error messages in the tests.
[lldb/Lua] add support for Lua function breakpointAdds support for running a Lua function when a breakpoint is hit.Example: breakpoint command add -s lua -F abcThe above runs the Lua functio
[lldb/Lua] add support for Lua function breakpointAdds support for running a Lua function when a breakpoint is hit.Example: breakpoint command add -s lua -F abcThe above runs the Lua function 'abc' passing 2 arguments. 'frame', 'bp_loc' and 'extra_args'.A third parameter 'extra_args' is only present when there is structured datadeclared in the command line.Example: breakpoint command add -s lua -F abc -k foo -v barDifferential Revision: https://reviews.llvm.org/D93649
[lldb/Lua] add support for multiline scripted breakpoints1 - Partial StatementsThe interpreter loop runs every line it receives, so partialLua statements are not being handled properly. This is
[lldb/Lua] add support for multiline scripted breakpoints1 - Partial StatementsThe interpreter loop runs every line it receives, so partialLua statements are not being handled properly. This is a problem formultiline breakpoint scripts since the interpreter loop, for thisparticular case, is just an abstraction to a partially parsed functionbody declaration.This patch addresses this issue and as a side effect improves thegeneral Lua interpreter loop as well. It's now possible to write partialstatements in the 'script' command.Example: (lldb) script >>> do ..> local a = 123 ..> print(a) ..> end 123The technique implemented is the same as the one employed by Lua's own REPL implementation.Partial statements always errors out with the '<eof>' tag in the errormessage.2 - CheckSyntax in Lua.hIn order to support (1), we need an API for just checking the syntax of string buffers.3 - Multiline scripted breakpointsFinally, with all the base features implemented this feature isstraightforward. The interpreter loop behaves exactly the same, thedifference is that it will aggregate all Lua statements into the body ofthe breakpoint function. An explicit 'quit' statement is needed to exit theinterpreter loop.Example: (lldb) breakpoint command add -s lua Enter your Lua command(s). Type 'quit' to end. The commands are compiled as the body of the following Lua function function (frame, bp_loc, ...) end ..> print(456) ..> a = 123 ..> quitDifferential Revision: https://reviews.llvm.org/D93481
[lldb] [test] Update test status for NetBSD
[LLDB] fix error message for one-line breakpoint scriptsLLDB is ignoring compilation errors for one-line breakpoint scripts.This patch fixes the issues and now the error message of theScriptInter
[LLDB] fix error message for one-line breakpoint scriptsLLDB is ignoring compilation errors for one-line breakpoint scripts.This patch fixes the issues and now the error message of theScriptInterpreter is shown to the user.I had to remove a new-line character for the Lua interpreter since itwas duplicated.Differential Revision: https://reviews.llvm.org/D92729
[LLDB/Lua] add support for one-liner breakpoint callbackThese callbacks are set using the following: breakpoint command add -s lua -o "print('hello world!')"The user supplied script is execute
[LLDB/Lua] add support for one-liner breakpoint callbackThese 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> endSo 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 asthese userdatas are context dependent.Differential Revision: https://reviews.llvm.org/D91508
[LLDB-lua] modify Lua's 'print' to respect 'io.stdout'This patch changes the implementation of Lua's `print()` function torespect `io.stdout`.The original implementation uses `lua_writestring()`
[LLDB-lua] modify Lua's 'print' to respect 'io.stdout'This patch changes the implementation of Lua's `print()` function torespect `io.stdout`.The original implementation uses `lua_writestring()` internally, which ishardcoded to `stdout`.Reviewed By: JDevlieghereDifferential Revision: https://reviews.llvm.org/D90787
[lldb] Add -l/--language option to script commandMake it possible to run the script command with a different languagethan currently selected. $ ./bin/lldb -l python (lldb) script -l lua >>>
[lldb] Add -l/--language option to script commandMake it possible to run the script command with a different languagethan currently selected. $ ./bin/lldb -l python (lldb) script -l lua >>> io.stdout:write("Hello, World!\n") Hello, World!When passing the language option and a raw command, you need to separatethe flag from the script code with --. $ ./bin/lldb -l python (lldb) script -l lua -- io.stdout:write("Hello, World!\n") Hello, World!Differential revision: https://reviews.llvm.org/D86996
[lldb/Lua] Redirect Lua stdout/stderr to the CommandReturnObjectRedirect the output of stdout and stderr to the CommandReturnObject forone line commands.Differential revision: https://reviews.ll
[lldb/Lua] Redirect Lua stdout/stderr to the CommandReturnObjectRedirect the output of stdout and stderr to the CommandReturnObject forone line commands.Differential revision: https://reviews.llvm.org/D82412
[lldb/Lua] Use the debugger's output and error file for Lua's I/O library.Add support for changing the stdout and stderr file in Lua's I/O libraryand hook it up with the debugger's output and erro
[lldb/Lua] Use the debugger's output and error file for Lua's I/O library.Add support for changing the stdout and stderr file in Lua's I/O libraryand hook it up with the debugger's output and error file respectivelyfor the interactive Lua interpreter.https://reviews.llvm.org/D82273
[lldb/Lua] Recognize "quit" as a way to exit the script interpreter.Add a way to quit the interactive script interpreter from a shell tests.Currently, the only way (that I know) to exit the intera
[lldb/Lua] Recognize "quit" as a way to exit the script interpreter.Add a way to quit the interactive script interpreter from a shell tests.Currently, the only way (that I know) to exit the interactive Luainterpreter is to send a EOF with CTRL-D. I noticed that the embeddedPython script interpreter accepts quit (while the regular pythoninterpreter doesn't). I've added a special case to the Lua interpreterto do the same.Differential revision: https://reviews.llvm.org/D82272
[lldb/Test] Use lit.local.cfg to mark whole directory as (un)supported.Mark the whole Python or Lua test directory as unsupported when thecorresponding language is not available.
[lldb/Test] Skip script interpreter tests reading from stdin for lldb-reproThe reproducers currently only shadow the command interpreter. It wouldbe possible to make it work for the Lua interprete
[lldb/Test] Skip script interpreter tests reading from stdin for lldb-reproThe reproducers currently only shadow the command interpreter. It wouldbe possible to make it work for the Lua interpreter which uses theIOHandlerEditline under the hood, but the Python one runs a REPL inPython itself so there's no (straightforward) way to shadow that.Given that we already capture any API calls, this isn't super high on mylist of priorities.
[lldb/Lua] Support loading Lua modulesImplements the command script import command for Lua.Differential revision: https://reviews.llvm.org/D71825
[lldb/lua] Make convenience_variables.test compatible with lua-5.1
[lldb/Lua] Make lldb.debugger et al available to LuaThe Python script interpreter makes the current debugger, target,process, thread and frame available to interactive scripting sessionsthrough c
[lldb/Lua] Make lldb.debugger et al available to LuaThe Python script interpreter makes the current debugger, target,process, thread and frame available to interactive scripting sessionsthrough convenience variables. This patch does the same for Lua.Differential revision: https://reviews.llvm.org/D71801
[lldb/lua] Fix bindings.test for lua-5.1string.format("%s", true) only works since lua-5.2. Make the printstatement more portable.
[lldb/ScriptInterpreter] Fix stale/bogus error messagesFix the nonsensical error messages for when breakpoint and watchpointcallbacks are not supported.
[Lldb/Lua] Persist Lua state across script interpreter calls.Don't create a new lua state on every operation. Share a single stateacross the lifetime of the script interpreter. Add simple locking
[Lldb/Lua] Persist Lua state across script interpreter calls.Don't create a new lua state on every operation. Share a single stateacross the lifetime of the script interpreter. Add simple locking toprevent two threads from modifying the state concurrently.
12