Skip to content

Conversation

dkimitsa
Copy link
Contributor

@dkimitsa dkimitsa commented Feb 15, 2019

NOTE: this PR is intended for 2.3.7-SNAPSHOT as introduces changes in compilation pipeline.
currently created for wide testing

This PR changes following:

reworked method resolution of variables for Debugger

post in blog
Problem: Soot splits variables slot on assignment for type resolution and not always it able to pack them back. As result during method flow variable can be located in different locals (memory addresses). This affects both Java and Kotlin.
Before: it was supposed that variable will be located at single memory address. that causes cases when variable was not resolved for debugger (as was resolved to multiple locals/memory location);
Now: for each instruction visible variable scope is resolved. As result variable debugger can handle splitter variable case. This variable scope index is saved in debug information in Column index (altogether with line number);
Changes for this:

  • Soot was reworked. Previous variable resolution was dropped. Instead added RoboVM specific variable Packing code. Also added visible variable scope;
  • Hooks infrastructure changed to provide current instruction pointer (PC) in each frame. This allows to calculate frame offset from method start and visible variable slice at this offset for debugger.
  • LLVM support code updated to fetch column number to build offset to variable slice map;
    Problems: some kotlin libraries has broken debug information as result some variables will not be resolved. post about this

added SMAP support for debugger

details in blog
Kotlin injects inline function in class files that messes line numbers information. But it also provides SMAP to allow get original line numbers. Support for SMAP was added

allowing soot to split slots dedicated for parameters

details in blog
Kolin re-uses parameter slots for local and this was not expected by RoboVM code. As result soot was not able to resolve local type constraints and crashed. Changes were done in Soot but also reflects debugger plugin.
This fixes #220

build instructions for MobiVM team

  • pull changes from my Soot repo, build and deploy 2.5.0-6
  • build llvm library and commit it (intentionally didn't commit it as binaries has to be build in single clean env due security reasons)

pre-build Idea plugin

rebuild IntelliJ Idea plugin (2.3.8-SNAPSHOT) is available for testing

dkimitsa added 12 commits June 22, 2018 14:07
…to have Dwarf* prefix. Just to make difference with all kinds of debug information
 - for each instruction variable slice is generated (list of visible variables at this instruction)
 - variables are being resolved not by line number of call stack but by PC
 - for this special table of pc to method start is generated which point to variables visible at specific PC
…ns in debug mode) for case when type of local doesn't match debug information. its kotlin case
* debug locations that were throwing exceptions removed
* cleanup
… added. as debug version of llvm has assertion that checks for array type and will crash
…lving variables. As kotlin reuses arguments slots and this made mess. Now only relies on debug information provided in class file
…first instruction of line, not before last. othervise complex expressions will be half solved when BP reaches.
@dkimitsa
Copy link
Contributor Author

btw, RoboVM cache has to be wiped.

… different symbols: one for saving offset and second for emitting it. otherwise it crashes on assert due symbol was used reason in debug builds
@florianf
Copy link
Collaborator

@dkimitsa should we merge this now, since the release is done?

@dkimitsa
Copy link
Contributor Author

@florianf yes, snapshot will give better feed back.
but is is not just a merge -- there more actions to be done, check first comment

@Franjoo
Copy link

Franjoo commented Mar 17, 2019

Are there any plans when this feature will be finished? Thanks!

@florianf
Copy link
Collaborator

florianf commented Apr 3, 2019

@Tom-Ski I merged the upstream changes in the soot repo, can you release a new version to sonatype?

@florianf
Copy link
Collaborator

Heads up: this is not forgotten, still waiting for @Tom-Ski to push a new soot release.

@dkimitsa
Copy link
Contributor Author

2.3.7-SNAPSHOT Idea plugin with recent fixes is available for testing

@dkimitsa
Copy link
Contributor Author

@florianf @Tom-Ski how about releasing 2.3.7 with fixes it has ? to have issue-less release version. and them moving forward with this stuff ?

@florianf
Copy link
Collaborator

@dkimitsa : Fine for me, currently only @Tom-Ski can do a release.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>

Choose a reason for hiding this comment

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

@dkimitsa, why so ancient maven-compiler-plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is lot of deprecated code, we hadn't touch it yet as long as it keep working

@Franjoo
Copy link

Franjoo commented May 14, 2019

After I ran in some issues related to #220 and #349, I luckily got some help from @dkimitsa who provided the 2.3.7 Snapshot. So I want to give some testing feedback:

  • robovm used in a libgdx environment

the plugin solves:

1. error compiling kotlin coroutines (#220)

(https://gist.github.com/Franjoo/bfe600ae7e776a32d62919b98b7a7bef)

2. can not save and run roboVM on iOS simulator due to missing / unsafed run configuration

notes:

1. in libgdx projects it is needed to remove android module since there seems to be issues with facet configurations in workspace.xml
2. Got compilation error when using 'implementation' instead of 'compile' using robovm in build.gradle
3. Debugger was tested and works well
4. plugin was tested in large(r) libgdx project and works as expected (cocoutines, ios simulator run configuration, debugger).

@dkimitsa
Copy link
Contributor Author

hi @Franjoo, thank you for providing feedback.

@dkimitsa dkimitsa mentioned this pull request Jun 30, 2019
3 tasks
@eusilin
Copy link

eusilin commented Jul 8, 2019

It seems there are quite a few critical fixes in this PR.
Any ideas when it will be pulled in?
Can I get a snapshot version?

@dkimitsa
Copy link
Contributor Author

have merged with master and re-build snapshot (link if first comment)

@Tom-Ski Tom-Ski merged commit 8a1b02e into MobiVM:master Jul 11, 2019
@dkimitsa dkimitsa deleted the debugger_local_resolution branch August 26, 2019 20:03
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.

Exception in Lambda transformation using modified soot
6 participants