ref: a83ce26b41be995bcde2b8f6bec6f93522f4f514
parent: f1cc75b5473f938b573b133be43f5d4f368d696f
author: aiju <devnull@localhost>
date: Mon Jun 19 13:22:41 EDT 2017
ktrace(1): handle amd64 stacktraces correctly
--- a/sys/src/cmd/ktrace.c
+++ b/sys/src/cmd/ktrace.c
@@ -370,7 +370,7 @@
{
char buf[256];
int i, n;
- uvlong r;
+ uvlong r, m;
if(interactive){
print("// data at %#8.8llux? ", a);
@@ -379,17 +379,25 @@
return 0;
buf[n] = '\0';
r = strtoull(buf, 0, 16);
+ }else{
+ r = 0;
switch(fhdr.magic){
case S_MAGIC:
- r = (long)r; // sign extend
+ m = 0xffffffff00000000ULL;
break;
+ default:
+ m = 0;
}
- }else{
- r = 0;
for(i=0; i<naddr; i++)
- if(addr[i] == a)
+ if((addr[i]|m) == a)
r = val[i];
}
+ switch(fhdr.magic){
+ case S_MAGIC:
+ r = (long)r; // sign extend
+ break;
+ }
+
return r;
}