Skip to content

Commit 70bb817

Browse files
committed
[TRACE] Better trace for popen
1 parent faf7c69 commit 70bb817

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/emu/x64int3.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
202202
tmp = (char*)(R_RDI);
203203
snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)");
204204
perr = 2;
205+
} else if (strstr(s, "popen")==s) {
206+
tmp = (char*)(R_RDI);
207+
char* tmp2 = (char*)(R_RSI);
208+
snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)", (tmp2)?tmp2:"nil");
209+
perr = 5;
205210
} else if (!strcmp(s, "read") || !strcmp(s, "my_read")) {
206211
snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, %zu)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, R_RDX);
207212
pu8 = (uint8_t*)R_RSI;
@@ -429,6 +434,8 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr)
429434
snprintf(buff3, 64, " (errno=%d:\"%s\")", e, strerror(e));
430435
else if(perr==4)
431436
snprintf(buff3, 64, " (errno=%d:\"%s\")", e, strerror(e));
437+
else if(perr==5 && R_RAX==0)
438+
snprintf(buff3, 64, " (errno=%d:\"%s\")", e, strerror(e));
432439

433440
if(BOX64ENV(rolling_log))
434441
snprintf(buffret, 127, "0x%lX%s%s", R_RAX, buff2, buff3);

0 commit comments

Comments
 (0)