mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
add vmfPrintTrace method for dumping traces to a specific stream
This commit is contained in:
parent
83670d1df7
commit
dca75df926
@ -2699,6 +2699,9 @@ popResources(Thread* t);
|
|||||||
JNIEXPORT void
|
JNIEXPORT void
|
||||||
vmPrintTrace(vm::Thread* t);
|
vmPrintTrace(vm::Thread* t);
|
||||||
|
|
||||||
|
JNIEXPORT void
|
||||||
|
vmfPrintTrace(vm::Thread* t, FILE* out);
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5171,11 +5171,11 @@ noop()
|
|||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
JNIEXPORT void
|
JNIEXPORT void
|
||||||
vmPrintTrace(Thread* t)
|
vmfPrintTrace(Thread* t, FILE* out)
|
||||||
{
|
{
|
||||||
class Visitor: public Processor::StackVisitor {
|
class Visitor: public Processor::StackVisitor {
|
||||||
public:
|
public:
|
||||||
Visitor(Thread* t): t(t) { }
|
Visitor(Thread* t, FILE* out): t(t), out(out) { }
|
||||||
|
|
||||||
virtual bool visit(Processor::StackWalker* walker) {
|
virtual bool visit(Processor::StackWalker* walker) {
|
||||||
const int8_t* class_ = &byteArrayBody
|
const int8_t* class_ = &byteArrayBody
|
||||||
@ -5185,30 +5185,37 @@ vmPrintTrace(Thread* t)
|
|||||||
int line = t->m->processor->lineNumber
|
int line = t->m->processor->lineNumber
|
||||||
(t, walker->method(), walker->ip());
|
(t, walker->method(), walker->ip());
|
||||||
|
|
||||||
fprintf(stderr, " at %s.%s ", class_, method);
|
fprintf(out, " at %s.%s ", class_, method);
|
||||||
|
|
||||||
switch (line) {
|
switch (line) {
|
||||||
case NativeLine:
|
case NativeLine:
|
||||||
fprintf(stderr, "(native)\n");
|
fprintf(out, "(native)\n");
|
||||||
break;
|
break;
|
||||||
case UnknownLine:
|
case UnknownLine:
|
||||||
fprintf(stderr, "(unknown line)\n");
|
fprintf(out, "(unknown line)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "(line %d)\n", line);
|
fprintf(out, "(line %d)\n", line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread* t;
|
Thread* t;
|
||||||
} v(t);
|
FILE* out;
|
||||||
|
} v(t, out);
|
||||||
|
|
||||||
fprintf(stderr, "debug trace for thread %p\n", t);
|
fprintf(out, "debug trace for thread %p\n", t);
|
||||||
|
|
||||||
t->m->processor->walkStack(t, &v);
|
t->m->processor->walkStack(t, &v);
|
||||||
|
|
||||||
fflush(stderr);
|
fflush(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void
|
||||||
|
vmPrintTrace(Thread* t)
|
||||||
|
{
|
||||||
|
vmfPrintTrace(t, stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// also for debugging
|
// also for debugging
|
||||||
|
Loading…
Reference in New Issue
Block a user