Add support for native (JNI) calls to the trace tools.
Also fix a bug in profile_pid.cpp and add better output to
stack_dump.cpp.
diff --git a/emulator/qtools/read_method.cpp b/emulator/qtools/read_method.cpp
index 48be25a..6aa0c1a 100644
--- a/emulator/qtools/read_method.cpp
+++ b/emulator/qtools/read_method.cpp
@@ -13,11 +13,13 @@
uint64_t time;
uint32_t addr;
const char *name;
+ bool isNative;
- frame(uint64_t time, uint32_t addr, const char *name) {
+ frame(uint64_t time, uint32_t addr, const char *name, bool isNative) {
this->time = time;
this->addr = addr;
this->name = name;
+ this->isNative = isNative;
}
};
@@ -57,8 +59,9 @@
for (int ii = 0; ii < top; ii++) {
pframe = frames[ii];
- printf(" %d: %llu 0x%x %s\n",
- ii, pframe->time, pframe->addr,
+ const char *native = pframe->isNative ? "n" : " ";
+ printf(" %s %d: %llu 0x%x %s\n",
+ native, ii, pframe->time, pframe->addr,
pframe->name == NULL ? "" : pframe->name);
}
}
@@ -118,9 +121,11 @@
stacks[proc->pid] = pStack;
}
- if (method_record.flags == 0) {
+ int flags = method_record.flags;
+ if (flags == kMethodEnter || flags == kNativeEnter) {
pframe = new frame(method_record.time, method_record.addr,
- sym == NULL ? NULL: sym->name);
+ sym == NULL ? NULL: sym->name,
+ method_record.flags == kNativeEnter);
pStack->push(pframe);
} else {
pframe = pStack->pop();