summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorAlexandru Dutu <alexandru.dutu@amd.com>2016-03-17 10:22:39 -0700
committerAlexandru Dutu <alexandru.dutu@amd.com>2016-03-17 10:22:39 -0700
commit75d691060742d59894c147ad1abde4c6c9803346 (patch)
treedcf808270f9d4b3c4f95bb469a4cf2991230f421 /src/sim/syscall_emul.hh
parentc05fa167295864d50d460f0d92dbe0aa91a4f220 (diff)
downloadgem5-75d691060742d59894c147ad1abde4c6c9803346.tar.xz
syscall_emul: add extra debug support for syscalls
Breaks the debug output from system calls into two levels: Base and Verbose. A macro is added specifically for system calls which allows developers to easily add new debug messages in a consistent manner. The macro also contains a field to print thread IDs along with the CPU ID.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 2aa742615..080dcb011 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -74,6 +74,7 @@
#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
+#include "debug/SyscallBase.hh"
#include "debug/SyscallVerbose.hh"
#include "mem/page_table.hh"
#include "sim/byteswap.hh"
@@ -83,6 +84,14 @@
#include "sim/syscallreturn.hh"
#include "sim/system.hh"
+// This wrapper macro helps out with readability a bit. FLAGEXT specifies
+// the verbosity and FMT is the message to be appended to the syscall
+// header information. The syscall header information contains the cpuid
+// and thread id.
+#define DPRINTF_SYSCALL(FLAGEXT, FMT, ...) \
+ DPRINTFS(Syscall##FLAGEXT, tc->getCpuPtr(), "T%d : syscall " FMT, \
+ tc->threadId(), __VA_ARGS__)
+
///
/// System call descriptor.
///
@@ -1100,7 +1109,7 @@ fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
int tgt_fd = process->getSyscallArg(tc, index);
Addr bufPtr = process->getSyscallArg(tc, index);
- DPRINTF(SyscallVerbose, "fstat(%d, ...)\n", tgt_fd);
+ DPRINTF_SYSCALL(Verbose, "fstat(%d, ...)\n", tgt_fd);
int sim_fd = process->getSimFD(tgt_fd);
if (sim_fd < 0)