1

I'm trying to keep track of String literals (loaded with LDC) in a Method, both in local variables and in the stack. I'm able to do it with a modified version of AnalyzerAdapter:

https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AnalyzerAdapter.html

However my current approach is limited, because I don't know how to properly handle jumps. AnalyzerAdapter clean locals and stacks after GOTO for example and uses stack map tables to recover the values when a new frame is started, but in my case I would need to which are the ones being restored and if any of them are literals.

I understand that what I'm trying to achieve is not easy because it may imply merging values from more than one code branch and act accordingly.

Any ideas?. Thanks in advance.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Ander Ruiz
  • 11
  • 1
  • 1
    I think [ASM Get exact value from stack frame](https://stackoverflow.com/q/48802291/2711488) is what you’re after – Holger Sep 29 '21 at 08:01
  • I'm using event based API, not Tree API (and it is not something I could change :( ) – Ander Ruiz Sep 30 '21 at 12:55
  • 1
    All built-in analyzer capabilities of ASM settle on the tree API. Before you start rolling out your own, consider that you can not track values in a single pass as that’s just impossible. That’s why stackmaps were invented, to allow the verifier to do verification in a single pass. But stackmaps contain types only, not values. – Holger Sep 30 '21 at 19:17

0 Answers0