Commit Graph

64 Commits

Author SHA1 Message Date
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
Zachary Turner 9618980a19 Python 3: Modernize exception raising syntax.
Old-style: `raise foo, bar`
New-style: `raise foo(bar)`

These two statements are equivalent, but the former is an error in
Python 3.

llvm-svn: 251977
2015-11-03 21:01:45 +00:00
Todd Fiala 53e758b09c syncsource.py: a specific dir's source_excludes may now include the special entry "<no-defaults>".
The <no-defaults> special entry will prevent that specific directory's excludes from
receiving the global default source excludes.  This allows overriding the global default
in a specific instance, simplifying the syntax for that case.

llvm-svn: 249705
2015-10-08 17:43:02 +00:00
Todd Fiala 5493e31be0 Adjustments to syncsource.py.
- renamed sync-source.py to syncsource.py to appease pylint.
- added missing lib/transfer/__init__.py file.  Fumble from
  git to svn.
- adjusted README to call sync-source.py syncsource.py, and
  call .sync-sourcerc .syncsourcerc.
- marked syncsource.py as executable by all.

llvm-svn: 247922
2015-09-17 19:23:50 +00:00
Todd Fiala 37e56318ec Add sync-source.py utility.
See:
http://reviews.llvm.org/D12940

for more  details.

See utils/sync-source/README.txt for documentation
and a sample .sync-sourcerc file.

llvm-svn: 247903
2015-09-17 17:14:31 +00:00
Wei Pan 133ac8714d LUI: Fix some issues causing crashes in the source view
llvm-svn: 193217
2013-10-23 01:18:21 +00:00
Sriram Murali 1aeda01c44 lui: enable tab completion in command window
llvm-svn: 192814
2013-10-16 17:08:55 +00:00
Sriram Murali 8a0386654a prevent lui from crashing with small source files
llvm-svn: 192811
2013-10-16 16:48:43 +00:00
Ben Langmuir 4a665f1105 A couple of small visual improvements for lui
Change titles to white rather than green text to improve readability on blue
background, and use erase() instead of clear() to reduce flicker in the source
window.

llvm-svn: 192768
2013-10-16 03:01:04 +00:00
Ben Langmuir a084b33fb8 lui: clean up breakpoint window, and allow multi-line list items
* Clean the SBBreakpoint: id = out of the output
* clamp output to window width (eventually we should be able to scroll
left/right)
* On 'tab', expand a breakpoint to show its locations
* Allow enter/space to toggle breakpoints

llvm-svn: 192766
2013-10-16 02:01:41 +00:00
Ben Langmuir ac20991f1d Add a ListWin to cui to show scrollabled lists
Author: Paul Redmond <paul.redmond@intel.com>
llvm-svn: 192765
2013-10-16 02:00:21 +00:00
Daniel Malea e33c4ba05c Add LLVM license headers to lldb ui frontend
llvm-svn: 192466
2013-10-11 17:13:07 +00:00
Daniel Malea 4c3261d1b3 Initial checkin of curses-based LLDB UI (lui)
LLDB (Terminal) User Interface
==============================
This directory contains the curses user interface for LLDB. To use it, ensure Python can find your lldb module. You may have to modify PYTHONPATH for that purpose:

$ export PYTHONPATH=/path/to/lldb/module

Then, run the lui.py. To load a core file:
$ ./lui.py --core core

To create a target from an executable:
$ ./lui.py /bin/echo "hello world"

To attach to a running process:
$ ./lui.py --attach <pid>


Known Issues
============
1. Resizing the terminal will most likely cause lui to crash.
2. Missing paging in command-window
3. Only minimal testing (on Ubuntu Linux x86_64)

Missing Features
================
- stdin/stdout/stderr windows
- memory window
- backtrace window
- threads window
- tab-completion
- syntax-highlighting (via pygments library)
- (local) variables window
- registers window
- disassembly window
- custom layout

llvm-svn: 192326
2013-10-09 22:11:30 +00:00
Daniel Malea bb43721a35 Fixed continue issues with process attach/detach
- added code for tracking transition from eStateAttaching to eStateStopped in event listener and handling process continuation there.

Patch by Arthur Evstifeev!

