[Lldb-commits] [lldb] r148527 - /lldb/trunk/examples/darwin/heap_find/heap_find.c

Greg Clayton gclayton at apple.com
Thu Jan 19 18:10:53 PST 2012


Author: gclayton
Date: Thu Jan 19 20:10:52 2012
New Revision: 148527

URL: http://llvm.org/viewvc/llvm-project?rev=148527&view=rev
Log:
Add some usage documentation to the top of the source file.


Modified:
    lldb/trunk/examples/darwin/heap_find/heap_find.c

Modified: lldb/trunk/examples/darwin/heap_find/heap_find.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap_find.c?rev=148527&r1=148526&r2=148527&view=diff
==============================================================================
--- lldb/trunk/examples/darwin/heap_find/heap_find.c (original)
+++ lldb/trunk/examples/darwin/heap_find/heap_find.c Thu Jan 19 20:10:52 2012
@@ -1,3 +1,36 @@
+//===-- head_find.c ---------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file compiles into a dylib and can be used on darwin to find data that
+// is contained in active malloc blocks. To use this make the project, then
+// load the shared library in a debug session while you are stopped:
+//
+// (lldb) process load /path/to/libheap.dylib
+//
+// Now you can use the "find_pointer_in_heap" and "find_cstring_in_heap" 
+// functions in the expression parser.
+//
+// This will grep everything in all active allocation blocks and print and 
+// malloc blocks that contain the pointer 0x112233000000:
+//
+// (lldb) expression find_pointer_in_heap (0x112233000000)
+//
+// This will grep everything in all active allocation blocks and print and 
+// malloc blocks that contain the C string "hello" (as a substring, no
+// NULL termination included):
+//
+// (lldb) expression find_cstring_in_heap ("hello")
+//
+// The results will be printed to the STDOUT of the inferior program.
+//
+//===----------------------------------------------------------------------===//
+
 #include <assert.h>
 #include <ctype.h>
 #include <mach/mach.h>





More information about the lldb-commits mailing list