TraceBuffer simplifies things a bit.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23623 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-01-18 22:17:15 +00:00
parent f1047a1c3e
commit adf78fdae2
1 changed files with 9 additions and 20 deletions

View File

@ -363,14 +363,9 @@ class PreSyscall : public AbstractTraceEntry {
Initialized(); Initialized();
} }
virtual void AddDump(char *buffer, size_t size) virtual void AddDump(TraceOutput& out)
{ {
snprintf(buffer, size, "syscall pre: %s(", out.Print("syscall pre: %s(", get_syscall_name(fSyscall));
get_syscall_name(fSyscall));
size_t bytesPrinted = strlen(buffer);
buffer += bytesPrinted;
size -= bytesPrinted;
if (fParameters != NULL) { if (fParameters != NULL) {
int32 stringIndex = 0; int32 stringIndex = 0;
@ -400,7 +395,7 @@ class PreSyscall : public AbstractTraceEntry {
break; break;
case B_STRING_TYPE: case B_STRING_TYPE:
if (stringIndex < MAX_PARAM_STRINGS) { if (stringIndex < MAX_PARAM_STRINGS) {
snprintf(buffer, size, "%s\"%s\"", out.Print("%s\"%s\"",
(i == 0 ? "" : ", "), (i == 0 ? "" : ", "),
fParameterStrings[stringIndex++]); fParameterStrings[stringIndex++]);
printValue = false; printValue = false;
@ -409,18 +404,12 @@ class PreSyscall : public AbstractTraceEntry {
break; break;
} }
if (printValue) { if (printValue)
snprintf(buffer, size, "%s0x%llx", (i == 0 ? "" : ", "), out.Print("%s0x%llx", (i == 0 ? "" : ", "), value);
value);
}
bytesPrinted = strlen(buffer);
buffer += bytesPrinted;
size -= bytesPrinted;
} }
} }
strlcat(buffer, ")", size); out.Print(")");
} }
private: private:
@ -442,9 +431,9 @@ class PostSyscall : public AbstractTraceEntry {
Initialized(); Initialized();
} }
virtual void AddDump(char *buffer, size_t size) virtual void AddDump(TraceOutput& out)
{ {
snprintf(buffer, size, "syscall post: %s() -> 0x%llx", out.Print("syscall post: %s() -> 0x%llx",
get_syscall_name(fSyscall), fReturnValue); get_syscall_name(fSyscall), fReturnValue);
} }
@ -453,7 +442,7 @@ class PostSyscall : public AbstractTraceEntry {
uint64 fReturnValue; uint64 fReturnValue;
}; };
} // namespace TeamTracing } // namespace SyscallTracing
extern "C" void trace_pre_syscall(uint32 syscallNumber, const void* parameters); extern "C" void trace_pre_syscall(uint32 syscallNumber, const void* parameters);