summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2015-05-05 09:25:59 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2015-05-05 09:25:59 -0700
commitc65fa3dceb2163967bbb7199013e9fccdc6ff46c (patch)
treef31fe624e5923d05433fae473512eba6fb39e061 /src/sim/syscall_emul.cc
parent40e180ecbe2e8201c9a0bc9b6676c9f030e95fdd (diff)
downloadgem5-c65fa3dceb2163967bbb7199013e9fccdc6ff46c.tar.xz
syscall_emul: fix warn_once behavior
The current ignoreWarnOnceFunc doesn't really work as expected, since it will only generate one warning total, for whichever "warn-once" syscall is invoked first. This patch fixes that behavior by keeping a "warned" flag in the SyscallDesc object, allowing suitably flagged syscalls to warn exactly once per syscall.
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 8f3d08cd7..b1d3edde4 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -99,20 +99,18 @@ ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
int index = 0;
- warn("ignoring syscall %s(%d, ...)", desc->name,
- process->getSyscallArg(tc, index));
+ const char *extra_text = "";
- return 0;
-}
+ if (desc->warnOnce()) {
+ if (desc->warned)
+ return 0;
+ desc->warned = true;
+ extra_text = "\n (further warnings will be suppressed)";
+ }
-SyscallReturn
-ignoreWarnOnceFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
- ThreadContext *tc)
-{
- int index = 0;
- warn_once("ignoring syscall %s(%d, ...)", desc->name,
- process->getSyscallArg(tc, index));
+ warn("ignoring syscall %s(%d, ...)%s", desc->name,
+ process->getSyscallArg(tc, index), extra_text);
return 0;
}