canonical->arg7 = stack[8];
canonical->arg8 = stack[9];
- PRINT("SYSCALL[%d,?](%s) syscall(%s, ...); please stand by...\n",
+ PRINT("SYSCALL[%d,?](0) syscall(%s, ...); please stand by...\n",
VG_(getpid)(), /*tid,*/
- VG_SYSNUM_STRING(0), VG_SYSNUM_STRING(canonical->sysno));
+ VG_SYSNUM_STRING(canonical->sysno));
}
// Here we determine what kind of syscall it was by looking at the
canonical->arg7 = stack[2];
canonical->arg8 = stack[3];
- PRINT("SYSCALL[%d,?](%s) syscall(%s, ...); please stand by...\n",
+ PRINT("SYSCALL[%d,?](0) syscall(%s, ...); please stand by...\n",
VG_(getpid)(), /*tid,*/
- VG_SYSNUM_STRING(0), VG_SYSNUM_STRING(canonical->sysno));
+ VG_SYSNUM_STRING(canonical->sysno));
}
// no canonical->sysno adjustment needed
/*OUT*/UWord* flags )
{
VG_(dmsg)("WARNING: unhandled syscall: %s\n",
- VG_SYSNUM_STRING_EXTRA(args->sysno));
+ VG_SYSNUM_STRING(args->sysno));
if (VG_(clo_verbosity) > 1) {
VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
}
/*OUT*/UWord* flags )
{
VG_(dmsg)("WARNING: unhandled hypercall: %s\n",
- VG_SYSNUM_STRING_EXTRA(args->sysno));
+ VG_SYSNUM_STRING(args->sysno));
if (VG_(clo_verbosity) > 1) {
VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
}
*/
#include "pub_core_basics.h"
-#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-
#include "pub_core_vkiscnums.h" /* self */
/* We have pub_{core,tool}_vkiscnums.h. This is the matching implementation
#if defined(VGO_linux)
//---------------------------------------------------------------------------
-HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
+const HChar* VG_(sysnum_string)(Word sysnum)
{
- VG_(snprintf)(buf, n_buf, "%3ld", sysnum);
- return buf;
-}
+ static HChar buf[20+1]; // large enough
-HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
-{
- return VG_(sysnum_string)(sysnum, n_buf, buf);
+ VG_(sprintf)(buf, "%ld", sysnum);
+ return buf;
}
//---------------------------------------------------------------------------
#elif defined(VGO_darwin)
//---------------------------------------------------------------------------
-HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
+const HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
{
+ static HChar buf[7+1+20+1]; // large enough
+
const HChar* classname = NULL;
switch (VG_DARWIN_SYSNO_CLASS(sysnum)) {
case VG_DARWIN_SYSCALL_CLASS_MACH: classname = "mach"; break;
case VG_DARWIN_SYSCALL_CLASS_DIAG: classname = "diag"; break;
default: classname = "UNKNOWN"; break;
}
- VG_(snprintf)(buf, n_buf, "%s:%3ld",
- classname, VG_DARWIN_SYSNO_INDEX(sysnum));
+ VG_(sprintf)("%s:%ld", classname, VG_DARWIN_SYSNO_INDEX(sysnum));
return buf;
}
-HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
-{
- return VG_(sysnum_string)(sysnum, n_buf, buf);
-}
-
//---------------------------------------------------------------------------
#else
//---------------------------------------------------------------------------
// This converts a syscall number into a string, suitable for printing. It is
// needed because some platforms (Darwin) munge sysnums in various ways.
-// It is used in places where the sycall name will be printed alongside.
-extern HChar* VG_(sysnum_string) (Word sysnum, SizeT n_buf, HChar* buf);
-
-// This is like VG_(sysnum_string), but prints extra info if needed. It is
-// called in places where the syscall name will *not* be printed alongside.
-extern HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf);
-
-// Macros that make the above functions easier to use by declaring a local
-// buffer.
-#define VG_SYSNUM_STRING(sysnum) \
- ({ HChar qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); })
-#define VG_SYSNUM_STRING_EXTRA(sysnum) \
- ({ HChar qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); })
+// The string is allocated in a static buffer and will be overwritten in the
+// next invocation.
+extern const HChar *VG_(sysnum_string) (Word sysnum);
+
+// Macro provided for backward compatibility purposes.
+#define VG_SYSNUM_STRING(sysnum) VG_(sysnum_string)(sysnum)
#endif // __PUB_TOOL_VKISCNUMS_H