llvm-svn: 182806
2013-05-28 21:27:03 +00:00
Daniel Malea 96a6f90d84 Improve vim-lldb expression commands for objective-c and implement evaluate-under-cursor:
1. Added new :Lpo command
2. :Lpo and :Lprint can be invoked without parameters. In that case
cursor word will be used
3. Added :LpO command in that case instead of <cword> will be used
stripped <cWORD>. This command is useful for printing objective-c
properties (for ex.: self.tableView). 

Patch by Arthur Evstifeev!!

llvm-svn: 182613
2013-05-23 21:34:26 +00:00
Daniel Malea 6d73a8ec08 Add entries to vim-lldb plugin docs/help page for :Lattach and :Ldetach
llvm-svn: 182491
2013-05-22 17:29:38 +00:00
Daniel Malea 2e88c6b661 LLDB Vim plugin usability improvement: ":Lshow" now displays all panes
- no longer requires a pane name argument

Patch by Arthur Evstifeev

llvm-svn: 182484
2013-05-22 16:05:55 +00:00
Daniel Malea a7c86e1553 Implement attach by name in LLDB Vim plugin using ":Lattach <process-name>"
patch by Arthur Evstifeev

llvm-svn: 182483
2013-05-22 16:04:28 +00:00
Daniel Malea 69357ecb6d Minor update to Vim frontend: simplify breakpoints display (and list unresolved breakpoints)
llvm-svn: 174923
2013-02-12 00:31:40 +00:00
Daniel Malea ac4ce0cd4a Add Vim frontend to LLDB.
- Access any LLDB CLI command in Vim by typing ":L<command>". Tab-completion
  works too!
- See source locations for breakpoints and the current PC with vim "marks"
  and highlights.
- Examine backtraces, locals, disassembly, registers, and breakpoints in
  dedicated Vim windows.
- See when in-scope variables and registers change by watching for (red)
  highlights.

This plugin opens multiple Vim "windows" to display debugger information.
To quit all windows at the same time use ":qa". The alternative would be
":q" to close each window separately.

This plugin is known to work on Mac OS X (Mountain Lion) with MacVim and
the system-provided terminal Vim, and on Linux (Ubuntu 12.04 and 12.10)
with GVim and the terminal Vim from the "vim-gnome" package.

llvm-svn: 174892
2013-02-11 17:18:14 +00:00
Johnny Chen 641e95de86 Minor cleanup.
llvm-svn: 152038
2012-03-05 18:25:29 +00:00
Johnny Chen e79a8d3dce Add a utility script:
Greps and returns the first svn log entry containing a line matching the regular
expression pattern passed as the only arg.

Example:

svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h$'

llvm-svn: 143671
2011-11-04 01:05:29 +00:00
Johnny Chen 7571ba7015 Remove utils/emacs directory from lldb.
llvm-svn: 141554
2011-10-10 17:58:30 +00:00
Johnny Chen 1cd81bf9e5 Fix typos in comment.
llvm-svn: 138179
2011-08-20 01:02:31 +00:00
Johnny Chen 8fff33615d Use os.walk(), available since 2.3, instead of os.path.walk(), removed in 3.0,
to walk the directory tree.  Plus, we can concentrate only on leaf nodes, i.e., files.

llvm-svn: 138178
2011-08-20 01:00:16 +00:00
Johnny Chen 20f19d1d02 No need to look further if the file is a symbolic link. Look for the real file.
Plus add some comments.

llvm-svn: 138159
2011-08-20 00:12:13 +00:00
Johnny Chen 758f288cdd Add a Python script to locate each binary file under a root directory which matches some pathname pattern
and to invoke lldb-disasm.py on the binary file to disassemble its symbols.  The number of symbols can
be specified by, for example, '-n 10000', to specify 10,000 symbols to disassemble for each module.
By default, only 1000 symbols from each module are disassembled.

Example:

utils/test/run-dis.py -r '/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3/Symbols' -p '^/System/Library/.*Frameworks/.*\.framework/[^/]+$'

tries to disassemble every public/private frameworks (by default only 1000 symbols are disassembled) under iOS4.3.

llvm-svn: 138078
2011-08-19 20:51:15 +00:00
Johnny Chen 4c35b711da Fix TypeError exception for re.compile().
llvm-svn: 138045
2011-08-19 17:28:25 +00:00
Johnny Chen 293683b6c4 Add an option (-p regexp-pattern) to specify the regular expression symbol pattern we're interested in disassembling.
An example:

