History log of /external/lldb/examples/darwin/heap_find/heap.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5b578232a39b8c64c39426ad57b7014ff9ace41b 03-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13416800>

ptr_refs command frequently doesn't work when run in large applicaton. This was due to the default timeout of 500ms. The timeouts have now been increased and all expression evaluations have been modified.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
3801be785a607162d3dda0744a7d915bda4c13a3 22-Feb-2013 Enrico Granata <egranata@apple.com> Using __package__ and __name__ seems redundant - __name__ should always contain the fully qualified module name

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
ad72e52945ee0560fc2b22dce0087d4c7274a218 01-Feb-2013 Greg Clayton <gclayton@apple.com> Allow the target to give out the size of the red zone for given ABIs.

A bit of cleanup in the heap module.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
549294a273c684afbc3227a02119bbbce79fd810 31-Jan-2013 Greg Clayton <gclayton@apple.com> Added the ability to search segments for data. Currently __TEXT, __LINKEDIT and __PAGEZERO are excluded.

Added many more cleanups to the output.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
849acc83774509a8b67d8a7867b1a8dfc7548e08 30-Jan-2013 Greg Clayton <gclayton@apple.com> expressions + C++11 lambdas == cooooool!!!

C++11 lambdas that don't capture anything can be used as static callback functions!

Heavily modified this python module to be able to not require a dylib in order to traverse the heap allocations.

Re-implemented the ptr_refs, objc_refs, malloc_info and cstr_refs to use complex expressions that use lambdas to do all static callback function work.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
130a3127926fe704f9d5e0552e873505c6c10313 09-Oct-2012 Greg Clayton <gclayton@apple.com> Checking in fixes that I used to track down a leaking module. The heap module can now search the vm regions with the --vm-regions options to any of the heap functions. This is currently slow and often will time out when run on a large program since our user expression timeout is set to 500000 usec. We need to add an API to LLDB where we can specify the timeout for an expression.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
a936c6e5b2fa2e63939e6cfcd5cf05c6733ae0c0 12-Sep-2012 Greg Clayton <gclayton@apple.com> Don't allow an extra entry to slip into the heap results and also add a better output format

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
393fc5fe35fd511cc65540f678c6d154126914fd 11-Sep-2012 Greg Clayton <gclayton@apple.com> Added "heap" command to get info on all allocations on the heap. Currently only objective C objects are supported since they are easy to detect.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
a48bf37e2ab68c10a3089f5400876987b633ae45 10-Sep-2012 Greg Clayton <gclayton@apple.com> Playing around with "objc_refs" over the weekend and improved it to work on a large ObjC program without running into expression timeouts. Now we get a full list of ObjC classes using a runtime function and then qsort the result. Also added code that can count all instances of each ObjC on the heap and also the total byte sizes for the object allocations.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
aaf7fad2bb839010596e6d8e673e9635f4ddf372 04-Sep-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
85df60cecb0d0d2d223ef613f998dc2a9ff1b3e7 01-Sep-2012 Greg Clayton <gclayton@apple.com> <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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
ab20f29e71457e73c2542b763c1ff2d529d21399 11-Aug-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@161724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
4c5c429b0cd53a4df9f0fab3482e73aa71fc5b91 12-Jul-2012 Greg Clayton <gclayton@apple.com> Added the ability to search through sections for pointer data.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
0d0f56d5b81afb0f3d2e71c53947658a4c667f35 07-Jul-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
0cae063a8664f8594a4e02d64f494ae6274fdddf 27-Jun-2012 Greg Clayton <gclayton@apple.com> Check the return status of the make command.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@159284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
07f258fddcb98c7d07f3f24a4fcd83c00ce9213b 11-May-2012 Greg Clayton <gclayton@apple.com> Remove comments and an extra print statement.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
bf4796585224db7256f5c0df8bab22b304f4615e 11-May-2012 Greg Clayton <gclayton@apple.com> More fixes to "malloc_history".



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
6f446f30e47824cabecc22ee3ec68b9450e39c4c 11-May-2012 Greg Clayton <gclayton@apple.com> "--stack-history" now works if you have MallocStackLogggingNoCompact defined in your app's environment.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
7a24576ff8141db67c52d999c14e474f5bd59f52 11-May-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@156584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
3e33979e334269aecf6757e2617629e5597ca0c3 25-Apr-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
1dae6f39248e38ac84fc20c8b4c26e11bfcc19b7 25-Apr-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
6f2f0ab38426bdb5ed347f057ba57248667a40c3 25-Apr-2012 Greg Clayton <gclayton@apple.com> Now that we have an LLDB package, make the "lldb.macosx.crashlog" module work with all of the new module paths.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
9098fee45dc61264a9fe54d075751e76f7de610f 21-Apr-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
93e5ba5ec34531a68b2d3bc82c3bcb2aa8d22032 13-Apr-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
f5902cb7d5d29e72e5aba0932dda299d7aaed570 12-Apr-2012 Greg Clayton <gclayton@apple.com> Fixed some expression issues after switching to void * args.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
bff78410b94d0b52956e3c6f2966b25a9b799366 12-Apr-2012 Greg Clayton <gclayton@apple.com> 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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
9666644d2b0da00eb0792f4de6f5b3cb98ac5fa0 11-Apr-2012 Greg Clayton <gclayton@apple.com> 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 *'







git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
466ea1f44f1301ed338a154ce3d7e52197f22bff 11-Apr-2012 Greg Clayton <gclayton@apple.com> Get rid of absolute path in "process load" command.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py
e93e24fb12f05cf363bc99e9c792c28cacace0c3 11-Apr-2012 Greg Clayton <gclayton@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/examples/darwin/heap_find/heap.py