ref: cd170777496fbf57ed923f8640437464e286a1e1
parent: ad38f0eb1cce3ea298b4641af13a070e224f9ade
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Feb 12 14:27:08 EST 2014
truss: support for amd64
--- a/sys/lib/acid/syscall
+++ b/sys/lib/acid/syscall
@@ -150,6 +150,8 @@
// return sys call number, address of first argument, location of syscall return value
if objtype == "386" then
return { code(*(*PC-4)), code(*SP+4), code(*AX) };
+ if objtype == "amd64" then
+ return { code(*BP), code(*SP+8), code(*AX) };
if (objtype == "mips") || (objtype == "mips2") then
return { code(*(*PC-4) & 0xffff), code(*SP+4), code(*R1) };
if objtype == "arm" then
@@ -161,6 +163,7 @@
defn trapoffset() {
// return offset from entry point to trap instr
if objtype == "386" then return 5;
+ if objtype == "amd64" then return 12;
if objtype == "mips" then return 8;
if objtype == "mips2" then return 8;
if objtype == "arm" then return 8; // untested
@@ -170,6 +173,7 @@
defn trapreason() {
// return reason for trap
if objtype == "386" then return reason(*TRAP);
+ if objtype == "amd64" then return reason(*TYPE);
if objtype == "mips" then return reason(*CAUSE);
if objtype == "mips2" then return reason(*CAUSE);
if objtype == "arm" then return "unknown trap"; // untested
--- a/sys/lib/acid/truss
+++ b/sys/lib/acid/truss
@@ -198,7 +198,7 @@
}
defn truss() {
- local pc, lst, offset, prevpc, pcspret, ret;
+ local pc, lst, offset, prevpc, pcspret, arg, ret;
offset = trapoffset();
@@ -225,33 +225,34 @@
trussflush();
prevpc = *PC;
step();
+ arg = eval pcspret[1];
ret = eval pcspret[2];
print("\treturn value: ", ret\D, "\n");
if (ret>=0) && (match(prevpc, readPC)>=0) then {
print("\tdata: ");
- printtextordata(*((eval pcspret[1])+4), ret);
+ printtextordata(arg[1], ret);
print("\n");
}
if (ret>=0) && (match(prevpc, fd2pathPC)>=0) then {
- print("\tdata: \"", *(*((eval pcspret[1])+4)\s), "\"\n");
+ print("\tdata: \"", *(arg[1]\s), "\"\n");
}
if (ret>=0) && (match(prevpc, errstrPC)>=0) then {
- print("\tdata: \"", *(*(eval pcspret[1])\s), "\"\n");
+ print("\tdata: \"", *(arg[1]\s), "\"\n");
}
if (ret>=0) && (match(prevpc, awaitPC)>=0) then {
print("\tdata: ");
- printtextordata(*(eval pcspret[1]), ret);
+ printtextordata(arg[0], ret);
print("\n");
}
// compatibility hacks for old kernel:
if (ret>=0) && (match(prevpc, _waitPC)>=0) then {
print("\tdata: ");
- printtextordata(*(eval pcspret[1]), 12+3*12+64);
+ printtextordata(arg[0], 12+3*12+64);
print("\n");
}
if (ret>=0) && (match(prevpc, _errstrPC)>=0) then {
print("\tdata: ");
- printtextordata(*(eval pcspret[1]), 64);
+ printtextordata(arg[0], 64);
print("\n");
}
}