Skip to content

Instantly share code, notes, and snippets.

@doujiang24
Created June 12, 2016 14:59
Show Gist options
  • Select an option

  • Save doujiang24/93f0d1ce30b3312e1b3e5b12d4eb677a to your computer and use it in GitHub Desktop.

Select an option

Save doujiang24/93f0d1ce30b3312e1b3e5b12d4eb677a to your computer and use it in GitHub Desktop.
DWARF-less probing
diff --git a/samples/sample-bt-leaks.sxx b/samples/sample-bt-leaks.sxx
index dba62e7..8dc15a2 100755
--- a/samples/sample-bt-leaks.sxx
+++ b/samples/sample-bt-leaks.sxx
@@ -49,7 +49,7 @@ probe process("$^libc_path").function("malloc").return,
}
}
- ptr = $return
+ ptr = returnval()
if (ptr) {
// here we use a hack specific to glibc's implementation
// to get the size of the memory block because we
@@ -73,10 +73,9 @@ probe process("$^libc_path").function("malloc").return,
probe process("$^libc_path").function("free")
{
- if (pid() == target() && $mem) {
- //printf("free: %p\n", $mem)
- ptr = $mem
-
+ ptr = pointer_arg(1)
+ if (pid() == target() && ptr) {
+ //printf("free: %p\n", mem)
bt = ptr2bt[ptr]
delete ptr2bt[ptr]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment