From 99bf6ed0849085588c3d51679218c5b53ab4b9c0 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 10 Nov 2005 21:05:31 -0500 Subject: [PATCH] Syscall DPRINTF and warning cleanup. base/trace.hh: Need std:: on DPRINTFR reference to string class. base/traceflags.py: Remove SyscallWarnings trace flag... we should always print warnings so nothing undesirable goes unnoticed. Replaced with (currently unused) Syscall flag. sim/syscall_emul.cc: Change SyscallWarning DPRINTFs into warn() calls. Uncomment SyscallVerbose DPRINTFs. sim/syscall_emul.hh: Change SyscallWarning DPRINTFs into warn() calls. Call fatal() instead of ad-hoc termination. --HG-- extra : convert_revision : dc6c2ce3691a129f697b6a6ae5d889e2dbaab228 --- base/trace.hh | 2 +- base/traceflags.py | 2 +- sim/syscall_emul.cc | 13 +++---------- sim/syscall_emul.hh | 13 ++++++------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/base/trace.hh b/base/trace.hh index 02f1b0de9..5e14f1bff 100644 --- a/base/trace.hh +++ b/base/trace.hh @@ -203,7 +203,7 @@ do { \ #define DPRINTFR(x, args...) \ do { \ if (Trace::IsOn(Trace::x)) \ - __dprintf((Tick)-1, string(), args, cp::ArgListNull()); \ + __dprintf((Tick)-1, std::string(), args, cp::ArgListNull()); \ } while (0) #define DPRINTFN(args...) \ diff --git a/base/traceflags.py b/base/traceflags.py index d44d44681..e814a00fb 100644 --- a/base/traceflags.py +++ b/base/traceflags.py @@ -98,7 +98,7 @@ baseFlags = [ 'Serialize', 'Event', 'PCEvent', - 'SyscallWarnings', + 'Syscall', 'SyscallVerbose', 'DiskImage', 'DiskImageRead', diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc index 5abbdfd74..4ae2d2631 100644 --- a/sim/syscall_emul.cc +++ b/sim/syscall_emul.cc @@ -61,12 +61,7 @@ SyscallReturn unimplementedFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { - cerr << "Error: syscall " << desc->name - << " (#" << callnum << ") unimplemented."; - cerr << " Args: " << xc->getSyscallArg(0) << ", " << xc->getSyscallArg(1) - << ", ..." << endl; - - abort(); + fatal("syscall %s (#%d) unimplemented.", desc->name, callnum); } @@ -74,10 +69,8 @@ SyscallReturn ignoreFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { - DCOUT(SyscallWarnings) << "Warning: ignoring syscall " << desc->name - << "(" << xc->getSyscallArg(0) - << ", " << xc->getSyscallArg(1) - << ", ...)" << endl; + warn("ignoring syscall %s(%d, %d, ...)", desc->name, + xc->getSyscallArg(0), xc->getSyscallArg(1)); return 0; } diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh index d061f868e..17889113e 100644 --- a/sim/syscall_emul.hh +++ b/sim/syscall_emul.hh @@ -272,7 +272,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process, int fd = xc->getSyscallArg(0); unsigned req = xc->getSyscallArg(1); - // DPRINTFR(SyscallVerbose, "ioctl(%d, 0x%x, ...)\n", fd, req); + DPRINTF(SyscallVerbose, "ioctl(%d, 0x%x, ...)\n", fd, req); if (fd < 0 || process->sim_fd(fd) < 0) { // doesn't map to any simulator fd: not a valid target fd @@ -396,7 +396,7 @@ fstatFunc(SyscallDesc *desc, int callnum, Process *process, { int fd = process->sim_fd(xc->getSyscallArg(0)); - // DPRINTFR(SyscallVerbose, "fstat(%d, ...)\n", fd); + DPRINTF(SyscallVerbose, "fstat(%d, ...)\n", fd); if (fd < 0) return -EBADF; @@ -493,8 +493,8 @@ mmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) } if (!(flags & OS::TGT_MAP_ANONYMOUS)) { - DPRINTF(SyscallWarnings, "Warning: allowing mmap of file @ fd %d. " - "This will break if not /dev/zero.", xc->getSyscallArg(4)); + warn("allowing mmap of file @ fd %d. " + "This will break if not /dev/zero.", xc->getSyscallArg(4)); } return start; @@ -555,9 +555,8 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process, if (who != OS::RUSAGE_SELF) { // don't really handle THREAD or CHILDREN, but just warn and // plow ahead - DCOUT(SyscallWarnings) - << "Warning: getrusage() only supports RUSAGE_SELF." - << " Parameter " << who << " ignored." << std::endl; + warn("getrusage() only supports RUSAGE_SELF. Parameter %d ignored.", + who); } getElapsedTime(rup->ru_utime.tv_sec, rup->ru_utime.tv_usec); -- 2.30.2