utils/test/lldb-disasm.py -C "platform select remote-ios" -o "-b -n" -e '~/CoreFoundation' -n 20 -p '-\[NSArray .+\]'

disassembles the first 20 NSArray instance methods found in the CoreFoundation module.

llvm-svn: 138002
2011-08-18 22:46:50 +00:00
Johnny Chen 901209dcca Add an option '-q' to have quiet disassembly by not printing out the disassembled result.
This could be useful by reducing the strain on standard output.

Example:

utils/test/lldb-disasm.py -C "platform select remote-ios" -o "-b -n" -e '~/CoreFoundation' -n 50 -q

llvm-svn: 137988
2011-08-18 22:04:27 +00:00
Johnny Chen 67a3e9e40c Update usage comment.
llvm-svn: 133020
2011-06-14 22:23:54 +00:00
Johnny Chen f7626eff37 Turn off printing of command sent to the pexpect-spawned child process to make the script more robotic.
llvm-svn: 132441
2011-06-01 23:53:57 +00:00
Johnny Chen 8831e18b17 Make 'run-until-faulted.py' script more interesting by modifying the example main.c program
to seg fault randomly instead of deterministically.

Example:

[15:10:43] johnny:/Volumes/data/lldb/svn/trunk/utils/test $ clang -g main.c
[15:10:46] johnny:/Volumes/data/lldb/svn/trunk/utils/test $ ./run-until-faulted.py -l $PWD/../../build/Debug/lldb -e a.out
lldb command: /Volumes/data/lldb/svn/trunk/utils/test/../../build/Debug/lldb
executable: a.out
executable options: 
(lldb) sending 'file a.out' command...
file a.out
Current executable set to 'a.out' (x86_64).
(lldb) sending 'process launch -- ' command... (iteration: 0)
process launch -- 
Process 63630 launched: '/Volumes/data/lldb/svn/trunk/utils/test/a.out' (x86_64)
Hello, fault!
val=9
Better luck next time!
Process 63630 exited with status = 0 (0x00000000) 
(lldb) sending 'process launch -- ' command... (iteration: 1)
process launch -- 
Process 63633 launched: '/Volumes/data/lldb/svn/trunk/utils/test/a.out' (x86_64)
Process 63633 exited with status = 0 (0x00000000) 
sending 'process launch -- ' command... (iteration: 2)
Hello, fault!
val=0
Better luck next time!
(lldb) process launch -- 
Process 63637 launched: '/Volumes/data/lldb/svn/trunk/utils/test/a.out' (x86_64)
Hello, fault!
val=15
Better luck next time!
Process 63637 exited with status = 0 (0x00000000) 
(lldb) sending 'process launch -- ' command... (iteration: 3)
process launch -- 
Process 63640 launched: '/Volumes/data/lldb/svn/trunk/utils/test/a.out' (x86_64)
Hello, fault!
val=2
Better luck next time!
Process 63640 exited with status = 0 (0x00000000) 
sending 'process launch -- ' command... (iteration: 4)
(lldb) process launch -- 
Process 63643 launched: '/Volumes/data/lldb/svn/trunk/utils/test/a.out' (x86_64)
Process 63643 stopped
* thread #1: tid = 0x2d03, 0x0000000100000e93 a.out`main + 99 at main.c:11, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  frame #0: 0x0000000100000e93 a.out`main + 99 at main.c:11
   8   	    u_int32_t val = (arc4random() & 0x0f);
   9   	    printf("val=%u\n", val);
   10  	    if (val == 0x07) // Lucky 7 :-)
-> 11  	        printf("Now segfault %d\n", *null_ptr);
   12  	    else
   13  	        printf("Better luck next time!\n");
   14  	}
(lldb) 
* thread #1: tid = 0x2d03, 0x0000000100000e93 a.out`main + 99 at main.c:11, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  frame #0: 0x0000000100000e93 a.out`main + 99 at main.c:11
   8   	    u_int32_t val = (arc4random() & 0x0f);
   9   	    printf("val=%u\n", val);
   10  	    if (val == 0x07) // Lucky 7 :-)
-> 11  	        printf("Now segfault %d\n", *null_ptr);
   12  	    else
   13  	        printf("Better luck next time!\n");
   14  	}
Hello, fault!
val=7
(lldb) 

