Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Setting breakpoints in foreign sources(How eclipse determines line numbers of breakpoints)
Setting breakpoints in foreign sources [message #1750322] Mon, 19 December 2016 23:08 Go to next message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 36
Registered: July 2009
Member
hi folks, was wondering how eclipse decides what 'line' a breakpoint was put on. I was hoping it would naively take whatever line you set the break point on, but that appears not to be the case.

It appears that it tries to actually parse the source file, rather than just look up the byte code offset based on the linenumbertable attribute of the class/methods.

in my case, my 'source' isn't java. and certainly not something eclipse understands

I am creating javap-like source files, who's lines map to byte code offsets as appropriate in the class's linenumber table.

However, when i try to set a breakpoint in my 'source' file, eclipse sets the breakpoint at the end of the file, and so it is not a proper breakpoint.

My project in question is

https://github.com/mebigfatguy/baremetal4j

Notice i'm creating files with a .java extension, which i suppose is a no-no, however it appears eclipse doesn't respect the ability to set breakpoints in non-java files.

Anyone have any ideas?
Re: Setting breakpoints in foreign sources [message #1750324 is a reply to message #1750322] Mon, 19 December 2016 23:45 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I would be surprised if this can be made to work in the way you expect. The assumption that a Java breakpoint relates to a Java class runs probably quite deep (you shouldn't be surprised about that). Looking at your github, it seems that JDT will neither understand your "source", nor will it ever see the actual class bytes being executed (if transformed on load). So how is JDT supposed to make any sense of that?

It might require creating your own breakpoint type, in which case it could also be associated with your editor of choice etc.
For that you could probably re-use / copy a lot from Java breakpoints.
That's all I can think of right now.

Stephan
Re: Setting breakpoints in foreign sources [message #1750327 is a reply to message #1750324] Tue, 20 December 2016 01:30 Go to previous message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 36
Registered: July 2009
Member
i don't think the breakpoints will be a problem, as you can aspect-ize code using the same process and hit breakpoints. I'm pretty sure it's the source code. I wonder how eclipse handles scala, or other things. Can i create my own language extends (.asm) and have eclipse honor it somehow? If nothing pops, i suppose i can try creating 'proper' java files like

class Foo {
int BC;

public void moo() {
BC=0; // ALOAD_0
BC=1; // BIPUSH 0
BC=2; //INVOKEMETHOD
}

etc. at least eclipse will see that as a reasonably formatted java file, and maybe that will work.
Previous Topic:NonNull and java.lang.Optional orElse()
Next Topic:Acquiring of ASTs with bindings out of eclipse
Goto Forum:
  


Current Time: Tue Oct 15 00:03:32 GMT 2024

Powered by FUDForum. Page generated in 0.03032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top