Commit Graph

166 Commits

Author SHA1 Message Date
Greg Clayton e04e5b954a Improve crashlog.py so it can handle more iOS crashlog files.
<rdar://problem/29191857>

llvm-svn: 289006
2016-12-08 00:22:45 +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
Jim Ingham fd0dbab248 Mention is_stale in the scripted step doc.
llvm-svn: 277884
2016-08-05 22:47:43 +00:00
Greg Clayton 296f166aa3 Fixup the "shadow" example command to use the function that takes an execution context now that the @lldb.command decorator does the right thing for the command function that takes 5 arguments.
A few fixes:
- Check the process state to make sure it is stopped
- Grab the frame from the "exe_ctx" so this will work during breakpoint callbacks
- Print out the SBDeclaration objects of the variables that shadow each other so we can see the source locations of which variable declarations are shodowing each other.

llvm-svn: 273963
2016-06-28 00:06:35 +00:00
Greg Clayton fe9d1ee9e4 Added a new python example which installs a command called "shadow".
This shows how to grab individual blocks from stack frames and get only the variables from those blocks. It then will iterate over all of the parent blocks and look for shadowed variables.

llvm-svn: 273604
2016-06-23 19:54:32 +00:00
Greg Clayton 6c42aa777e Fixed a few places that were building a regex from an identifier without escaping the identifier text.
<rdar://problem/26090553> 

llvm-svn: 272423
2016-06-10 20:09:33 +00:00
Jim Ingham c7468b7b96 Another little example use of scripted thread plans.
llvm-svn: 268338
2016-05-03 00:14:52 +00:00
Bruce Mitchener adb99821bc Fix typos.
Summary: Another round of minor typo fixes.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13026

llvm-svn: 248243
2015-09-22 05:07:56 +00:00
Greg Clayton 4d48e5b371 Fix process_events.py to auto continue the process if we attached so the process doesn't just sit there suspended.
llvm-svn: 244801
2015-08-12 20:04:01 +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
Jim Ingham a2baa0d9d8 Another slightly less goofy example of scripted steps.
llvm-svn: 241216
2015-07-02 00:24:17 +00:00
Jim Ingham 5673eef85a Add a missing space.
llvm-svn: 241181
2015-07-01 19:27:08 +00:00
Jim Ingham c917a381f8 Remove a few uses of lldb.target, which is not valid
in a scripted command.

llvm-svn: 240451
2015-06-23 20:26:45 +00:00
Greg Clayton 811051e3d6 Fix types.py to actually be able to run check_padding_command() without erroring out.
<rdar://problem/21071347>

llvm-svn: 238764
2015-06-01 17:28: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
Jason Molenda 7a5014b040 Add a call to SBDebugger:Destroy() at the end of the self-hosted
version of this script.  We picked up a bug at some point in March
where scripts that fail to call SBDebugger::Destroy() will crash
in the Debugger C++ dtor.  I want to track the change down which
introduced the change - but this script should be calling
SBDebugger::Destroy() in the first place, so do that.

llvm-svn: 233779
2015-04-01 02:09:04 +00:00
Greg Clayton 48d157dd41 symbolicate the application specific backtraces that are in MacOSX crash log files.
<rdar://problem/20039160> 

llvm-svn: 231415
2015-03-05 22:53:06 +00:00
Greg Clayton 2f547177f8 Improved the TreeItem delegate which simplifies making tree items:
- tree items can define any number of key/value pairs
- creating a tree you specify which columns you want to display and it will pick out the right key/value pairs from the new tree item dictionaries
- added new "tk-target" command to explore the target's images, sections, symbols, compile units and line tables.

llvm-svn: 219219
2014-10-07 17:30:23 +00:00
Jim Ingham 2a057f872d Fix some errors that crept in when I cut & pasted into emacs.
llvm-svn: 218656
2014-09-30 01:37:52 +00:00
Jim Ingham 0fbf3af3dc Add a very trivial example for scripted stepping.
llvm-svn: 218650
2014-09-30 00:24:59 +00:00
Greg Clayton 994ba64756 Played around with TK UI a bit this weekend.
If you "command script import" this file, then you will have two new commands:

