truss: support for amd64
This commit is contained in:
parent
ad38f0eb1c
commit
cd17077749
2 changed files with 12 additions and 7 deletions
|
@ -150,6 +150,8 @@ defn UPCSPRET() {
|
|||
// 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 UPCSPRET() {
|
|||
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 trapoffset() {
|
|||
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
|
||||
|
|
|
@ -198,7 +198,7 @@ defn new() {
|
|||
}
|
||||
|
||||
defn truss() {
|
||||
local pc, lst, offset, prevpc, pcspret, ret;
|
||||
local pc, lst, offset, prevpc, pcspret, arg, ret;
|
||||
|
||||
offset = trapoffset();
|
||||
|
||||
|
@ -225,33 +225,34 @@ defn truss() {
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue