OSDN Git Service

Fix breakpoint handling on switch statements.
authorAndy McFadden <fadden@android.com>
Mon, 3 May 2010 23:11:20 +0000 (16:11 -0700)
committerAndy McFadden <fadden@android.com>
Mon, 3 May 2010 23:24:01 +0000 (16:24 -0700)
commitda9dc84a1296a11efce0b656cbc87c7112994d0b
tree4b9677f2c4c082e8572e8b377a9e09cc74c656e1
parent02a7882ba97645ca3e2d4490a28a77c1226664a8
Fix breakpoint handling on switch statements.

Some debuggers (Eclipse and IntelliJ, but not jdb) appear to set
breakpoints at all addresses associated with a given bytecode offset.
Because dx emits line number information for the data tables used
by "switch" statements, we end up setting a breakpoint on the start
of the switch data.

In the past this wasn't a problem, but now that we're using "hard"
breakpoints it's causing the magic number at the start of the table
to be overwritten.  An explict test on the magic number is causing
the intepreter to throw an InternalError.

The quick fix is to refuse to stomp on a "magic" NOP.  Assuming the
line number table is otherwise valid and doesn't point into the middle
of a multi-word instruction, this should solve the problem.  (We can
check this during verification.)

Bug 2643148.

Change-Id: I8fe35539508fa4f56a3eecc375acc058cf9568e4
vm/interp/Interp.c