Skip to content

Commit

Permalink
Ignore 'this' by checking the name of the variable
Browse files Browse the repository at this point in the history
Fix #179, Missing variables when debugging Android apps

- While getting the list of variables for a method, we were skipping the first slot assuming it was a reference to this.
- Though that is not always the case when testing with Android dex files.
- Instead of assuming `this` is at the first slot, check the name of the variable.
  • Loading branch information
nisargjhaveri committed Mar 29, 2023
1 parent 7a8141c commit 00fa7dc
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,7 @@ public List<LocalVariable> variables() throws AbsentInformationException {
int slot = readInt("slot", replyData); //$NON-NLS-1$
boolean isArgument = slot < fArgumentSlotsCount;

// Note that for instance methods, the first slot contains the
// this reference.
if (isStatic() || slot > 0) {
if (!name.equals("this")) { //$NON-NLS-1$
LocalVariableImpl localVar = new LocalVariableImpl(
virtualMachineImpl(), this, codeIndex, name,
signature, genericSignature, length, slot,
Expand Down

0 comments on commit 00fa7dc

Please sign in to comment.