VG_(exit)(1);
}
+/* ---------------------------------------------------------------------
+ VG_(sr_as_string)()
+ ------------------------------------------------------------------ */
+
+/* Return a textual representation of a SysRes value in a statically
+ allocated buffer. The buffer will be overwritten with the next
+ invocation. */
+#if defined(VGO_linux)
+// FIXME: Does this function need to be adjusted for MIPS's _valEx ?
+const HChar *VG_(sr_as_string) ( SysRes sr )
+{
+ static HChar buf[7+1+2+16+1+1]; // large enough
+
+ if (sr_isError(sr))
+ VG_(sprintf)(buf, "Failure(0x%lx)", sr_Err(sr));
+ else
+ VG_(sprintf)(buf, "Success(0x%lx)", sr_Res(sr));
+ return buf;
+}
+
+#elif defined(VGO_darwin)
+
+const HChar *VG_(sr_as_string) ( SysRes sr )
+{
+ static HChar buf[7+1+2+16+1+2+16+1+1]; // large enough
+
+ if (sr_isError(sr))
+ VG_(sprintf)(buf, "Failure(0x%lx)", sr_Err(sr));
+ else
+ VG_(sprintf)(buf, "Success(0x%lx:0x%lx)", sr_ResHI(sr), sr_Res(sr));
+ return buf;
+}
+
+#else
+
+#error unknown OS
+
+#endif
/*--------------------------------------------------------------------*/
/*--- end ---*/
if (sci->flags & SfNoWriteResult) {
PRINT(" --> [pre-success] NoWriteResult");
} else {
- PRINT(" --> [pre-success] Success(0x%llx:0x%llx)",
- (ULong)sr_ResHI(sci->status.sres),
- (ULong)sr_Res(sci->status.sres));
+ PRINT(" --> [pre-success] %s", VG_(sr_as_string)(sci->status.sres));
}
/* In this case the allowable flags are to ask for a signal-poll
and/or a yield after the call. Changing the args isn't
else
if (sci->status.what == SsComplete && sr_isError(sci->status.sres)) {
/* The pre-handler decided to fail syscall itself. */
- PRINT(" --> [pre-fail] Failure(0x%llx)", (ULong)sr_Err(sci->status.sres));
+ PRINT(" --> [pre-fail] %s", VG_(sr_as_string)(sci->status.sres));
/* In this case, the pre-handler is also allowed to ask for the
post-handler to be run anyway. Changing the args is not
allowed. */
/* Be decorative, if required. */
if (VG_(clo_trace_syscalls)) {
- Bool failed = sr_isError(sci->status.sres);
- if (failed) {
- PRINT("SYSCALL[%d,%d](%s) ... [async] --> Failure(0x%llx)",
- VG_(getpid)(), tid, VG_SYSNUM_STRING(sysno),
- (ULong)sr_Err(sci->status.sres));
- } else {
- PRINT("SYSCALL[%d,%d](%s) ... [async] --> "
- "Success(0x%llx:0x%llx)",
- VG_(getpid)(), tid, VG_SYSNUM_STRING(sysno),
- (ULong)sr_ResHI(sci->status.sres),
- (ULong)sr_Res(sci->status.sres) );
- }
+ PRINT("SYSCALL[%d,%d](%s) ... [async] --> %s",
+ VG_(getpid)(), tid, VG_SYSNUM_STRING(sysno),
+ VG_(sr_as_string)(sci->status.sres));
}
} else {
/* Be decorative, if required. */
if (VG_(clo_trace_syscalls)) {
- Bool failed = sr_isError(sci->status.sres);
- if (failed) {
- PRINT("[sync] --> Failure(0x%llx)",
- (ULong)sr_Err(sci->status.sres) );
- } else {
- PRINT("[sync] --> Success(0x%llx:0x%llx)",
- (ULong)sr_ResHI(sci->status.sres),
- (ULong)sr_Res(sci->status.sres) );
- }
+ PRINT("[sync] --> %s", VG_(sr_as_string)(sci->status.sres));
}
}
}