llvm-svn: 132430
2011-06-01 22:12:27 +00:00
Johnny Chen 26fc16b032 Use built-in truth value testing.
llvm-svn: 132078
2011-05-25 20:47:27 +00:00
Johnny Chen a542f10092 Fix usage comment.
llvm-svn: 131925
2011-05-23 21:56:08 +00:00
Johnny Chen b5aa97ecc5 Add a Python utility to help convert the Mail.app saved 'Raw Message Source' .eml file to a git-am friendly file.
llvm-svn: 131924
2011-05-23 21:50:12 +00:00
Johnny Chen 6cd4d1d85a Modified to take advantage of the iteration protocol for our lldb container objects.
llvm-svn: 130457
2011-04-28 23:34:58 +00:00
Johnny Chen 511e8c0d36 Add a Python script which launches a program from within lldb and loop until the
process stops for some reason.  main.c (compiled into a.out) is used as an example in
the README-run-until-faulted file.

llvm-svn: 128755
2011-04-02 01:20:28 +00:00
Johnny Chen d16c105c3d Take advantage of the newly added SBSymbol.GetType() API to check whether we
have a Code symbol and do disassembly on it.

llvm-svn: 128604
2011-03-31 01:34:55 +00:00
Johnny Chen 0e43f321b6 Add a generator to iterate through the code symbols for a given target.
To be modified to take advantage of the new SBSymbol API which checks a symbol for its type.

llvm-svn: 128601
2011-03-31 01:06:28 +00:00
Johnny Chen 318e7ba65d Add an option to specify the symbols to disassemble instead of the existing 'num of symbols to disassemble'
option.  If both are present, the 'symbols to disassemble' overrides the 'num of symbols to disassemble'.

An example usage:

$ ./lldb-disasm.py -C 'platform create remote-ios' -e /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib -o '-r -n' -s vprintf -s acosf_special

llvm-svn: 128569
2011-03-30 18:47:54 +00:00
Johnny Chen 6454e15f49 Add the ability to invoke lldb's disassemble command on the symbols digested from
the 'image dump symtab' command.  The number of symbols to disassemble can be
specified by the '-n Num' option, or unlimited if not specified.

llvm-svn: 128442
2011-03-29 01:07:00 +00:00
Johnny Chen 4044fdccfc Doc string change.
llvm-svn: 128429
2011-03-28 22:48:25 +00:00
Johnny Chen 5e28aa5d9b Add an initial version of lldb-disasm.py script whose purpose is to iterate through
all the symbols for an executable image and to issue the lldb 'disassemble' command
on each symbol.  The initial version just dumps the symbol table.

llvm-svn: 128428
2011-03-28 22:40:32 +00:00
Johnny Chen 9d46337511 Add options to allow for specifying an option string when spawning gdb and for executing
command(s) right after starting up gdb.  Update the README file to show an example of
using these to pass '-arch armv7' to gdb and to execute gdb command to set shared library
path substitutions before loading iOS4.3 sdk's /usr/lib/libSystem.B.dylib and disassembling
the 'printf' function.

llvm-svn: 128040
2011-03-21 23:44:44 +00:00
Johnny Chen 31d446aa5c Fix a typo in the message string.
llvm-svn: 128034
2011-03-21 23:01:34 +00:00
Johnny Chen 5c07daaa1d Modify disasm.py to better deal with the objc method name which has ':' in them.
Add a utility similar to disasm.py, but which provides a shell-like environment for invoking llvm-mc.

llvm-svn: 127936
2011-03-19 01:24:25 +00:00
Johnny Chen 0d825132c6 Tidy up the input file given to 'llvm-mc -disassemble' and also append the gdb
assembler code to the memory dump.

llvm-svn: 127823
2011-03-17 19:05:34 +00:00
Johnny Chen 6f6fb3e515 Add a Python script to take an executable, run gdb to disassemble a function,
read the memory contents of the function, and then feed the bytes to the
'llvm-mc -disassemble' command.

It uses the pexpect module located under ToT/test/pexpect-2.4 directory to
automate the interaction with gdb.  This is used initially to test the low
level ARM disassembler of llvm.

llvm-svn: 127785
2011-03-17 00:59:57 +00:00
Johnny Chen 0e65ce3de8 Add readme on the version of emacs that works with lldb-enhanced gud.el,
for Stuart Hastings. :-)

llvm-svn: 126469
2011-02-25 01:51:25 +00:00