[Lldb-commits] [lldb] r156588 - in /lldb/trunk/examples/darwin/heap_find: heap.py heap/heap_find.cpp
Greg Clayton
gclayton at apple.com
Thu May 10 16:37:52 PDT 2012
Author: gclayton
Date: Thu May 10 18:37:52 2012
New Revision: 156588
URL: http://llvm.org/viewvc/llvm-project?rev=156588&view=rev
Log:
"--stack-history" now works if you have MallocStackLogggingNoCompact defined in your app's environment.
Modified:
lldb/trunk/examples/darwin/heap_find/heap.py
lldb/trunk/examples/darwin/heap_find/heap/heap_find.cpp
Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=156588&r1=156587&r2=156588&view=diff
==============================================================================
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Thu May 10 18:37:52 2012
@@ -84,13 +84,17 @@
type_flag_strings = [ 'free', 'generic', 'alloc', 'dealloc' ];
def dump_stack_history_entry(stack_history_entry, idx):
- if stack_history_entry.addr != 0:
+ address = int(stack_history_entry.address)
+ if address:
+ type_flags = int(stack_history_entry.type_flags)
+ argument = int(stack_history_entry.argument)
symbolicator = lldb.utils.symbolication.Symbolicator()
symbolicator.target = lldb.target
global type_flag_strings
- print 'stack_history_entry[%u]: addr = 0x%x, type=%s, arg=%u, frames=' % (idx, stack_history_entry.address, type_flag_strings[stack_history_entry.type_flags], stack_history_entry.argument)
+ print 'stack_history_entry[%u]: addr = 0x%x, type=%s, arg=%u, frames=' % (idx, address, type_flag_strings[type_flags], argument)
frame_idx = 0
- pc = int(stack_history_entry.frames[frame_idx])
+ idx = 0
+ pc = int(stack_history_entry.frames[idx])
while pc != 0:
if pc >= 0x1000:
frames = symbolicator.symbolicate(pc)
@@ -101,22 +105,24 @@
else:
print '[%3u] 0x%x' % (frame_idx, pc)
frame_idx += 1
- frame_idx = frame_idx + 1
- pc = int(stack_history_entry.frames[frame_idx])
+ idx = idx + 1
+ pc = int(stack_history_entry.frames[idx])
else:
pc = 0
def dump_stack_history_entries(addr):
# malloc_stack_entry *get_stack_history_for_address (const void * addr)
- expr = 'get_stack_history_for_address((void *)%s)' % addr
+ expr = 'get_stack_history_for_address((void *)0x%x)' % (addr)
+ print 'expr = "%s"' % (expr)
expr_sbvalue = lldb.frame.EvaluateExpression (expr)
if expr_sbvalue.error.Success():
if expr_sbvalue.unsigned:
expr_value = lldb.value(expr_sbvalue)
+ #print 'expr_value = ', expr_value
idx = 0;
stack_history_entry = expr_value[idx]
- while stack_history_entry.address:
+ while int(stack_history_entry.address) != 0:
dump_stack_history_entry(stack_history_entry, idx)
idx = idx + 1
stack_history_entry = expr_value[idx]
Modified: lldb/trunk/examples/darwin/heap_find/heap/heap_find.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap/heap_find.cpp?rev=156588&r1=156587&r2=156588&view=diff
==============================================================================
--- lldb/trunk/examples/darwin/heap_find/heap/heap_find.cpp (original)
+++ lldb/trunk/examples/darwin/heap_find/heap/heap_find.cpp Thu May 10 18:37:52 2012
@@ -124,7 +124,7 @@
void *address;
uint64_t argument;
uint32_t type_flags;
- std::vector<mach_vm_address_t> frames;
+ std::vector<uintptr_t> frames;
};
More information about the lldb-commits
mailing list