Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore 'this' by checking the name of the variable #181

Closed
wants to merge 1 commit into from

Conversation

nisargjhaveri
Copy link
Contributor

What it does

Fix #179.
While getting the list of variables for a method, we were skipping the first slot assuming it was a reference to this. Though this 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.

How to test

Tested locally, the issue that was reported earlier no longer occurs.

Author checklist

@nisargjhaveri
Copy link
Contributor Author

@SarikaSinha, @iloveeclipse, Could you please have a look at this? Please let me know if this doesn't make sense or requires more changes.

@SarikaSinha
Copy link
Member

@SarikaSinha, @iloveeclipse, Could you please have a look at this? Please let me know if this doesn't make sense or requires more changes.

I will be able to look at this not before next week.

@SarikaSinha
Copy link
Member

@nisargjhaveri

Can you add some test like :
org.eclipse.debug.jdi.tests.MethodTest.testJDIVariablesByName()
org.eclipse.debug.jdi.tests.MethodTest.testJDIArguments()

@nisargjhaveri
Copy link
Contributor Author

@SarikaSinha, sure, I can add the required tests. Though, what should the new tests cover? The tests you mentioned along with org.eclipse.debug.jdi.tests.MethodTest.testJDIVariables seems to cover most cases I can think of.

@SarikaSinha
Copy link
Member

@SarikaSinha, sure, I can add the required tests. Though, what should the new tests cover? The tests you mentioned along with org.eclipse.debug.jdi.tests.MethodTest.testJDIVariables seems to cover most cases I can think of.

It should cover the case of failure with the old code, which you have stated in the problem. And it should pass after the change ideally.

@nisargjhaveri
Copy link
Contributor Author

Okay, that way.. I believe the issue only repros in with the dex files compiled for Android. How should we go about writing tests for that? We'd need to compile to dex/APK first and then likely run Android Emulator to test?

@SarikaSinha
Copy link
Member

Yes, something like that.
Problem in not adding the test is if someone later changes this logic, it might not work for dex files again.

@nisargjhaveri
Copy link
Contributor Author

Do we have any tests running on Android?

If not, adding the entire infra to run tests on Android would be a fairly complex work, especially for someone like me who's new to the project. While I completely agree with the fact that we should add tests for this, I don't really have enough context in this project yet. I'd be willing to take a look, but would require some more help in figuring out how to go about this.

@SarikaSinha
Copy link
Member

We don't have tests for Android. Is it possible to get the compiled classes from Android and just execute with the scenario?

@nisargjhaveri
Copy link
Contributor Author

I have attempted one POC for running tests on Android in #187. Have a look?

Android SDK provides the tool for compiling to a dex file, which runs on the dalvik vm. The Dalvik VM itself seems to be officially supported only on Android. There seems to be some ports available to run Dalvik directly on a linux machine and such, but could not find anything fully convincing. We can do some more research, if that works, makes the life much simpler.

In any case, if the current PR does not break any existing tests, can we go ahead with it and continue the discussion on the Android tests separately?

@SarikaSinha
Copy link
Member

Will release after 4.27 is complete.

@nisargjhaveri
Copy link
Contributor Author

@SarikaSinha, I believe 4.27 release should be complete now? Can we merge this now to make sure this goes into the next release?

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few formal recommendations for your PR

  1. Please create dedicated branch for your changes and do not commit on master branch directly.
  2. Please don't merge master brsnch into your branch to get latest master state
  3. Please fetch from master and rebase your branch on latest master state
  4. Please provide commit message that explains the fix and refers to original issue Missing variables when debugging Android apps #179

Fix eclipse-jdt#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.
@nisargjhaveri
Copy link
Contributor Author

@iloveeclipse, Thanks for your suggestions.

Yes, I agree having a dedicated branch helps, but changing it now would likely mean I'll have to create a new PR, losing the context. And I believe it would not matter much once merged?

I've taken in the other three recommendations and updated the branch, please have a look?

@iloveeclipse
Copy link
Member

Yes, I agree having a dedicated branch helps, but changing it now would likely mean I'll have to create a new PR, losing the context. And I believe it would not matter much once merged?

It will. Please create new PR from dedicated branch. The context is #179 and it will not be lost.

@nisargjhaveri
Copy link
Contributor Author

Created #226. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing variables when debugging Android apps
3 participants