about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-04-13 17:25:43 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-04-13 17:25:43 +0200
commit7440be495e08aad8fd9ffb7e264e2bf53ac62a5e (patch)
tree7c27645c29422628bba11cc00d2d667fd2188776 /src
parentfded1a071854adb262422eb184d4f4367ba40f28 (diff)
downloadbox64-7440be495e08aad8fd9ffb7e264e2bf53ac62a5e.tar.gz
box64-7440be495e08aad8fd9ffb7e264e2bf53ac62a5e.zip
Better trace for poll
Diffstat (limited to 'src')
-rwxr-xr-xsrc/emu/x64int3.c4
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrapper.c3
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
5 files changed, 10 insertions, 1 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c
index 952790ea..21d7d10b 100755
--- a/src/emu/x64int3.c
+++ b/src/emu/x64int3.c
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <pthread.h>
 #include <signal.h>
+#include <poll.h>
 
 #include "debug.h"
 #include "box64stack.h"
@@ -114,6 +115,9 @@ void x64Int3(x64emu_t* emu)
                 } else  if(strstr(s, "strcmp")==s) {
                     tmp = (char*)(R_RDI);
                     snprintf(buff, 255, "%04d|%p: Calling %s(\"%s\", \"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)", (char*)R_RSI);
+                } else  if(!strcmp(s, "poll")) {
+                    struct pollfd* pfd = (struct pollfd*)(R_RDI);
+                    snprintf(buff, 255, "%04d|%p: Calling %s(%p[%d/%d/%d, ...], %d, %d)", tid, *(void**)(R_RSP), s, pfd, pfd->fd, pfd->events, pfd->revents, R_ESI, R_EDX);
                 } else  if(strstr(s, "my___printf_chk")) {
                     tmp = (char*)(R_RSI);
                     snprintf(buff, 255, "%04d|%p: Calling %s(%d, \"%s\" (,%p))", tid, *(void**)(R_RSP), s, R_EDI, (tmp)?tmp:"(nil)", (void*)(R_RDX));
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index dae7584d..c9bbb5e3 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -730,6 +730,7 @@
 #() uFppipp
 #() uFpplip
 #() uFppppp
+#() lFipLLi
 #() LFLpppp
 #() LFpLLLp
 #() LFpLppL
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index caba5369..75a12980 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -764,6 +764,7 @@ typedef uint64_t (*uFppiip_t)(void*, void*, int64_t, int64_t, void*);
 typedef uint64_t (*uFppipp_t)(void*, void*, int64_t, void*, void*);
 typedef uint64_t (*uFpplip_t)(void*, void*, intptr_t, int64_t, void*);
 typedef uint64_t (*uFppppp_t)(void*, void*, void*, void*, void*);
+typedef intptr_t (*lFipLLi_t)(int64_t, void*, uintptr_t, uintptr_t, int64_t);
 typedef uintptr_t (*LFLpppp_t)(uintptr_t, void*, void*, void*, void*);
 typedef uintptr_t (*LFpLLLp_t)(void*, uintptr_t, uintptr_t, uintptr_t, void*);
 typedef uintptr_t (*LFpLppL_t)(void*, uintptr_t, void*, void*, uintptr_t);
@@ -1963,6 +1964,7 @@ void uFppiip(x64emu_t *emu, uintptr_t fcn) { uFppiip_t fn = (uFppiip_t)fcn; R_RA
 void uFppipp(x64emu_t *emu, uintptr_t fcn) { uFppipp_t fn = (uFppipp_t)fcn; R_RAX=(uint64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8); }
 void uFpplip(x64emu_t *emu, uintptr_t fcn) { uFpplip_t fn = (uFpplip_t)fcn; R_RAX=(uint64_t)fn((void*)R_RDI, (void*)R_RSI, (intptr_t)R_RDX, (int64_t)R_RCX, (void*)R_R8); }
 void uFppppp(x64emu_t *emu, uintptr_t fcn) { uFppppp_t fn = (uFppppp_t)fcn; R_RAX=(uint64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); }
+void lFipLLi(x64emu_t *emu, uintptr_t fcn) { lFipLLi_t fn = (lFipLLi_t)fcn; R_RAX=(intptr_t)fn((int64_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX, (int64_t)R_R8); }
 void LFLpppp(x64emu_t *emu, uintptr_t fcn) { LFLpppp_t fn = (LFLpppp_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); }
 void LFpLLLp(x64emu_t *emu, uintptr_t fcn) { LFpLLLp_t fn = (LFpLLLp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX, (void*)R_R8); }
 void LFpLppL(x64emu_t *emu, uintptr_t fcn) { LFpLppL_t fn = (LFpLppL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); }
@@ -3069,6 +3071,7 @@ int isSimpleWrapper(wrapper_t fun) {
 	if (fun == &uFppipp) return 1;
 	if (fun == &uFpplip) return 1;
 	if (fun == &uFppppp) return 1;
+	if (fun == &lFipLLi) return 1;
 	if (fun == &LFLpppp) return 1;
 	if (fun == &LFpLLLp) return 1;
 	if (fun == &LFpLppL) return 1;
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 3ac1629c..7b7f1b7e 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -760,6 +760,7 @@ void uFppiip(x64emu_t *emu, uintptr_t fnc);
 void uFppipp(x64emu_t *emu, uintptr_t fnc);
 void uFpplip(x64emu_t *emu, uintptr_t fnc);
 void uFppppp(x64emu_t *emu, uintptr_t fnc);
+void lFipLLi(x64emu_t *emu, uintptr_t fnc);
 void LFLpppp(x64emu_t *emu, uintptr_t fnc);
 void LFpLLLp(x64emu_t *emu, uintptr_t fnc);
 void LFpLppL(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 1a508e66..78efca63 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -1482,7 +1482,7 @@ GO2(__realpath_chk, pFEppv, my_realpath)
 //GOW(re_compile_pattern, 
 GOW(__recv, lFipLi)
 GOW(recv, lFipLi)
-//GO(__recv_chk, 
+GO(__recv_chk, lFipLLi)
 GOW(recvfrom, lFipLipp)
 //GO(__recvfrom_chk, 
 GO(recvmmsg, iFipuip)