Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4 |
|
#
ab81fc29 |
| 02-Mar-2023 |
Med Ismail Bennani <medismail.bennani@gmail.com> |
[lldb/Interpreter] Fix build failures in ScriptInterpreterLua
This patch should fix the build failures in the Lua ScriptedInterpreter introduced by 9a9fce1fed6d.
Signed-off-by: Med Ismail Bennani <
[lldb/Interpreter] Fix build failures in ScriptInterpreterLua
This patch should fix the build failures in the Lua ScriptedInterpreter introduced by 9a9fce1fed6d.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
show more ...
|
#
b970e725 |
| 02-Mar-2023 |
Med Ismail Bennani <medismail.bennani@gmail.com> |
Revert "[lldb/Interpreter] Fix build failures in ScriptInterpreterLua"
This reverts commit 6de18eb050a66544cc38210024860366b84faf35.
|
#
6de18eb0 |
| 02-Mar-2023 |
Med Ismail Bennani <medismail.bennani@gmail.com> |
[lldb/Interpreter] Fix build failures in ScriptInterpreterLua
This patch should fix the build failures in the Lua ScriptedInterpreter introduced by 9a9fce1fed6d.
Signed-off-by: Med Ismail Bennani <
[lldb/Interpreter] Fix build failures in ScriptInterpreterLua
This patch should fix the build failures in the Lua ScriptedInterpreter introduced by 9a9fce1fed6d.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
show more ...
|
#
35d17c17 |
| 28-Feb-2023 |
Med Ismail Bennani <medismail.bennani@gmail.com> |
[lldb] Remove const qualifier on bool argument passed by value
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
|
#
9a9fce1f |
| 28-Feb-2023 |
Med Ismail Bennani <medismail.bennani@gmail.com> |
[lldb] Fix {break,watch}point command function stopping behaviour
In order to run a {break,watch}point command, lldb can resolve to the script interpreter to run an arbitrary piece of code or call i
[lldb] Fix {break,watch}point command function stopping behaviour
In order to run a {break,watch}point command, lldb can resolve to the script interpreter to run an arbitrary piece of code or call into a user-provided function. To do so, we will generate a wrapping function, where we first copy lldb's internal dictionary keys into the interpreter's global dictionary, copied inline the user code before resetting the global dictionary to its previous state.
However, {break,watch}point commands can optionally return a value that would tell lldb whether we should stop or not. This feature was only implemented for breakpoint commands and since we inlined the user code directly into the wrapping function, introducing an early return, that caused lldb to let the interpreter global dictionary tinted with the internal dictionary keys.
This patch fixes that issue while also adding the stopping behaviour to watchpoint commands.
To do so, this patch refactors the {break,watch}point command creation method, to let the lldb wrapper function generator know if the user code is a function call or a arbitrary expression.
Then the wrapper generator, if the user input was a function call, the wrapper function will call the user function and save the return value into a variable. If the user input was an arbitrary expression, the wrapper will inline it into a nested function, call the nested function and save the return value into the same variable. After resetting the interpreter global dictionary to its previous state, the generated wrapper function will return the varible containing the return value.
rdar://105461140
Differential Revision: https://reviews.llvm.org/D144688
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
show more ...
|
Revision tags: llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
#
bbef51eb |
| 10-Nov-2021 |
Lawrence D'Anna <lawrence_danna@apple.com> |
[lldb] make it easier to find LLDB's python
It is surprisingly difficult to write a simple python script that can reliably `import lldb` without failing, or crashing. I'm currently resorting to co
[lldb] make it easier to find LLDB's python
It is surprisingly difficult to write a simple python script that can reliably `import lldb` without failing, or crashing. I'm currently resorting to convolutions like this:
def find_lldb(may_reexec=False): if prefix := os.environ.get('LLDB_PYTHON_PREFIX'): if os.path.realpath(prefix) != os.path.realpath(sys.prefix): raise Exception("cannot import lldb.\n" f" sys.prefix should be: {prefix}\n" f" but it is: {sys.prefix}") else: line1, line2 = subprocess.run( ['lldb', '-x', '-b', '-o', 'script print(sys.prefix)'], encoding='utf8', stdout=subprocess.PIPE, check=True).stdout.strip().splitlines() assert line1.strip() == '(lldb) script print(sys.prefix)' prefix = line2.strip() os.environ['LLDB_PYTHON_PREFIX'] = prefix
if sys.prefix != prefix: if not may_reexec: raise Exception( "cannot import lldb.\n" + f" This python, at {sys.prefix}\n" f" does not math LLDB's python at {prefix}") os.environ['LLDB_PYTHON_PREFIX'] = prefix python_exe = os.path.join(prefix, 'bin', 'python3') os.execl(python_exe, python_exe, *sys.argv)
lldb_path = subprocess.run(['lldb', '-P'], check=True, stdout=subprocess.PIPE, encoding='utf8').stdout.strip()
sys.path = [lldb_path] + sys.path
This patch aims to replace all that with:
#!/usr/bin/env lldb-python import lldb ...
... by adding the following features:
* new command line option: --print-script-interpreter-info. This prints language-specific information about the script interpreter in JSON format.
* new tool (unix only): lldb-python which finds python and exec's it.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D112973
show more ...
|
#
5f4980f0 |
| 22-Oct-2021 |
Pavel Labath <pavel@labath.sk> |
[lldb] Remove ConstString from Process, ScriptInterpreter and StructuredData plugin names
|
#
a3939e15 |
| 15-Oct-2021 |
Pavel Labath <pavel@labath.sk> |
[lldb] Return StringRef from PluginInterface::GetPluginName
There is no reason why this function should be returning a ConstString.
While modifying these files, I also fixed several instances where
[lldb] Return StringRef from PluginInterface::GetPluginName
There is no reason why this function should be returning a ConstString.
While modifying these files, I also fixed several instances where GetPluginName and GetPluginNameStatic were returning different strings.
I am not changing the return type of GetPluginNameStatic in this patch, as that would necessitate additional changes, and this patch is big enough as it is.
Differential Revision: https://reviews.llvm.org/D111877
show more ...
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3 |
|
#
b0312676 |
| 10-Sep-2021 |
Pavel Labath <pavel@labath.sk> |
[lldb] Remove PluginInterface::GetPluginVersion
In all these years, we haven't found a use for this function (it has zero callers). Lets just remove the boilerplate.
Differential Revision: https://
[lldb] Remove PluginInterface::GetPluginVersion
In all these years, we haven't found a use for this function (it has zero callers). Lets just remove the boilerplate.
Differential Revision: https://reviews.llvm.org/D109600
show more ...
|
Revision tags: llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init |
|
#
f9517353 |
| 09-Jul-2021 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb] Add the ability to silently import scripted commands
Add the ability to silence command script import. The motivation for this change is being able to add command script import -s lldb.macosx
[lldb] Add the ability to silently import scripted commands
Add the ability to silence command script import. The motivation for this change is being able to add command script import -s lldb.macosx.crashlog to your ~/.lldbinit without it printing the following message at the beginning of every debug session.
"malloc_info", "ptr_refs", "cstr_refs", "find_variable", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.
In addition to forwarding the silent option to LoadScriptingModule, this also changes ScriptInterpreterPythonImpl::ExecuteOneLineWithReturn and ScriptInterpreterPythonImpl::ExecuteMultipleLines to honor the enable IO option in ExecuteScriptOptions, which until now was ignored.
Note that IO is only enabled (or disabled) at the start of a session, and for this particular use case, that's done when taking the Python lock in LoadScriptingModule, which means that the changes to these two functions are not strictly necessary, but (IMO) desirable nonetheless.
Differential revision: https://reviews.llvm.org/D105327
show more ...
|
#
e81ba283 |
| 04-Jul-2021 |
Siger Yang <sigeryeung@gmail.com> |
[lldb/lua] Add scripted watchpoints for Lua
Add support for Lua scripted watchpoints, with basic tests.
Differential Revision: https://reviews.llvm.org/D105034
|
Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2 |
|
#
cfb96d84 |
| 12-Jun-2021 |
Jim Ingham <jingham@apple.com> |
Convert functions that were returning BreakpointOption * to BreakpointOption &.
This is an NFC cleanup.
Many of the API's that returned BreakpointOptions always returned valid ones. Internally the
Convert functions that were returning BreakpointOption * to BreakpointOption &.
This is an NFC cleanup.
Many of the API's that returned BreakpointOptions always returned valid ones. Internally the BreakpointLocations usually have null BreakpointOptions, since they use their owner's options until an option is set specifically on the location. So the original code used pointers & unique_ptr everywhere for consistency. But that made the code hard to reason about from the outside.
This patch changes the code so that everywhere an API is guaranteed to return a non-null BreakpointOption, it returns it as a reference to make that clear.
It also changes the Breakpoint to hold a BreakpointOption member where it previously had a UP. Since we were always filling the UP in the Breakpoint constructor, having the UP wasn't helping anything.
Differential Revision: https://reviews.llvm.org/D104162
show more ...
|
Revision tags: llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1 |
|
#
532e4203 |
| 21-Dec-2020 |
Pedro Tammela <pctammela@gmail.com> |
[lldb/Lua] add support for Lua function breakpoint
Adds support for running a Lua function when a breakpoint is hit.
Example: breakpoint command add -s lua -F abc
The above runs the Lua functio
[lldb/Lua] add support for Lua function breakpoint
Adds support for running a Lua function when a breakpoint is hit.
Example: breakpoint command add -s lua -F abc
The 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 data declared in the command line.
Example: breakpoint command add -s lua -F abc -k foo -v bar
Differential Revision: https://reviews.llvm.org/D93649
show more ...
|
Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
#
d853bd7a |
| 16-Dec-2020 |
Pedro Tammela <pctammela@gmail.com> |
[lldb/Lua] add support for multiline scripted breakpoints
1 - Partial Statements
The interpreter loop runs every line it receives, so partial Lua statements are not being handled properly. This is
[lldb/Lua] add support for multiline scripted breakpoints
1 - Partial Statements
The interpreter loop runs every line it receives, so partial Lua statements are not being handled properly. This is a problem for multiline breakpoint scripts since the interpreter loop, for this particular case, is just an abstraction to a partially parsed function body declaration.
This patch addresses this issue and as a side effect improves the general Lua interpreter loop as well. It's now possible to write partial statements in the 'script' command.
Example: (lldb) script >>> do ..> local a = 123 ..> print(a) ..> end 123
The 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 error message.
2 - CheckSyntax in Lua.h
In order to support (1), we need an API for just checking the syntax of string buffers.
3 - Multiline scripted breakpoints
Finally, with all the base features implemented this feature is straightforward. The interpreter loop behaves exactly the same, the difference is that it will aggregate all Lua statements into the body of the breakpoint function. An explicit 'quit' statement is needed to exit the interpreter 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 ..> quit
Differential Revision: https://reviews.llvm.org/D93481
show more ...
|
Revision tags: llvmorg-11.0.1-rc1 |
|
#
a0d7406a |
| 15-Nov-2020 |
Pedro Tammela <pctammela@gmail.com> |
[LLDB/Lua] add support for one-liner breakpoint callback
These 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 callback
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
show more ...
|
#
00bb397b |
| 27-Oct-2020 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb] Support Python imports relative the to the current file being sourced
Make it possible to use a relative path in command script import to the location of the file being sourced. This allows t
[lldb] Support Python imports relative the to the current file being sourced
Make it possible to use a relative path in command script import to the location of the file being sourced. This allows the user to put Python scripts next to LLDB command files and importing them without having to specify an absolute path.
To enable this behavior pass `-c` to `command script import`. The argument can only be used when sourcing the command from a file.
rdar://68310384
Differential revision: https://reviews.llvm.org/D89334
show more ...
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2 |
|
#
5ddd4fc5 |
| 16-Jun-2020 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb/Lua] Fix override/virtual in ScriptInterpreterLua (NFC)
|
Revision tags: llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init |
|
#
572b9f46 |
| 10-Jan-2020 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb/Lua] Support loading Lua modules
Implements the command script import command for Lua.
Differential revision: https://reviews.llvm.org/D71825
|
#
45c971f7 |
| 09-Jan-2020 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb/Lua] Make lldb.debugger et al available to Lua
The Python script interpreter makes the current debugger, target, process, thread and frame available to interactive scripting sessions through c
[lldb/Lua] Make lldb.debugger et al available to Lua
The Python script interpreter makes the current debugger, target, process, thread and frame available to interactive scripting sessions through convenience variables. This patch does the same for Lua.
Differential revision: https://reviews.llvm.org/D71801
show more ...
|
#
4164be72 |
| 21-Dec-2019 |
Jonas Devlieghere <jonas@devlieghere.com> |
[Lldb/Lua] Persist Lua state across script interpreter calls.
Don't create a new lua state on every operation. Share a single state across 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 state across the lifetime of the script interpreter. Add simple locking to prevent two threads from modifying the state concurrently.
show more ...
|
Revision tags: llvmorg-9.0.1, llvmorg-9.0.1-rc3 |
|
#
67de8962 |
| 07-Dec-2019 |
Jonas Devlieghere <jonas@devlieghere.com> |
[lldb/Lua] Add Boilerplate for a Lua Script Interpreter
This adds the boilerplate necessary to support the Lua script interpreter. The interpreter is not functional yet and just reports that it's no
[lldb/Lua] Add Boilerplate for a Lua Script Interpreter
This adds the boilerplate necessary to support the Lua script interpreter. The interpreter is not functional yet and just reports that it's not implemented.
Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html
Differential revision: https://reviews.llvm.org/D71232
show more ...
|