@@ -341,7 +341,7 @@ VOID CpuidCalled(const CONTEXT* ctxt)
341341 }
342342}
343343
344- VOID LogSyscallsArgs (const CONTEXT* ctxt, SYSCALL_STANDARD std, const ADDRINT Address, uint32_t argCount)
344+ VOID LogSyscallsArgs (const CHAR* name, const CONTEXT* ctxt, SYSCALL_STANDARD std, const ADDRINT Address, uint32_t argCount)
345345{
346346 const size_t args_max = 10 ;
347347 VOID* syscall_args[args_max] = { 0 };
@@ -351,7 +351,7 @@ VOID LogSyscallsArgs(const CONTEXT* ctxt, SYSCALL_STANDARD std, const ADDRINT Ad
351351 syscall_args[i] = reinterpret_cast <VOID*>(PIN_GetSyscallArgument (ctxt, std, i));
352352 }
353353 _LogFunctionArgs (Address,
354- " SYSCALL " , argCount,
354+ name , argCount,
355355 syscall_args[0 ],
356356 syscall_args[1 ],
357357 syscall_args[2 ],
@@ -364,6 +364,13 @@ VOID LogSyscallsArgs(const CONTEXT* ctxt, SYSCALL_STANDARD std, const ADDRINT Ad
364364 syscall_args[9 ]);
365365}
366366
367+ std::string formatSyscallName (int syscallID)
368+ {
369+ std::stringstream ss;
370+ ss << " SYSCALL:0x" << std::hex << (syscallID);
371+ return ss.str ();
372+ }
373+
367374VOID SyscallCalled (THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v)
368375{
369376 PinLocker locker;
@@ -416,7 +423,7 @@ VOID SyscallCalled(THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v)
416423 // check if it is watched by the syscall number:
417424 const auto & it = m_Settings.funcWatch .syscalls .find (syscallNum);
418425 if (it != m_Settings.funcWatch .syscalls .end ()) {
419- LogSyscallsArgs (ctxt, std, address, it->second .paramCount );
426+ LogSyscallsArgs (formatSyscallName (syscallNum). c_str (), ctxt, std, address, it->second .paramCount );
420427 isSyscallWatched = true ;
421428 }
422429
@@ -429,7 +436,7 @@ VOID SyscallCalled(THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v)
429436 {
430437 std::string funcName = SyscallsTable::convertNameToNt (m_Settings.funcWatch .funcs [i].funcName );
431438 if (syscallFuncName == funcName) {
432- LogSyscallsArgs (ctxt, std, address, m_Settings.funcWatch .funcs [i].paramCount );
439+ LogSyscallsArgs (funcName. c_str (), ctxt, std, address, m_Settings.funcWatch .funcs [i].paramCount );
433440 isSyscallWatched = true ;
434441 break ;
435442 }
@@ -555,6 +562,7 @@ VOID _LogFunctionArgs(const ADDRINT Address, const CHAR *name, uint32_t argCount
555562 const size_t argsMax = 10 ;
556563 VOID* args[argsMax] = { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 };
557564 std::wstringstream ss;
565+ ss << name << " :\n " ;
558566 for (size_t i = 0 ; i < argCount && i < argsMax; i++) {
559567 ss << " \t Arg[" << i << " ] = " ;
560568 ss << paramToStr (args[i]);
0 commit comments