(lldb) tk-variables
(lldb) tk-process

Not sure how this will work on all other systems, but on MacOSX, you will get a window with a tree view that allows you to inspect your local variables by expanding variables to see the child values.

The "tk-process" allows you to inspect the currently selected process by expanding the process to see the threads, the threads to see the frames, and the frames to see the variables. Very handy if you want to view variables for all frames simultaneously.

llvm-svn: 218279
2014-09-22 22:06:41 +00:00
Greg Clayton bca7db7177 Don't use "lldb." global variables in LLDB commands.
llvm-svn: 212852
2014-07-11 22:41:30 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Greg Clayton 641c23f332 Allow classes to be intialized using current lldb::SB objects. This can help to import/export the current process state.
llvm-svn: 209702
2014-05-28 00:21:15 +00:00
Greg Clayton 86e70cb3ac Fixed an issue where if you called:
SBTarget::AddModule(const char *path,
                    const char *triple,
                    const char *uuid_cstr,
                    const char *symfile);
                    
If "symfile" was filled in, it would cause us to not correctly add the module. Same goes for:

SBTarget::AddModule(SBModuleSpec ...)

Where you filled in the symfile.

<rdar://problem/16529799>

llvm-svn: 205750
2014-04-07 23:50:17 +00:00
Hafiz Abid Qadeer d48460fefe Add example target description file for QEMU for x86-64.
llvm-svn: 201790
2014-02-20 14:02:56 +00:00
Greg Clayton 09effdacda Added a new lldb command that can parse all struct and class types for one or more shared libraries.
llvm-svn: 199937
2014-01-23 21:26:30 +00:00
Greg Clayton 25eec2cc75 Fix to only update the offset for concrete registers (ones that don't have 'slice' or 'composite' key/value pairs).
llvm-svn: 197191
2013-12-13 00:35:21 +00:00
Hafiz Abid Qadeer 85a4daf4f6 Adjust PC after hitting breakpoint on remote target.
This commit adds an example python file that can be used with 'target-definition-file' setting for Linux gdbserver.
This file has an extra key 'breakpoint-pc-offset' that LLDB uses to determine how much to change the PC
after hitting the breakpoint.

llvm-svn: 192962
2013-10-18 10:04:33 +00:00
Greg Clayton 312bcbe8b4 <rdar://problem/14972424>
- Made the dynamic register context for the GDB remote plug-in inherit from the generic DynamicRegisterInfo to avoid code duplication
- Finished up the target definition python setting stuff.
- Added a new "slice" key/value pair that can specify that a register is part of another register:
    { 'name':'eax', 'set':0, 'bitsize':32, 'encoding':eEncodingUint, 'format':eFormatHex, 'slice': 'rax[31:0]' },
- Added a new "composite" key/value pair that can specify that a register is made up of two or more registers:
    { 'name':'d0', 'set':0, 'bitsize':64 , 'encoding':eEncodingIEEE754, 'format':eFormatFloat, 'composite': ['s1', 's0'] },
- Added a new "invalidate-regs" key/value pair for when a register is modified, it can invalidate other registers:
    { 'name':'cpsr', 'set':0, 'bitsize':32 , 'encoding':eEncodingUint, 'format':eFormatHex, 'invalidate-regs': ['r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15']},
    
This now completes the feature that allows a GDB remote target to completely describe itself.

llvm-svn: 192858
2013-10-17 01:10:23 +00:00
Greg Clayton ef8180a3f6 <rdar://problem/14972424>
When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the
registers on the remote server. When those packets aren't supported, LLDB doesn't
know what the registers look like. This checkin implements a setting that can be used
to specify a python file that contains the registers definitions. The setting is:

(lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py

Inside module there should be a function:

def get_dynamic_setting(target, setting_name):

This dynamic setting function is handed the "target" which is a SBTarget, and the 
"setting_name", which is the name of the dynamic setting to retrieve. For the GDB
remote target definition the setting name is 'gdb-server-target-definition'. The
return value is a dictionary that follows the same format as the OperatingSystem
plugins follow. I have checked in an example file that implements the x86_64 GDB
register set for people to see:

    examples/python/x86_64_target_definition.py
    
This allows LLDB to debug to any archticture that is support and allows users to
define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo)
are not supported by the remote GDB server.

A few benefits of doing this in Python:
1 - The dynamic register context was already supported in the OperatingSystem plug-in
2 - Register contexts can use all of the LLDB enumerations and definitions for things
    like lldb::Format, lldb::Encoding, generic register numbers, invalid registers 
    numbers, etc.
3 - The code that generates the register context can use the program to calculate the
    register context contents (like offsets, register numbers, and more)
4 - True dynamic detection could be used where variables and types could be read from 
    the target program itself in order to determine which registers are available since
    the target is passed into the python function.
    
This is designed to be used instead of XML since it is more dynamic and code flow and
functions can be used to make the dictionary.

llvm-svn: 192646
2013-10-15 00:14:28 +00:00
Greg Clayton 6a23d21289 Added a "sources.py" which adds a command that can print out the source files contained in one or more modules.
Added "mach_o.py" which is a mach-o parser that can dump mach-o file contents and also extract sections. It uses the "file_extract" module and the "dict_utils" module.

llvm-svn: 189959
2013-09-04 17:31:40 +00:00
Jason Molenda 3f99ade67a Fix typeo in diagnose-unwind.py.
llvm-svn: 186358
2013-07-15 22:40:17 +00:00
Greg Clayton e110ad8fff Enabled the "--debug" option functionality that will SIGSTOP the current process allowing a debugger to attach.
llvm-svn: 186194
2013-07-12 20:08:00 +00:00
Greg Clayton 04bd684074 Added a memory.py module that contains a 'memfind' command which allows you to search memory for a byte pattern.
llvm-svn: 186127
2013-07-11 22:38:00 +00:00
Enrico Granata da504ff00a Tweaks to the Python reference and example command to use the preferred print style and the (finally available :-) SetError API
llvm-svn: 186122
2013-07-11 21:49:38 +00:00
Jason Molenda c95407b0d5 Add the frame content dumper function call to one more place.
llvm-svn: 185906
2013-07-09 05:36:41 +00:00
Jason Molenda 5bd4a4613c Add new information gathering to the lldb & simple backtrace methods:
print five words of memory at the beginning of the stack frame so it's
easier to track where an incorrect saved-fp or saved-pc may have come from.

llvm-svn: 185903
2013-07-09 05:08:14 +00:00
Greg Clayton 96eb9ab047 A bit more cleanup on the process_events.py to use best practices for event handling.
llvm-svn: 185089
2013-06-27 18:08:32 +00:00
Greg Clayton abc18417b6 Update the platform options help strings.
llvm-svn: 185028
2013-06-26 22:24:05 +00:00
Greg Clayton 111db4f94c Fixed the process_events.py example to be able to specify the platform and also use the debugger's listener.
llvm-svn: 185027
2013-06-26 22:23:45 +00:00
Greg Clayton 57d1c4865e Added a regex that can be specified to avoid showing contents on types that match. Also split things up a bit so this can be run as a stand alone script or in lldb.
llvm-svn: 184628
2013-06-22 01:42:49 +00:00
Jason Molenda e445f8fb4d Also report any OS python plugin in use.
llvm-svn: 184487
2013-06-20 22:05:35 +00:00
Jason Molenda 1332988f5a Print the general purpose registers for frame 0.
llvm-svn: 184483
2013-06-20 21:57:34 +00:00