Commit Graph

25 Commits

Author SHA1 Message Date
David Spickett 9f947abf94 [LLDB] Remove __future__ imports from examples
Not needed now that we require python 3.

Reviewed By: kastiglione, JDevlieghere

Differential Revision: https://reviews.llvm.org/D131772
2022-08-15 09:04:25 +00:00
Dominic Chen cd89f94aa9 [lldb] Fix python errors in gdbremote.py
Fix exceptions encountered while debugging gdb protocol

Differential Revision: https://reviews.llvm.org/D120792
2022-03-02 19:47:51 -08:00
Dave Lee 1441ffe6a6 [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom
Update examples and docs to demonstrate using `__lldb_init_module` instead of
the idiom that checks for `lldb.debugger` at the top-level.

```
if __name__ == '__main__':
    ...
elif lldb.debugger:
    ...
```

Is replaced with:

```
if __name__ == '__main__':
    ...

def __lldb_init_module(debugger, internal_dict):
    ...
```

This change is for two reasons. First, it's generally encouraged not to only
use the convenience singletons (`lldb.{debugger,process,target,etc}`)
interactively from the `script` command. Second, there's a bug where
registering a python class as a command (using `command script add -c ...`),
result in the command not being runnable. Note that registering function-backed
commands does not have this bug.

Differential Revision: https://reviews.llvm.org/D117237
2022-01-13 16:37:49 -08:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Pavel Labath cb6c9f731b [lldb] Make gdbremote.py utility py2and3 compatible 2020-02-13 09:18:55 +01:00
Serge Guelton 1a12dd70c0 python 2/3 compat: commands vs subprocess
Differential Revision: https://reviews.llvm.org/D59584

llvm-svn: 356995
2019-03-26 14:46:15 +00:00
Serge Guelton 525cd59f5a Python 2/3 compatibility: from __future__ import print_function
Differential Revision: https://reviews.llvm.org/D59580

llvm-svn: 356695
2019-03-21 18:27:40 +00:00
Greg Clayton 141f208e12 Fixes for GDB remote packet disassembler:
- Add latency timings to GDB packet log summary if timestamps are on log
- Add the ability to plot the latencies for each packet type with --plot
- Don't crash the script when target xml register info is in wierd format

llvm-svn: 343243
2018-09-27 17:55:36 +00:00
Greg Clayton db1550ab66 Fixed to disassemble new packets and fixed the dumping of the 'x' packets.
llvm-svn: 300341
2017-04-14 17:05:21 +00:00
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
2016-09-06 20:57:50 +00:00
Pavel Labath 4b7dc299c2 Fix typo in gdbremote.py
llvm-svn: 243421
2015-07-28 15:13:23 +00:00
Greg Clayton 8c2afa0cd5 Improved the packet dumper to escape the response string before sending it to the response functions (find any 0x7d characters and remove it and XOR the next character with 0x20). This allows us to parse the JSON in the reply packet and display it correctly.
llvm-svn: 242928
2015-07-22 20:12:58 +00:00
Greg Clayton a542e08c85 Fix the yellow colorizing and fix some logic in the "A" packet dumper.
llvm-svn: 242709
2015-07-20 21:22:18 +00:00
Greg Clayton a7a5e5a684 Handle dumping many more packet types including the A packet, qC, QSetDisableASLR, qLaunchSuccess and QLaunchArch.
llvm-svn: 242586
2015-07-17 23:08:14 +00:00
Greg Clayton 205d6189b4 Added support for dumping 'x', 'X', 'qSymbol' packets. Also dump any XML retrieved from a qXfer packets.
llvm-svn: 242566
2015-07-17 20:16:50 +00:00
Greg Clayton b2273bd3d6 Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.
llvm-svn: 242490
2015-07-17 00:19:31 +00:00
Greg Clayton 374b67144a Improve the packet dumper to be able to read the target.xml so it can dump register values when disassembling the packet log.
llvm-svn: 241307
2015-07-02 22:22:45 +00:00
Greg Clayton 25f82aae57 Fix this module to work with current packects and also to be able to figure out average packets speed and standard deviation.
llvm-svn: 238065
2015-05-22 23:00:59 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Greg Clayton 486290078c Added qVAttachOrWaitSupported packet support.
llvm-svn: 162207
2012-08-20 16:50:43 +00:00
Greg Clayton f51a23fb6f Cleaned up some stuff in symbolication where we can now lazily get images when symbolicating after loading a crash log file.
Added colorization to the gdbremote.py output and also added the ability to symbolicate the addresses in registers.

llvm-svn: 157965
2012-06-04 23:22:17 +00:00
Greg Clayton 8ebb9a8564 Added the ability to disassembly GDB remote packets with the python file. This will make it easier to symbolicate the packet log output since we can use the lldb.utils.symbolication package module to symbolicate register values.
llvm-svn: 157835
2012-06-01 20:23:54 +00:00
Greg Clayton 6ca75a00dc When running this from the command line, don't pass the python script file itself to be disassembled.
llvm-svn: 153626
2012-03-29 01:40:28 +00:00
Jim Ingham d95752f240 Add an option to sort by packet count (rather than time). Also print the count,
and to print the total count & time in the header.

llvm-svn: 151823
2012-03-01 18:57:51 +00:00
Greg Clayton e284163990 Added a 'gdbremote' python module that adds two commands: start_gdb_log and end_gdb_log.
When this is imported into your lldb using the "command script import /path/to/gdbremote.py"
these new commands are available within LLDB. 'start_gdb_log' will enable logging with 
timestamps for GDB remote packets, and 'stop_gdb_log' will then dump the details and
also a lot of packet timing data. This allows us to accurately track what packets are
taking up the most time when debugging (when using the ProcessGDBRemote debugging plug-in).

Also udpated the comments at the top of the cmdtemplate.py to show how to correctly import
the module from within LLDB.

llvm-svn: 149030
2012-01-26 02:56:24 +00:00