summaryrefslogtreecommitdiff
path: root/schulung_tools/mtrace/mtrace.patch
blob: 874388c8edc0c110f94f31141149462dbcca2fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Patch mtrace to deal with new ASLR issues.
--- a/mtrace	2017-06-15 20:17:14.000000000 +0100
+++ b/mtrace	2017-12-13 12:09:31.584089486 +0000
@@ -75,10 +75,10 @@ if ($#ARGV == 0) {
     } else {
 	$prog = "./$binary";
     }
-    if (open (LOCS, "env LD_TRACE_LOADED_OBJECTS=1 $prog |")) {
+    if (open (LOCS, "env LD_TRACE_PRELINKING=1 $prog |")) {
 	while (<LOCS>) {
 	    chop;
-	    if (/^.*=> (.*) .(0x[0123456789abcdef]*).$/) {
+	    if (/^.*=> (.*) .(0x[0123456789abcdef]*),.*/) {
 		$locs{$1} = $2;
 	    }
 	}
@@ -111,7 +111,7 @@ sub location {
 	my $searchaddr;
 	return $cache{$addr} if (exists $cache{$addr});
 	if ($locs{$prog} ne "") {
-	    $searchaddr = sprintf "%#x", $addr - $locs{$prog};
+	    $searchaddr = sprintf "%#x", hex($addr) - hex($locs{$prog});
 	} else {
 	    $searchaddr = $addr;
 	    $prog = $binary;