summaryrefslogtreecommitdiffstats
path: root/vm/jdwp
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2009-12-04 16:36:08 -0800
committerAndy McFadden <fadden@android.com>2009-12-11 16:44:56 -0800
commitc6e64ea32a7732e98975e37c5f8545c652a41ac8 (patch)
tree98d48a2abcf0118aed91e1a1a912577074b12ba6 /vm/jdwp
parentcaf1aaecc1b625b95f52ab62e2029bcf866c7bd3 (diff)
downloadandroid_dalvik-c6e64ea32a7732e98975e37c5f8545c652a41ac8.tar.gz
android_dalvik-c6e64ea32a7732e98975e37c5f8545c652a41ac8.tar.bz2
android_dalvik-c6e64ea32a7732e98975e37c5f8545c652a41ac8.zip
Don't assume debugger wants all exceptions.
The JDWP implementation in the VM keeps a list of the objects that the debugger knows about, and prevents the GC from collecting them (which isn't strictly necessary, but it's a whole lot easier than doing it right). Because of the way it's implemented, it actually ended up keeping track of all thrown exceptions, even if the debugger wasn't interested in hearing about them. With this change we now do a "late" registration of the exception object, preventing exception-happy code from filling memory when the debugger is attached.
Diffstat (limited to 'vm/jdwp')
-rw-r--r--vm/jdwp/JdwpEvent.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vm/jdwp/JdwpEvent.c b/vm/jdwp/JdwpEvent.c
index a3ff05ae7..3233463a4 100644
--- a/vm/jdwp/JdwpEvent.c
+++ b/vm/jdwp/JdwpEvent.c
@@ -1026,6 +1026,10 @@ bool dvmJdwpPostVMDeath(JdwpState* state)
* Valid mods:
* Count, ThreadOnly, ClassOnly, ClassMatch, ClassExclude, LocationOnly,
* ExceptionOnly, InstanceOnly
+ *
+ * The "exceptionId" has not been added to the GC-visible object registry,
+ * because there's a pretty good chance that we're not going to send it
+ * up the debugger.
*/
bool dvmJdwpPostException(JdwpState* state, const JdwpLocation* pThrowLoc,
ObjectId exceptionId, RefTypeId exceptionClassId,
@@ -1100,6 +1104,9 @@ bool dvmJdwpPostException(JdwpState* state, const JdwpLocation* pThrowLoc,
expandBufAdd8BE(pReq, exceptionId);
dvmJdwpAddLocation(pReq, pCatchLoc);
}
+
+ /* don't let the GC discard it */
+ dvmDbgRegisterObjectId(exceptionId);
}
cleanupMatchList(state, matchList, matchCount);