summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2011-12-01 12:19:54 -0800
committer Elliott Hughes <enh@google.com> 2011-12-01 12:19:54 -0800
commitf8a2df7bbf1021058bc13d1f806a7fec3c89ee62 (patch)
tree4ae8df1e0867c6e127e8ca976d7b52f28ed5b46b /src
parent24437995cdac88b42e42b16d9aa121e833330999 (diff)
Fix a couple of JDWP bugs.
First, dalvikvm's behavior of just carrying on if it failed to set up JDWP was the opposite of helpful. It's wasted loads of my time lately, and I've already benefitted in the half hour since making this a hard stop. Second, I was accidentally reporting upcall frames. I don't know why I wasn't always seeing this -- because we always make an upcall to 'main' -- but it was repeatable if the stack was short enough. Change-Id: Iee14867f596436bed5ca0546db71e62b62d11f41
Diffstat (limited to 'src')
-rw-r--r--src/debugger.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/debugger.cc b/src/debugger.cc
index 7128fdc0a4..37b02aff4f 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -323,8 +323,10 @@ void Dbg::StartJdwp() {
// debugger.
gJdwpState = JDWP::JdwpState::Create(&gJdwpOptions);
if (gJdwpState == NULL) {
- LOG(WARNING) << "debugger thread failed to initialize";
- return;
+ // We probably failed because some other process has the port already, which means that
+ // if we don't abort the user is likely to think they're talking to us when they're actually
+ // talking to that other process.
+ LOG(FATAL) << "debugger thread failed to initialize";
}
// If a debugger has already attached, send the "welcome" message.
@@ -1103,8 +1105,11 @@ int Dbg::GetThreadFrameCount(JDWP::ObjectId threadId) {
ScopedThreadListLock thread_list_lock;
struct CountStackDepthVisitor : public Thread::StackVisitor {
CountStackDepthVisitor() : depth(0) {}
- virtual void VisitFrame(const Frame&, uintptr_t) {
- ++depth;
+ virtual void VisitFrame(const Frame& f, uintptr_t) {
+ // TODO: we'll need to skip callee-save frames too.
+ if (f.HasMethod()) {
+ ++depth;
+ }
}
size_t depth;
};
@@ -1120,8 +1125,9 @@ bool Dbg::GetThreadFrame(JDWP::ObjectId threadId, int desired_frame_number, JDWP
: found(false) ,depth(0), desired_frame_number(desired_frame_number), pFrameId(pFrameId), pLoc(pLoc) {
}
virtual void VisitFrame(const Frame& f, uintptr_t pc) {
+ // TODO: we'll need to skip callee-save frames too.
if (!f.HasMethod()) {
- return; // These don't count?
+ return; // The debugger can't do anything useful with a frame that has no Method*.
}
if (depth == desired_frame_number) {