#include <string.h>
#include "trace_file.hpp"
+#include "trace_dump.hpp"
#include "trace_parser.hpp"
int c = read_byte();
switch (c) {
case trace::EVENT_ENTER:
+#if TRACE_VERBOSE
+ std::cerr << "\tENTER\n";
+#endif
parse_enter(mode);
break;
case trace::EVENT_LEAVE:
+#if TRACE_VERBOSE
+ std::cerr << "\tLEAVE\n";
+#endif
call = parse_leave(mode);
- adjust_call_flags(call);
- return call;
+ if (call) {
+ adjust_call_flags(call);
+ return call;
+ }
+ break;
default:
std::cerr << "error: unknown event " << c << "\n";
exit(1);
}
}
if (!call) {
+ /* This might happen on random access, when an asynchronous call is stranded
+ * between two frames. We won't return this call, but we still need to skip
+ * over its data.
+ */
+ const FunctionSig sig = {0, NULL, 0, NULL};
+ call = new Call(&sig, 0, 0);
+ parse_call_details(call, SCAN);
+ delete call;
return NULL;
}
int c = read_byte();
switch (c) {
case trace::CALL_END:
+#if TRACE_VERBOSE
+ std::cerr << "\tCALL_END\n";
+#endif
return true;
case trace::CALL_ARG:
+#if TRACE_VERBOSE
+ std::cerr << "\tCALL_ARG\n";
+#endif
parse_arg(call, mode);
break;
case trace::CALL_RET:
+#if TRACE_VERBOSE
+ std::cerr << "\tCALL_RET\n";
+#endif
call->ret = parse_value(mode);
break;
default:
}
#if TRACE_VERBOSE
if (value) {
- std::cerr << "\tVALUE " << value << "\n";
+ std::cerr << "\tVALUE ";
+ trace::dump(value, std::cerr);
+ std::cerr << "\n";
}
#endif
return value;