libjdwp: fix infinite loop in findNodeByID

aosp/656777 ("Change commonRef to avoid using jweak") introduced a bug
in findNodeByID that causes node->prev's back pointer to incorrectly
point to itself. Moving such a defective node to the front of the linked
list creates a cycle, causing subsequent lookups in the same hash chain
to get into an infinite loop.

Test: "class" command in jdb attached to a large app
Signed-off-by: Tomislav Novak <tnovak@meta.com>
Change-Id: I5303f774e3c691a955d253f350944636e32f03b1
1 file changed