soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.89k stars 708 forks source link

Bytecodeoffset Tag does not work with asm #537

Closed manasthakur closed 4 years ago

manasthakur commented 8 years ago

I have been asking for this since almost one year, but the Bytecodeoffset tag does not work even now. I was using coffi till now, but it's leading me into newer difficulties (about which everyone on the mailing list denies support saying I should use asm now).

Actually my work is stuck since several days because of this. Can someone please suggest how can I extract the Bytecode offset using the asm frontend?

patricklam commented 8 years ago

It looks like since you need it, you'll have to implement it yourself.

manasthakur commented 8 years ago

It was mentioned in one of the first soot-2.6.0 announcements by Eric that a uniform interface for both the frontends should be provided. If that's not going to happen for Bytecodeoffset tags, I would be happy if someone could please provide me with suggestions on how to initiate with implementing them.

patricklam commented 8 years ago

You can read all of the source code. You are just as empowered as anyone else to fix this problem. I don't think that anyone remembers how that code works right now.

manasthakur commented 8 years ago

Okay. (I was not trying to be offensive; apologies if it felt like that.) Instead of starting from scratch, it would be good if I could get to know if there were some thoughts/challenges posed earlier in implementing them by another member/user. For example, could I start from the diffs of the commits where a similar problem was tackled (#237) for LineNumber offset tags?

patricklam commented 8 years ago

Yes, the first change to MethodBuilder looks like it should be helpful.

On Mon, Feb 15, 2016 at 11:22 AM, Manas Thakur notifications@github.com wrote:

Okay. (I was not trying to be offensive; apologies if it felt like that.) But instead of starting from scratch, it would be good if I could get to know if there were some thoughts/challenges posed earlier in implementing them by another member/user. For example, could I start from the diffs of the commits where a similar problem was tackled (#237 https://github.com/Sable/soot/issues/237) for LineNumber offset tags?

— Reply to this email directly or view it on GitHub https://github.com/Sable/soot/issues/537#issuecomment-184151437.

StevenArzt commented 8 years ago

I am very well aware of this problem. I would have loved to implement it, but the ASM front-end is, as the name implies, based on ASM, which simply doesn't give us bytecode offsets out of the box. We can't create tags for what we don't have. If you search the web for the problem of getting bytecode offsets out of ASM's ASTs, you will only find a very short discussion of a cheesy hack that involves patching the ASM source code. This is something I don't really like, because it makes maintaining Soot and its dependencies much harder if we must make sure to apply our custom patches every time we update a dependency. It's somewhere on my TODO list to come up with a better solution, but my TODO list is long and ASM is not exactly a small codebase.

@manasthakur If you want to help, please try to find out how to get bytecode offsets from ASM, ideally without patching the ASM library. As soon as we have that sorted out, I can implement it in Soot. The latter part is trivial. We need to have the data for the tag, that's the hard part.

Concerning the coffi front-end: We are not denying support because we're bead people (we aren't). Coffi is just so outdated that it can't read newer bytecode (Java 7/8. Since that isn't going to change and there is no stable development on Coffi, we decided to move away from Coffi to something that is more actively developed and maintained. We are not neither the maintainers of Coffi, nor are we the maintainers of ASM. We just need to make sure that we have dependencies we can rely on. This is no longer the case with Coffi, but it is with ASM.

I know that we have this one thing that our new front-end just can't do at the moment. Everything else is (as far as I know) supported. So, if you have the time, lend us a hand (see above).

manasthakur commented 8 years ago

Thanks for the reply, @StevenArzt ; I understand that the problems are because ASM doesn't create labels for every instruction, and not because of Soot. (I love the way Soot has been developing, and have been increasing the number of Soot users over the last year as well!) I will try to get a solution and get back to you, if I am able to get a standard way to extract some information from ASM using which we can get the Bytecode offsets. Meanwhile, since I am stuck, I would have to live with coffi, which means I would keep on posting the additional problems I am facing on the mailing list. :)

patricklam commented 8 years ago

You might also try to get the necessary changes integrated into ASM. That may be your best bet.

On Mon, Feb 15, 2016 at 2:12 PM, Manas Thakur notifications@github.com wrote:

Thanks for the reply, @StevenArzt https://github.com/StevenArzt ; I understand that the problems are because ASM doesn't create labels for every instruction, and not because of Soot. (I love the way Soot has been developing, and have been increasing the number of Soot users over the last year as well!) I will try to get a solution and get back to you, if I am able to get a standard way to extract some information from ASM using which we can get the Bytecode offsets. Meanwhile, since I am stuck, I would have to live with coffi, which means I would keep on posting the additional problems I am facing on the mailing list. :)

— Reply to this email directly or view it on GitHub https://github.com/Sable/soot/issues/537#issuecomment-184200618.

manasthakur commented 8 years ago

Yess!! I will try to get a solution for sure.

pavanupb commented 4 years ago

@manasthakur Please re-open if this is still relevant.