Home » Language IDEs » Java Development Tools (JDT) » Any way to create a breakpoint on a line number directly entered by me?
Any way to create a breakpoint on a line number directly entered by me? [message #551245] |
Thu, 05 August 2010 13:33  |
Eclipse User |
|
|
|
I need to be able to set breakpoints in decompiled code. The decompiler output shows me the original line numbers, so I can at least follow through the code when I step into it, but it's very difficult to set breakpoints at specific line numbers in the original code. If I set the breakpoint in the editor, that uses the line number in the editor, not the line number in the original code. If I could just create a breakpoint on a line number that I enter in a text field, this would suffice.
Is there some capability that I've missed? Is it worth submitting a feature request for this?
|
|
| | | | | | |
Re: Any way to create a breakpoint on a line number directly entered by me? [message #551540 is a reply to message #551538] |
Fri, 06 August 2010 17:48   |
Eclipse User |
|
|
|
Quote: | True, but once your cursor is there, its trivial to create toggle the breakpoint at the current line:
CTRL+SHIFT+B.
| You're still not quite understanding the problem. I'm well aware of how to set a breakpoint on the current line in the editor view. The problem is that that line number is the one that will be communicated to the JVM, NOT the one that corresponds to the line in the original source code, which is not surprising, as Eclipse would have no way to know that.
For instance, let's say that the stack trace says that I'm on line 636 in the original code. However, in the decompiled code, that line is on line 212. I can set a breakpoint on the current line, but that will be line 212, not 636. When I execute the test case, it won't stop on line 636 in the original code, because the breakpoint I created was for line 212.
In this case, I can sometimes hack around this by scrolling down in the decompiled code to line 636 (which is nowhere near the code I actually want to debug), and if that line actually exists (the decompiled file could be shorter), AND that line is a valid line of executable code (I can't set a breakpoint on it otherwise), then I can set a breakpoint there, and it will do what I want.
In any case, when I filed the ER, I found that it was a duplicate of one entered 8 YEARS ago: https://bugs.eclipse.org/bugs/show_bug.cgi?id=23295
|
|
| |
Re: Any way to create a breakpoint on a line number directly entered by me? [message #551547 is a reply to message #551545] |
Fri, 06 August 2010 18:51  |
Eclipse User |
|
|
|
Quote: | Alternatively, you can export and import breakpoints. You might be able to twiddle the exported breakpoint into what you want. The format is XML based, but poking around in it I see both line numbers and start/end character offsets. Could be tricky.
But in either case, if the "is there a line X" logic is applied to the class file before using such a breakpoint, you could be Thwarted
| Ah. Now you're talking. I tried a simple experiment using this technique, and I think it will basically work. I'm not worried about it validating that the original line number has a valid line of code. I would want it to do that. I'm not going to bother giving it a line number that DOESN'T correspond to a valid line of code in the original source.
The technique has a couple of minor warts, like when you re-import the hacked breakpoints file, you end up with two breakpoints, one at the old line, and one at the new line, and it also doesn't display the breakpoint marker in the editor view, but the breakpoint is there, and it stops there.
|
|
|
Goto Forum:
Current Time: Sat Sep 20 06:38:35 EDT 2025
Powered by FUDForum. Page generated in 0.03814 seconds
|