about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-08-15 13:59:18 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-08-15 13:59:18 +0200
commit7866f116dff8cc83d7b09f681c98722c6cd7c5a8 (patch)
treec308061b204729c426f8bada50a3768ac12f2cf4 /src
parent4544e1556a5a826aad39eda39906f3e4a2b2b3ed (diff)
downloadbox64-7866f116dff8cc83d7b09f681c98722c6cd7c5a8.tar.gz
box64-7866f116dff8cc83d7b09f681c98722c6cd7c5a8.zip
[TRACE] Better trace for libc syscall
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64int3.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c
index 14493647..2b907c35 100644
--- a/src/emu/x64int3.c
+++ b/src/emu/x64int3.c
@@ -209,6 +209,9 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
                 } else if (strstr(s, "puts")==s) {
                     tmp = (char*)(R_RDI);
                     snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)");
+                } else if (!strcmp(s, "syscall")) {
+                    snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, %p....)", tid, *(void**)(R_RSP), s, (int)R_EDI, (void*)R_RSI, (void*)R_RDX);
+                    perr = 1;
                 } else if (strstr(s, "strlen")==s) {
                     tmp = (char*)(R_RDI);
                     snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)");
@@ -345,11 +348,11 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
                     }
                     break;
                 }
-                if(perr==1 && ((int)R_EAX)<0)
+                if(perr==1 && (S_EAX)<0)
                     snprintf(buff3, 64, " (errno=%d:\"%s\")", errno, strerror(errno));
                 else if(perr==2 && R_EAX==0)
                     snprintf(buff3, 64, " (errno=%d:\"%s\")", errno, strerror(errno));
-                else if(perr==3 && ((int64_t)R_RAX)==-1)
+                else if(perr==3 && (S_RAX)==-1)
                     snprintf(buff3, 64, " (errno=%d:\"%s\")", errno, strerror(errno));
 
                 if(cycle_log)