Commit Graph

305 Commits

Author SHA1 Message Date
Greg Clayton 7143f00ae9 Improved "objc_refs" a bit to be able to find all instances of a class'
superclasses on top of finding the exact class. The current attempt is still
too slow, but it lays the groundwork.

llvm-svn: 163135
2012-09-04 14:09:21 +00:00
Greg Clayton c373ca5c74 <rdar://problem/12069589>
Fixed an issue where not all text would always be seen when running any of the functions in heap.py in Xcode. Now we put the text directly into the command result object and skip STDIO since we have issues with STDIO right now in python scripts.

Also fixed an issue with the "--stack-history" option where MallocStackLoggingNoCompact was assumed to have to be enabled... It doesn't, just MallocStackLogging.

llvm-svn: 163042
2012-09-01 00:34:35 +00:00
Jason Molenda d204afaee8 Make the tab character in the thread frame lines optional.
llvm-svn: 163037
2012-08-31 23:27:24 +00:00
Greg Clayton 97e44a0cc7 Added command lists that can be executed on launch, stop, crash and exit. Added code to auto import the lldb module that we can use on many stand alone modules.
llvm-svn: 162972
2012-08-31 02:55:56 +00:00
Greg Clayton c769722a16 Added an example that show correct usage of the async process event API.
llvm-svn: 162967
2012-08-31 01:11:17 +00:00
Greg Clayton 1f7460716b <rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.

llvm-svn: 162860
2012-08-29 21:13:06 +00:00
Jason Molenda e5ad3859eb Instead of using re.split and requiring two spaces between the "regname: regvalue" pairs,
use re.findall and specify the regexp of regname: regvalue that we're interested in.
<rdar://problem/12188752> 

llvm-svn: 162806
2012-08-28 23:46:12 +00:00
Enrico Granata 114bb19d19 Data formatters for libc++ deque and shared/weak ptrs - a contribution by Jared Grubb
llvm-svn: 162680
2012-08-27 17:42:50 +00:00
Greg Clayton 435ce13937 The OS plug-in can now get data from a python script that implements the protocol.
llvm-svn: 162540
2012-08-24 05:45:15 +00:00
Greg Clayton a83b6cf244 We have a partially working OS plug-in through python!
llvm-svn: 162532
2012-08-24 02:01:39 +00:00
Enrico Granata b710b8db3d Fixing an issue in the OS sample
llvm-svn: 162531
2012-08-24 01:53:47 +00:00
Greg Clayton 2443cbd7f5 Added Args::StringForEncoding(), Args::StringToGenericRegister() and centralized the parsing of the string to encoding and string to generic register.
Added code the initialize the register context in the OperatingSystemPython plug-in with the new PythonData classes, and added a test OperatingSystemPython module in lldb/examples/python/operating_system.py that we can use for testing.

llvm-svn: 162530
2012-08-24 01:42:50 +00:00
Johnny Chen d79f06cf12 Modified .lldb-loggings now to direct the lldb log files to the same session directory which also houses the test logs.
llvm-svn: 162387
2012-08-22 20:25:33 +00:00
Johnny Chen c50ce97745 Demonstrate how to use the config file and the pre-flight functionality to route the lldb gdb-remote log messages
into individually named log destinations.  In the simple usage-lldb-loggings example, we ran two cases which resulted
in two lldb_log files.

llvm-svn: 162378
2012-08-22 18:48:13 +00:00
Greg Clayton 486290078c Added qVAttachOrWaitSupported packet support.
llvm-svn: 162207
2012-08-20 16:50:43 +00:00
Greg Clayton 45b673dad5 <rdar://problem/12087275>
Make the crashlog parser able to deal with spaces in the process name.

llvm-svn: 161772
2012-08-13 18:48:03 +00:00
Greg Clayton 774ebdfcd1 Added a new "objc_refs" command that will track down all allocations on the heap that have the "isa" for the objective C class at offset zero. This will need to be improved to deal with KVO classes, but it is a start. It also disallows looking up a pointer value of zero since that would return way too many matches.
llvm-svn: 161724
2012-08-11 02:26:26 +00:00
Filipe Cabecinhas bbb648ef80 Make the objc-runtime work with Python 2.6
llvm-svn: 161111
2012-08-01 14:38:37 +00:00
Jim Ingham 584745a692 Added a few more summaries I find useful for lldb.
llvm-svn: 160909
2012-07-28 00:37:21 +00:00
Greg Clayton 784933b791 Enable the "symbolicate" interactive command to symbolicate all crash logs if no indexes are supplied. This can be handy to use as:
(lldb) script import lldb.macosx.crashlog
(lldb) crashlog -i /tmp/*.crash
% symbolicate --crashed-only

This will symbolicate all of the crash logs only for the crashed thread.

Also print out the crash log index number in the output of the interactive "image" command:

(lldb) script import lldb.macosx.crashlog
(lldb) crashlog -i /tmp/*.crash
% image LLDB.framework
...

This then allows you to symbolicate a crash log by index accurately when you looked for an image of a specific version

llvm-svn: 160316
2012-07-16 20:40:20 +00:00
Enrico Granata 4b7b5aa0bc <rdar://problem/11773899> Formatters for BOOL* and BOOL&
llvm-svn: 160181
2012-07-13 18:55:41 +00:00
Enrico Granata 811e9055fd <rdar://problem/11753405> Making sure we deal correctly with signed NSNumber values
llvm-svn: 160179
2012-07-13 18:53:14 +00:00
Greg Clayton c51d70d9d5 Show source by default for the first 4 frames of the crash thread. Also added options to allow showing source for all frames (--source-frames=NFRAMES) and for all threads (--source-all).
llvm-svn: 160175
2012-07-13 17:58:52 +00:00
Greg Clayton 563d03934c Added the ability to see source context with each frame in the "crashlog" command with the "--source-context" (-C for short to match grep) option.
Also made the symbolication of the crash logs more efficient when using the "--crashed-only" ("-c") option where only the crashed thread is symbolicated. We now only download the images for the frames in the crashed thread.

llvm-svn: 160160
2012-07-13 03:19:35 +00:00
Greg Clayton e04cfd2180 Added the ability to search through sections for pointer data.
llvm-svn: 160083
2012-07-11 22:13:18 +00:00
Greg Clayton 9407302d37 Make const result value objects able to return dynamic types.
Modified the heap.py to be able to correctly indentify the exact ivar for the "ptr_refs" command no matter how deep the ivar is in a class hierarchy. Also fixed the ability for the heap command to symbolicate the stack backtrace when MallocStackLogging is set in the environment and the "--stack" option was specified.

llvm-svn: 159883
2012-07-07 01:22:45 +00:00
Greg Clayton 39cacebd26 Added a new example that extracts all global variables from an object file and prints any available info.
llvm-svn: 159775
2012-07-05 20:24:41 +00:00
Greg Clayton f7ab038ada Make the interactive command interpreter build into the "crashlog" command work correctly when run inside LLDB. Before this fix the "cmd.Cmd" object was trying to read from stdin itself and it was competing without command interpreter for the bytes.
llvm-svn: 159688
2012-07-03 21:40:18 +00:00
Greg Clayton a7fb1dcd4b Listen to the "--verbose" flag when running "crashlog" and if verbose is enabled, then dump full paths to source files and modules.
Changed much of the output that was coming out with "--verbose" over to use the new "--debug" flag.

llvm-svn: 159363
2012-06-28 18:10:14 +00:00
Greg Clayton f47b2c26bb Added a "save_crashlog" command to the lldb.macosx.crashlog package that allow you to dump your current process state out to a crash log file. This will dump all of the target module information with all load addresses, UUID values, and shared library paths, as well as all thread stacks and the crash log header. This will make it easy for us to save the current state of a process and then reload it later into LLDB.
llvm-svn: 159286
2012-06-27 20:02:04 +00:00
Greg Clayton 89d4f338a7 Check the return status of the make command.
llvm-svn: 159284
2012-06-27 19:57:59 +00:00
Greg Clayton 5b889eec4a Remove dependency on internal header file.
llvm-svn: 159283
2012-06-27 19:57:13 +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 eb749096e0 Added the ability to run "symbolicate [options] <crashlog-index>" in interactive mode.
llvm-svn: 157770
2012-05-31 21:21:08 +00:00
Enrico Granata 7c015e1020 Fixes for performance to data formatters - Python < 3.0 is much slower when using True/False as compared to 1/0 for logical values. Wexploit this to our advantage. Other minor tweaks
llvm-svn: 157209
2012-05-21 21:52:38 +00:00
Enrico Granata 263ebe5f78 Optimizations to the Python ObjC formatters - Benchmarking infrastructure
llvm-svn: 157066
2012-05-18 19:55:37 +00:00
Greg Clayton f67002dd4c Make sure to subtract one from the PC when doing the symbolication of stack frames when it isn't the zero'th frame.
llvm-svn: 156974
2012-05-17 03:58:23 +00:00
Greg Clayton 563566c9dd Fixed an exception when parsing crash logs.
llvm-svn: 156945
2012-05-16 20:49:19 +00:00
Enrico Granata bd5a7a9f03 Fixing a bug where the summary for certain NSStrings was being returned as empty in spite of the string actually having a content
llvm-svn: 156793
2012-05-15 01:22:45 +00:00
Greg Clayton 0021bd2fe3 Remove comments and an extra print statement.
llvm-svn: 156651
2012-05-11 21:57:50 +00:00
Greg Clayton 341039faca More fixes to "malloc_history".
llvm-svn: 156605
2012-05-11 02:42:36 +00:00
Greg Clayton 60bb58f669 Modified the symbolication.Image object to store its uuid as a uuid.UUID object and made an accessor for getting a normalized UUID value out of the image object.
Modified the crashlog darwin module to always create a uuid.UUID object when making the symbolication.Image objects. Also modified it to handle some more types of crash log files and improved the register reading for thread registers of crashed threads.

llvm-svn: 156596
2012-05-11 00:30:14 +00:00
Greg Clayton 7200ed1b94 "--stack-history" now works if you have MallocStackLogggingNoCompact defined in your app's environment.
llvm-svn: 156588
2012-05-10 23:37:52 +00:00
Greg Clayton 370f5fd20a Fixed a build error.
llvm-svn: 156586
2012-05-10 23:20:50 +00:00
Greg Clayton d9fc53509e Added the ability to get the stack history for a malloc block. This is a work in progress. Checking this in so I can work on it some more.
llvm-svn: 156584
2012-05-10 23:17:28 +00:00
Johnny Chen afc98a6d7e Make crashlog.py more robust when dealing with the "Version: ..." header from the crash log file.
rdar://problem/11428134

llvm-svn: 156581
2012-05-10 22:45:54 +00:00
Enrico Granata 9123950ab1 A simple implementation of a summary and synthetic children providers for LLDB-specific shared pointers - This could be generalized to work with C++11 shared pointers with relative ease
llvm-svn: 156410
2012-05-08 19:21:13 +00:00
Greg Clayton c8f73d7b96 Added an interactive mode to the "crashlog" command so that we can look at multiple crash logs at once and do some data mining. Added an interactive command prompt that allows you to do:
% PYTHONPATH=./build/Debug/LLDB.framework/Resources/Python ; ./build/Debug//LLDB.framework/Resources/Python/lldb/macosx/crashlog.py -i ~/Downloads/crashes2/*.crash ) 

then you get an interactive prompt where you can search for data within all crash logs. For example you can do:

% list

which will list all crash logs

And you can search for all images given an image basename, or full path:

% image LLDB
% image /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
% image LLDB.framework

Which would all produce an output listing like:

40CD4430-7D27-3248-BE4C-71B1F36FC5D0 (1.132 - 132) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000011f8bc000 - 0x0000000120d3efbf)
B727A528-FF1F-3B20-9E4F-BBE96C7D922D (1.136 - 136) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000011e7f7000 - 0x000000011fc7ff87)
4D6F8DC2-5757-39C7-96B0-1A5B5171DC6B (1.137 - 137) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000012bd7f000 - 0x000000012d1fcfef)
FBF8786F-92B9-31E3-8BCD-A82148338966 (1.137 - 137) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000122d78000 - 0x00000001241f5fd7)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000119b8d000 - 0x000000011b02ef5f)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000111497000 - 0x0000000112938f5f)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000116680000 - 0x0000000117b21f5f)

llvm-svn: 156201
2012-05-04 20:44:14 +00:00
Johnny Chen 356782f5f6 Fix the following error when importing crashlog.py from a Python interactive session:
AttributeError: 'module' object has no attribute 'debugger'

llvm-svn: 156115
2012-05-03 22:31:30 +00:00
Johnny Chen 8e1fd43ad7 Fix AttributeError when using crashlog with verbose mode.
rdar://problem/11374653

llvm-svn: 156088
2012-05-03 18:46:28 +00:00
Enrico Granata 73076f9269 Automatically enabling the Cocoa formatter categories for command-line LLDB. Previously, the categories were filled in but disabled by default. Tweaking test cases appropriately to keep working and do the right thing
llvm-svn: 155605
2012-04-26 01:40:38 +00:00
Greg Clayton 4f76fef267 Make the libheap.dylib build into a consistent temp directory so it can be reused between lldb invocations. Also add the module name into the directory path that is used to store the target triple specific build of libheap.dylib.
Also added code that will rebuild libheap.dylib if heap_find.cpp is newer that libheap.dylib.

llvm-svn: 155590
2012-04-25 21:23:07 +00:00
Enrico Granata de93b6b42f Fixing a typo in the NSArray data formatter
llvm-svn: 155586
2012-04-25 20:59:02 +00:00
Greg Clayton d712ef0fd7 Remove the "-x" from the finish-swig-Python-LLDB.sh shell options so it doesn't print out all of the commands when executing the shell script.
Cleaned up the lldb.utils.symbolication, lldb.macosx.heap and lldb.macosx.crashlog. The lldb.macosx.heap can now build a dylib for the current triple into a temp directory and use it from there.

llvm-svn: 155577
2012-04-25 18:40:20 +00:00
Enrico Granata 7d22221759 Returning data formatters to their previous working condition - Plus fixing an issue that was preventing Python oneliners from executing
llvm-svn: 155563
2012-04-25 17:53:41 +00:00
Enrico Granata eb36cadb68 Fixing an over-substitution of text
llvm-svn: 155556
2012-04-25 16:35:54 +00:00
Enrico Granata 85ce21c04d Make the C++ formatters importable by having them use the right package to import and reference the Logger
llvm-svn: 155555
2012-04-25 16:32:39 +00:00
Greg Clayton ed3eee6e55 Now that we have an LLDB package, make the "lldb.macosx.crashlog" module work with all of the new module paths.
llvm-svn: 155528
2012-04-25 01:49:50 +00:00
Enrico Granata 28399adad8 Making the Cocoa formatters comply with the new on-disk layout of the Python resources - This is one of the steps towards making the data formatters work again
llvm-svn: 155526
2012-04-25 01:39:27 +00:00
Greg Clayton 938aa00795 Remove unneeded files.
llvm-svn: 155524
2012-04-25 01:25:22 +00:00
Greg Clayton 81e9ebf798 Move the source and Makefile into a directory so it will be easier to install.
llvm-svn: 155523
2012-04-25 01:25:04 +00:00
Greg Clayton b1ba1bb194 Make the Makefile stand alone.
llvm-svn: 155520
2012-04-25 01:19:20 +00:00
Greg Clayton 6d98f56c58 Maked LLDB into a package so we can import things without poluting the global namespace.
Enrico will follow this up with fixing the data formatter test cases that are failing.

llvm-svn: 155514
2012-04-25 00:58:03 +00:00
Greg Clayton b403a15ded Added code to automatically load the libheap.dylib when ptr_refs, cstr_refs or malloc_info are called. If MallocStackLogging is enabled, then you can now use --stack to dump the backtrace of the code that allocated each malloc block.
llvm-svn: 155262
2012-04-21 00:11:26 +00:00
Greg Clayton f99295c3a6 Fixed some issues with symbolicating things. Fixed symbolication.add_module() to not use the resolved_path before we have tried to locate it. Fixed crashlog.locate_module_and_debug_symbols() to return true and false correctly.
llvm-svn: 155255
2012-04-20 23:31:27 +00:00
Johnny Chen 44d2497138 Add the capability of supplying the pre/post-flight functions to the test suite such that
the pre-flight code gets executed during setUp() after the debugger instance is available
and the post-flight code gets executed during tearDown() after the debugger instance has
done killing the inferior and deleting all the target programs.

Example:

[11:32:48] johnny:/Volumes/data/lldb/svn/ToT/test $ ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-pre-post-flight  functionalities/watchpoint/hello_watchpoint
config: {'pre_flight': <function pre_flight at 0x1098541b8>, 'post_flight': <function post_flight at 0x109854230>}
LLDB build dir: /Volumes/data/lldb/svn/ToT/build/Debug
LLDB-139
Path: /Volumes/data/lldb/svn/ToT
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 154753
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 154730
Last Changed Date: 2012-04-13 18:42:46 -0700 (Fri, 13 Apr 2012)


lldb.pre_flight: def pre_flight(test):
    __import__("lldb")
    __import__("lldbtest")
    print "\nRunning pre-flight function:"
    print "for test case:", test

lldb.post_flight: def post_flight(test):
    __import__("lldb")
    __import__("lldbtest")
    print "\nRunning post-flight function:"
    print "for test case:", test


Session logs for test failures/errors/unexpected successes will go into directory '2012-04-16-11_34_08'
Command invoked: python ./dotest.py -A x86_64 -v -c ../examples/test/.lldb-pre-post-flight functionalities/watchpoint/hello_watchpoint
compilers=['clang']

Configuration: arch=x86_64 compiler=clang
----------------------------------------------------------------------
Collected 2 tests

1: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... 
Running pre-flight function:
for test case: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)

Running post-flight function:
for test case: test_hello_watchpoint_with_dsym_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
ok
2: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
   Test a simple sequence of watchpoint creation and watchpoint hit. ... 
Running pre-flight function:
for test case: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)

Running post-flight function:
for test case: test_hello_watchpoint_with_dwarf_using_watchpoint_set (TestMyFirstWatchpoint.HelloWatchpointTestCase)
ok

----------------------------------------------------------------------
Ran 2 tests in 1.584s

OK

llvm-svn: 154847
2012-04-16 18:55:15 +00:00
Sean Callanan f5c87882a0 Added a --lldb option to override the location
of LLDB.framework.

llvm-svn: 154728
2012-04-14 01:06:06 +00:00
Greg Clayton d84bb48582 Added a --memory option to allow dumping the matching malloc block memory with a default format that makes sense, or that format can be overridden with the --format option.
llvm-svn: 154671
2012-04-13 16:24:09 +00:00
Greg Clayton 1bcb26c672 Fixed some expression issues after switching to void * args.
llvm-svn: 154615
2012-04-12 21:06:22 +00:00
Greg Clayton 7767716d0f A few tweaks done to the heap.py in me free time where we now have:
(lldb) command script import heap.py

Find all malloc blocks that contains a pointer value of 0x1234000:
(lldb) ptr_refs 0x1234000

Find all malloc blocks that contain a C string:
(lldb) cstr_refs "hello"

Get info on a malloc block that starts at or contains 0x12340000
(lldb) malloc_info 0x12340000

llvm-svn: 154602
2012-04-12 18:57:36 +00:00
Greg Clayton 7fb671bac0 Cleaned up the code and we now also dump the dynamic object for the malloc block. Using this on the lldb/test/lang/objc/foundation test we can see this in action:
First we can load the module:

(lldb) command script import /Volumes/work/gclayton/Documents/src/lldb/examples/darwin/heap_find/heap.py
Loading "/Volumes/work/gclayton/Documents/src/lldb/examples/darwin/heap_find/libheap.dylib"...ok
Image 0 loaded.
"heap_ptr_refs" and "heap_cstr_refs" commands have been installed, use the "--help" options on these commands for detailed help.


Lets take a look at the variable "my":

(lldb) fr var *my
(MyString) *my = {
  MyBase = {
    NSObject = {
      isa = MyString
    }
    propertyMovesThings = 0
  }
  str = 0x0000000100301a60
  date = 0x0000000100301e60
  _desc_pauses = NO
}


We can see that this contains an ivar "str" which has a pointer value of "0x0000000100301a60". Lets search the heap for this pointer and see what we find:

(lldb) heap_ptr_refs 0x0000000100301a60
found pointer 0x0000000100301a60: block = 0x103800270, size = 384, offset = 168, type = 'void *'
found pointer 0x0000000100301a60: block = 0x100301cf0, size = 48, offset = 16, type = 'MyString *', ivar = 'str' 
(MyString) *addr = {
  MyBase = {
    NSObject = {
      isa = MyString
    }
    propertyMovesThings = 0
  }
  str = 0x0000000100301a60
  date = 0x0000000100301e60
  _desc_pauses = NO
}
found pointer 0x0000000100301a60: block = 0x100820000, size = 4096, offset = 96, type = (autorelease object pool)
found pointer 0x0000000100301a60: block = 0x100820000, size = 4096, offset = 104, type = (autorelease object pool)


Note that it used dynamic type info to find that it was in "MyString" at offset 16 and it also found the ivar "str"!

We can also look for C string values on the heap. Lets look for "a.out":

(lldb) heap_cstr_refs "a.out"
found cstr a.out: block = 0x10010ce00, size = 96, offset = 85, type = '__NSCFString *'
found cstr a.out: block = 0x100112d90, size = 80, offset = 68, type = 'void *'
found cstr a.out: block = 0x100114490, size = 96, offset = 85, type = '__NSCFString *'
found cstr a.out: block = 0x100114530, size = 112, offset = 97, type = '__NSCFString *'
found cstr a.out: block = 0x100114e40, size = 32, offset = 17, type = '__NSCFString *'
found cstr a.out: block = 0x100114fa0, size = 32, offset = 17, type = '__NSCFString *'
found cstr a.out: block = 0x100300780, size = 160, offset = 128, type = '__NSCFData *'
found cstr a.out: block = 0x100301a60, size = 112, offset = 97, type = '__NSCFString *'
found cstr a.out: block = 0x100821000, size = 4096, offset = 100, type = 'void *'

We see we have some objective C classes that contain this, so lets "po" all of the results by adding the --po option:

(lldb)  heap_cstr_refs a.out --po
found cstr a.out: block = 0x10010ce00, size = 96, offset = 85, type = '__NSCFString *'
  (__NSCFString *) 0x10010ce00 /Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out

found cstr a.out: block = 0x100112d90, size = 80, offset = 68, type = 'void *'
found cstr a.out: block = 0x100114490, size = 96, offset = 85, type = '__NSCFString *'
  (__NSCFString *) 0x100114490 /Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out

found cstr a.out: block = 0x100114530, size = 112, offset = 97, type = '__NSCFString *'
  (__NSCFString *) 0x100114530 Hello from '/Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out'

found cstr a.out: block = 0x100114e40, size = 32, offset = 17, type = '__NSCFString *'
  (__NSCFString *) 0x100114e40 a.out.dSYM

found cstr a.out: block = 0x100114fa0, size = 32, offset = 17, type = '__NSCFString *'
  (__NSCFString *) 0x100114fa0 a.out

found cstr a.out: block = 0x100300780, size = 160, offset = 128, type = '__NSCFData *'
  (__NSCFData *) 0x100300780 <48656c6c 6f206672 6f6d2027 2f566f6c 756d6573 2f776f72 6b2f6763 6c617974 6f6e2f44 6f63756d 656e7473 2f737263 2f6c6c64 622f7465 73742f6c 616e672f 6f626a63 2f666f75 6e646174 696f6e2f 612e6f75 742700>

found cstr a.out: block = 0x100301a60, size = 112, offset = 97, type = '__NSCFString *'
  (__NSCFString *) 0x100301a60 Hello from '/Volumes/work/gclayton/Documents/src/lldb/test/lang/objc/foundation/a.out'

found cstr a.out: block = 0x100821000, size = 4096, offset = 100, type = 'void *'

llvm-svn: 154519
2012-04-11 18:30:53 +00:00
Greg Clayton 885294808a Get rid of absolute path in "process load" command.
llvm-svn: 154506
2012-04-11 17:04:00 +00:00
Greg Clayton 804de01c33 Added a new "heap.py" module that adds a new command line command that can find values on the heap and print out the dynamic type of the malloc block that contains the data. I will be modifying this a bit more to tweak the output and make the output more useful.
llvm-svn: 154504
2012-04-11 16:27:06 +00:00
Greg Clayton 470dfcbc42 Added more documentation in the header file to explain how to use the results that are found by the function calls to find_pointer_in_heap().
llvm-svn: 154435
2012-04-10 20:59:36 +00:00
Greg Clayton b10973af64 Fixed head_find to compile again.
llvm-svn: 154419
2012-04-10 18:19:20 +00:00
Enrico Granata cb50d341aa Fixing a problem where some uninitialized cases of vectors could cause diagnostic output from the synthetic children providers - this time the fix should work
llvm-svn: 154361
2012-04-10 00:11:03 +00:00
Sean Callanan 1106434be3 The remaining time calculation didn't reflect the
--start argument.  Fixed that.

llvm-svn: 154221
2012-04-06 23:00:31 +00:00
Sean Callanan afc7b13e56 Removed a call to truncate() which slowed down
the stress test by a LOT.

llvm-svn: 154208
2012-04-06 21:04:20 +00:00
Sean Callanan ceabd2d712 Updated the disassembler stress tester with two
new features:

(1) it outputs the instruction currently being
    tested to a log file, if a path is provided

(2) if instructed, it prints the time remaining
    in the exhaustive test

llvm-svn: 154205
2012-04-06 20:53:23 +00:00
Sean Callanan d181730aa5 Added a stress-tester for LLDB's disassembler.
Right now it only works on Mac OS X, but other
platforms would just need to add their own
implementation of AddLLDBToSysPathOn*().

The stress-tester has two modes:

Used with --bytes N --random, the stress-tester
generates random instructions of length N and
runs them through the disassembler.  This is
suitable for architectures like Intel where it
is combinatorially infeasible to run through the
entire space of possible instructions.

Used with --bytes N and no arguments (or --start
S --stride T), the stress-tester tests the
disassembler with a monotonically increasing
sequence of instructions.

The --start and --stride arguments are intended
for use in multiprocessing environments.  Give
each core an ID from 0 .. T-1, pass the ID in as
the --start, and use T as the stride, and you
can launch one copy of the stress-tester on each
core you have available.

llvm-svn: 154143
2012-04-06 00:04:36 +00:00
Greg Clayton 3c2c4bb2ce Added a platform agnostic symbolication python module that can be used by any targets. Then modified the darwin "crashlog.py" to use this agnostic info and the new functionality and classes.
llvm-svn: 153969
2012-04-03 21:35:43 +00:00
Enrico Granata 51e318737a One last syntax error fix
llvm-svn: 153911
2012-04-02 23:49:34 +00:00
Enrico Granata a20e863875 Fixing syntax typos in Python formatters
llvm-svn: 153910
2012-04-02 23:43:22 +00:00
Greg Clayton 675a856e07 Remove unused file as this file is deprecated (use ./crashlog.py instead).
llvm-svn: 153907
2012-04-02 22:57:32 +00:00
Enrico Granata 98bcde4264 Removing some instances of str(SBValue)
llvm-svn: 153899
2012-04-02 21:37:02 +00:00
Enrico Granata 247bd419ce Logging for data formatters.
llvm-svn: 153878
2012-04-02 16:39:29 +00:00
Enrico Granata 79c1baf6dd Making sure the count on synthetic providers is always setup - This should prevent errors about count being undefined from showing up
llvm-svn: 153791
2012-03-31 00:15:24 +00:00
Enrico Granata 22fe3171ee Added some logging to STL synthetic children providers - this should help us catch problems; more logging might/will be added as needed
llvm-svn: 153750
2012-03-30 16:07:08 +00:00
Enrico Granata a7daeebbff Fixing a whole class of crashers and potential crashers related to data formatters eating up all the stack when an unknown class has to be summarized ; this should make the whole Objective-C summaries more stable
llvm-svn: 153712
2012-03-30 00:51:12 +00:00
Enrico Granata d50f18b1a0 Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow


synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions

to set the cap to a different value:

(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)

you can optionally disable the loop detection algorithm for lists

(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False

llvm-svn: 153676
2012-03-29 19:29:45 +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
Enrico Granata 86ea8d821a Fixing an issue where Unicode characters in an NSString were printed as escape sequences by the summary provider shipping with LLDB - Added relevant test case code. Bonus points for identifying the source of the quotes :-)
llvm-svn: 153624
2012-03-29 01:34:34 +00:00
Enrico Granata f981060503 Adding missing file
llvm-svn: 153559
2012-03-28 02:16:50 +00:00
Enrico Granata bf70ee97b1 adding a summary for Objective-C type 'Class'
llvm-svn: 153541
2012-03-27 21:49:20 +00:00
Enrico Granata c5bc412cf6 Synthetic values are now automatically enabled and active by default. SBValue is set up to always wrap a synthetic value when one is available.
A new setting enable-synthetic-value is provided on the target to disable this behavior.
There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic.
The test suite has been changed accordingly.
Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang
Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching

llvm-svn: 153495
2012-03-27 02:35:13 +00:00
Greg Clayton 18eca8a0bd Fixed up the command so that it doesn't dump the first arguments when run from the command line which was causing this script to dump the script itself.
llvm-svn: 153294
2012-03-23 00:01:02 +00:00
Greg Clayton 0f729e9b38 Added python script that implements a "parse_log_file" command in LLDB which can
parse the output from "log enable --timestamp ...." and converts it to be relative
to the first timestamp and shows the time deltas between log lines. This can also
be used as a stand along script outside of lldb:

./delta.py log.txt

llvm-svn: 153288
2012-03-22 23:08:07 +00:00
Greg Clayton 2b1bc868a0 Added a fix to the crash log script that allows you to locate and load a binary from any location and _then_ do the symbolication. Something like:
(lldb) file /path/to/file.so
(lldb) crashlog crash.log
....

Then if the file.so has already been loaded it will use the one that is already in LLDB without trying to match up the paths.

llvm-svn: 153075
2012-03-20 01:30:27 +00:00
Enrico Granata 86cc982974 Massive enumeration name changes: a number of enums in ValueObject were not following the naming pattern
Changes to synthetic children:
 - the update(self): function can now (optionally) return a value - if it returns boolean value True, ValueObjectSyntheticFilter will not clear its caches across stop-points
   this should allow better performance for Python-based synthetic children when one can be sure that the child ValueObjects have not changed
 - making a difference between a synthetic VO and a VO with a synthetic value: now a ValueObjectSyntheticFilter will not return itself as its own synthetic value, but will (correctly)
   claim to itself be synthetic
 - cleared up the internal synthetic children architecture to make a more consistent use of pointers and references instead of shared pointers when possible
 - major cleanup of unnecessary #include, data and functions in ValueObjectSyntheticFilter itself
 - removed the SyntheticValueType enum and replaced it with a plain boolean (to which it was equivalent in the first place)
Some clean ups to the summary generation code
Centralized the code that clears out user-visible strings and data in ValueObject
More efficient summaries for libc++ containers

llvm-svn: 153061
2012-03-19 22:58:49 +00:00
Enrico Granata ab8674f99f Adding a new example of synthetic children provider
llvm-svn: 152970
2012-03-17 02:02:03 +00:00
Enrico Granata 676d3b0682 Warn about an example script being obsoleted by new native features and just an example
llvm-svn: 152890
2012-03-16 01:25:01 +00:00
Enrico Granata 797017a4c1 Deleting obsolete files
llvm-svn: 152888
2012-03-16 01:15:31 +00:00
Enrico Granata 3f1052b7cf The Cocoa formatters now provide error messages for many of the common things-went-wrong situations. Previously they would say nothing or log failures to the Python console
llvm-svn: 152673
2012-03-13 21:52:00 +00:00
Enrico Granata 8c69c96dc9 Changed several of the Cocoa formatters to match the output style that Xcode uses internally to provide summaries
This has been done for those summaries where the difference is only cosmetic (e.g. naming things as items instead of values, ...)
The LLDB output style has been preserved when it provides more information (e.g. telling the type as well as the value of an NSNumber)

Test cases have been updated to reflect the updated output style where necessary

llvm-svn: 152592
2012-03-13 00:25:59 +00:00
Enrico Granata c7f873064b Added formatters for libc++ (http://libcxx.llvm.org):
std::string has a summary provider
 std::vector std::list and std::map have both a summary and a synthetic children provider
Given the usage of a custom namespace (std::__1::classname) for the implementation of libc++, we keep both libstdcpp and libc++ formatters enabled at the same time since that raises no conflicts and enabled for seamless transition between the two
The formatters for libc++ reside in a libcxx category, and are loaded from libcxx.py (to be found in examples/synthetic)

The formatters-stl test cases have been divided to be separate for libcxx and libstdcpp. This separation is necessary because
 (a) we need different compiler flags for libc++ than for libstdcpp
 (b) libc++ inlines a lot more than libstdcpp and some code changes were required to accommodate this difference

llvm-svn: 152570
2012-03-12 19:47:17 +00:00
Enrico Granata 332b0b9a2f Fixing a problem with the NSSet summary provider; plus, providing a further optimization to the whole Cocoa formatters infrastructure
llvm-svn: 152423
2012-03-09 19:04:53 +00:00
Enrico Granata 9d60f60760 Changed ValueObject to use a dedicated ChildrenManager class to store its children, instead of an std::vector
This solves an issue where a ValueObject was getting a wrong children count (usually, a huge value) and trying to resize the vector of children to fit that many ValueObject*

Added a loop detection algorithm to the synthetic children provider for std::list

Added a few more checks to the synthetic children provider for std::vector

Both std::list and std::vector's synthetic children providers now cache the count of children instead of recomputing it every time
std::map has a field that stores the count, so there is little need to cache it on our side

llvm-svn: 152371
2012-03-09 03:09:58 +00:00
Enrico Granata eb55ad4ad7 the formatter for NSNotification was not being initialized correctly
llvm-svn: 152358
2012-03-09 00:45:19 +00:00
Enrico Granata eb06e25242 Fixing some of the new Python formatters to report '1 object' instead of '1 objects'
llvm-svn: 152186
2012-03-07 00:56:09 +00:00
Enrico Granata cfdafa37b4 Several performance-oriented changes to the introspecting data formatters:
(a) the SystemParameters object is now passed around to the formatters; doing so enables the formatters to reuse computed values for things such as pointer-size and endianness
     instead of repeatedly computing these on their own
 (b) replacing the global ISA cache with a per-process one
 (c) providing a per-process types cache where each formatter can store the types it needs to operate, and be sure to find them the next time without recalculating them
     this also enables formatters to share types if they agree on a local naming convention
 (d) lazy fetching of data from Objective-C runtime data structures
     data is fetched as needed and we stop reading as soon as we determine that an ISA is actually garbage

llvm-svn: 152052
2012-03-05 19:56:33 +00:00
Enrico Granata 385ad4e401 added a new formatter for CF(Mutable)BitVector
fixed a few potential NULL-pointer derefs in ValueObject
we have a way to provide docstrings for properties we add to the SWIG layer - a few of these properties have a docstring already, more will come in future commits
added a new bunch of properties to SBData to make it more natural and Python-like to access the data they contain

llvm-svn: 151962
2012-03-03 00:45:57 +00:00
Enrico Granata cdf38a7ffb Removing a spurious print statement leftover from debugging the formatter code
llvm-svn: 151928
2012-03-02 18:35:06 +00:00
Enrico Granata 8d5c83f6ef (a) adding formatters for:
NSTimeZone and CFTimeZonRef
 SEL and related types
 CFGregorianDate

llvm-svn: 151866
2012-03-02 00:55:53 +00:00
Enrico Granata 74ec8f9c50 this fixes unicode strings handling in 32-bit mode on Lion
llvm-svn: 151831
2012-03-01 19:48:54 +00:00
Enrico Granata 896cd1d3e6 (a) adding an introspection formatter for NS(Mutable)IndexSet
(b) fixes and improvements to the formatters for NSDate and NSString
(c) adding an introspection formatter for NSCountedSet
(d) making the Objective-C formatters test cases pass on both 64 and 32 bit
    one of the test cases is marked as expected failure on i386 - support needs to be added to the LLDB core for it to pass

llvm-svn: 151826
2012-03-01 19:32:33 +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
Enrico Granata 0c489f58cd 1) solving a bug where, after Jim's fixes to stack frames, synthetic children were not recalculated when necessary, causing them to get out of sync with live data
2) providing an updated list of tagged pointers values for the objc_runtime module - hopefully this one is final
3) changing ValueObject::DumpValueObject to use an Options class instead of providing a bulky list of parameters to pass around
   this change had been laid out previously, but some clients of DumpValueObject() were still using the old prototype and some arguments
   were treated in a special way and passed in directly instead of through the Options class
4) providing new GetSummaryAsCString() and GetValueAsCString() calls in ValueObject that are passed a formatter object and a destination string
   and fill the string by formatting themselves using the formatter argument instead of the default for the current ValueObject
5) removing the option to have formats and summaries stick to a variable for the current stoppoint
   after some debate, we are going with non-sticky: if you say frame variable --format hex foo, the hex format will only be applied to the current command execution and not stick when redisplaying foo
   the other option would be full stickiness, which means that foo would be formatted as hex for its whole lifetime
   we are open to suggestions on what feels "natural" in this regard

llvm-svn: 151801
2012-03-01 04:24:26 +00:00
Enrico Granata 0448d9fe2b Fixing a problem with v1 runtime - plus hopefully finalizing the code to check for tagged pointers
llvm-svn: 151753
2012-02-29 20:46:00 +00:00
Enrico Granata 7bc0ec3aad This commit:
a) adds a Python summary provider for NSDate
 b) changes the initialization for ScriptInterpreter so that we are not passing a bulk of Python-specific function pointers around
 c) provides a new ScriptInterpreterObject class that allows for ref-count safe wrapping of scripting objects on the C++ side
 d) contains much needed performance improvements:
    1) the pointer to the Python function generating a scripted summary is now cached instead of looked up every time
    2) redundant memory reads in the Python ObjC runtime wrapper are eliminated
    3) summaries now use the m_summary_str in ValueObject to store their data instead of passing around ( == copying) an std::string object
 e) contains other minor fixes, such as adding descriptive error messages for some cases of summary generation failure

llvm-svn: 151703
2012-02-29 03:28:49 +00:00
Enrico Granata 21b2236303 Fixing an if condition which was causing issues in detecting the correct runtime version
llvm-svn: 151388
2012-02-24 19:46:04 +00:00
Greg Clayton e72dfb321c <rdar://problem/10103468>
I started work on being able to add symbol files after a debug session
had started with a new "target symfile add" command and quickly ran into
problems with stale Address objects in breakpoint locations that had 
lldb_private::Section pointers into modules that had been removed or 
replaced. This also let to grabbing stale modules from those sections. 
So I needed to thread harded the Address, Section and related objects.

To do this I modified the ModuleChild class to now require a ModuleSP
on initialization so that a weak reference can created. I also changed
all places that were handing out "Section *" to have them hand out SectionSP.
All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild
so all of the find plug-in, static creation function and constructors now
require ModuleSP references instead of Module *. 

Address objects now have weak references to their sections which can
safely go stale when a module gets destructed. 

This checkin doesn't complete the "target symfile add" command, but it
does get us a lot clioser to being able to do such things without a high
risk of crashing or memory corruption.

llvm-svn: 151336
2012-02-24 01:59:29 +00:00
Enrico Granata b8cbe9cb4f fixing a syntax error with objc_runtime.py
llvm-svn: 151304
2012-02-23 23:26:48 +00:00
Enrico Granata eb4a479881 This patch provides a set of formatters for most of the commonly used Cocoa classes.
The formatter for NSString is an improved version of the one previously shipped as an example, the others are new in design and implementation.
A more robust and OO-compliant Objective-C runtime wrapper is provided for runtime versions 1 and 2 on 32 and 64 bit.
The formatters are contained in a category named "AppKit", which is not enabled at startup.

llvm-svn: 151300
2012-02-23 23:10:27 +00:00
Johnny Chen 3715c691b3 Use a sentry object to properly initialize/terminate LLDB.
llvm-svn: 151116
2012-02-22 02:03:13 +00:00
Johnny Chen af9b2f631d Fix comment.
llvm-svn: 151077
2012-02-21 19:13:55 +00:00
Benjamin Kramer 4930dd6841 Revert accidental commit.
llvm-svn: 151074
2012-02-21 19:02:29 +00:00
Benjamin Kramer ff461fcf07 Remove a ton of implicit narrowing conversions for C++11 compatibility.
llvm-svn: 151071
2012-02-21 18:37:14 +00:00
Johnny Chen 216d93a6a7 Fix examples/lookup/main.cpp.
Patch to fix the main.cpp compile error submitted by Dmitry Vyukov <dvyukov@google.com>.
Also add a Makefile, plus some modification to main.cpp.

llvm-svn: 150990
2012-02-20 21:39:21 +00:00
Enrico Granata 5a1bff08dd fixing comment to reflect that currentversion of OSX works with our STL formatters
llvm-svn: 150085
2012-02-08 19:57:18 +00:00
Enrico Granata 4cee9e5247 Fixing issues where synthetic children providers for STL containers std::list and std::map where not doing their job properly
llvm-svn: 149700
2012-02-03 18:11:52 +00:00
Enrico Granata bac45f610d This commit provides a new default summary for Objective-C boolean variables, which shows YES or NO instead of the character value. A new category named objc is added to contain this summary provider. Any future Objective-C related formatters would probably fit here
llvm-svn: 149388
2012-01-31 17:01:51 +00:00
Greg Clayton 0a94b6614a Added a new lldb.SBValue helper module that has two classes:
sbvalue.value (<SBValue>)
sbvalue.variable (<SBValue>)

Initialize both with a lldb.SBValue

sbvalue.value() make all sorts of convenience properties. Type "help(sbvalue.value)" 
in the embedded python interpreter to see what is available.

sbvalue.variable() wraps a lldb.SBValue and allows you to play with your variable just
as you would expect:

pt = sbvalue.variable (lldb.frame.FindVariable("pt"))

print pt.x
print py.y

argv = sbvalue.variable (lldb.frame.FindVariable("argv"))
print argv[0]

Member access and array acccess is all taken care of!

llvm-svn: 149260
2012-01-30 19:32:25 +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
Jim Ingham 87a593687c Proof-reading the python docs.
llvm-svn: 148768
2012-01-24 02:40:42 +00:00
Greg Clayton d879a6305b Added a python FAQ page with detailed examples of how to add python functions
to breakpoints, creating new LLDB commands using python modules and also how
to run scripts from the command line. 

llvm-svn: 148650
2012-01-22 02:55:08 +00:00
Greg Clayton bc48f32d0a Added options to specify how many instructions before and after the frame
PC to disassemble. Users can also specify the frame depth to disassemble to
and also if disassembly should happen for all threads.

llvm-svn: 148627
2012-01-21 05:10:20 +00:00
Greg Clayton 53b43b0798 Use the "shlex" module to parse the command line that was passed down into
python so that single and double quotes and other standard shell like argument
parsing happens as expected before passing stuff along to option parsing.

Also handle exceptions so that we don't accidentally exit lldb if an uncaught
exception occurs.

llvm-svn: 148623
2012-01-21 04:26:24 +00:00
Greg Clayton 5c0f483ec1 Fixed it so the "--help" option works for the crashlog command. Corrected and
filled out the command help and removed unused options.

Updated the command to have a "--load-all" option that will cause the target
that gets created to locate and load all images specified in the Binary Images
section of the crash log to allow for complete program state to be matched
to that of the crash log, not just the images that were in the stack frames
(the default).

llvm-svn: 148605
2012-01-21 00:37:19 +00:00
Greg Clayton 9054bc18dc This file is no longer needed since the command:
(lldb) script import crashlog

will automatically add the "crashlog" command to the command interpreter!

llvm-svn: 148598
2012-01-20 23:12:25 +00:00
Sean Callanan 88685f2865 Fixed a global reference that should have been
a reference to a class variable.

llvm-svn: 148562
2012-01-20 19:27:48 +00:00
Greg Clayton 42a6eb7195 Make the script work again from the command line as long as the PYTHONPATH
environment variable it set to include a path to lldb.py.

Also fixed the case where the executable can't be located and doesn't match
what is installed on the current system. It will still symbolicate the other
frames, and will just show what was originally in the crash log file.

Also removed the --crash-log option so the arguments to the "crashlog"
command are one or more paths to crash logs.

Fixed the script to "auto-install" itself when loaded from the embedded
script interpreter. Now you only need to import the module and the
command is ready for use.

llvm-svn: 148561
2012-01-20 19:25:32 +00:00
Greg Clayton 3d8d3db34e More fixed to verify if a file in the crash log is installed in the current
system and also deal with dsymForUUID being available on the network, locally,
and not at all.

llvm-svn: 148534
2012-01-20 06:12:47 +00:00
Greg Clayton a32bfbeeda Improved the regular expressions to handle "+" characters being at the front
of the identifier name in the binary images section. Improved the regular
expression for the frames.

Added a new file "crashlog.lldb" which can be sourced with "command source"
that will import the module and set itself up to be used as a command.

llvm-svn: 148529
2012-01-20 03:32:35 +00:00
Greg Clayton aa9d02b17c Modified the symbolicate-crash.py so it can be imported into python as a
module (you can't import a module with a '-' in it) and also added a
Symbolcate(...) top level function so it can be imported and used as an
LLDB command.

Then you can import the module and map a "crashlog" command (for darwin
use only currently) to the python function "crashlog.Symbolicate":

(lldb) script import crashlog
(lldb) command script add -f crashlog.Symbolicate crashlog

Then use it to symbolicate:

(lldb) crashlog --crash-log /path/to/foo.crash

The crash log will then get symbolicated and inline frames will be added to
the crash log and the frames will be displayed. The crash log currently will
only try and fetch and setup the target images requires in order to do the
symbolication.

This will need to be iterated upon, but it is getting close to being useful
so I am going to check this in.

llvm-svn: 148528
2012-01-20 03:15:45 +00:00
Greg Clayton 415c72cbfb Add some usage documentation to the top of the source file.
llvm-svn: 148527
2012-01-20 02:10:52 +00:00
Greg Clayton 5d34322811 Added a new tool that can be loaded into a user space darwin application and allows you
to find data on the heap. To use this, make the project and then when stopped in your
lldb debug session:

(lldb) process load /path/to/libheap.dylib
(lldb) find_pointer_in_heap (0x112233000000)

This will grep everything in all active allocation blocks and print and malloc blocks that contain the pointer 0x112233000000.

This can also work for c strings:

(lldb) find_cstring_in_heap ("hello")

llvm-svn: 148523
2012-01-20 01:31:24 +00:00
Greg Clayton d5e4edbfbf More improvements to not follow child processes and improved logging that always shows the process info.
llvm-svn: 148257
2012-01-16 22:21:29 +00:00
Greg Clayton 662125ae93 Added some fixes for the fd interposing dylib:
- don't strip too many frames from the backtrace when logging close backtraces
- cleanup some logging messages

llvm-svn: 148195
2012-01-14 18:18:31 +00:00
Johnny Chen 38ef9a9b94 Fix make errors (define the DYLIB_ONLY make variable).
llvm-svn: 147823
2012-01-10 01:29:35 +00:00