Loading...
--- /dev/null
+++ libmalloc/libmalloc-166.200.60/tools/read-radix-tree
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+# read the radix tree out of a process and write it to stdout
+
+my $proc = shift;
+
+my @vmmap_out = `vmmap -vw -interleaved -noCoalesce $proc`;
+my $pid;
+
+for (@vmmap_out) {
+ if (/^Process:.*\[(\d+)\]\s*$/) {
+ $pid = $1;
+ }
+ if (/^Performance tool data \s*([0-9a-fA-F]+)-([0-9a-fA-F]+)/) {
+ my $addr = $1;
+ my $end = $2;
+ if (`memread $pid 0x$addr 7` eq "radixv2") {
+ exec sprintf("memread $pid 0x$addr 0x%x", hex($end) - hex($addr));
+ }
+ }
+}
+
+printf STDERR "not found\n";
+exit 1;