Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Set breakpoint(How to set a breakpoint at exit of a method)
Set breakpoint [message #1852241] Thu, 05 May 2022 16:29 Go to next message
Jacques Klein is currently offline Jacques KleinFriend
Messages: 2
Registered: April 2022
Junior Member
Simple example.

class X {
String _v;

X() {
........
_v = .....; // line N-1
} // line N


public String toString() { return _v; }
}

Rq: I cannot edit the source code

If I want to "see" the (toString()) value of every new X, I put a breakpoint in the X constructor,
ideally at line N, BUT I cannot (why not?).
what I can do is put the bp at line N-1, but this forces me to do Next :-(.

Is there any solution to this annoying behavior ?
Re: Set breakpoint [message #1852245 is a reply to message #1852241] Thu, 05 May 2022 18:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The breakpoints use a very simple but effective line number comparison, so they only work on lines at which execution stops, and may wirk multiple times if execution stops many times as for a loop.

I find that adding dummy lines such as getClass(); solve the problem.

Regards

Ed Willink
Re: Set breakpoint [message #1852246 is a reply to message #1852245] Thu, 05 May 2022 19:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Set a breakpoint at the line with X() and then use the context menu on that breakpoint decoration to look at the Breakpoint Properties; you'll see checkboxes for Entry and Exit. The Exit checkbox will do what you want I think...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Set breakpoint [message #1852249 is a reply to message #1852246] Fri, 06 May 2022 04:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Yes, but unfortunately the performance for entry breakpoints at least is much worse than dreadful. Avoid entry breakpoints wherever possible. see e.g https://bugs.eclipse.org/bugs/show_bug.cgi?id=182650

Regards

Ed Willink
Re: Set breakpoint [message #1852253 is a reply to message #1852249] Fri, 06 May 2022 08:29 Go to previous message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 128
Registered: July 2009
Senior Member
Exit breakpoints as perfect for this, as Ed pointed out. I am sure there's some price involved, but in my experience, they are not half as bad as conditional breakpoints.
Previous Topic:Questions about Adoptium (Eclipse) Temurin Java
Next Topic:Support for Java 18?
Goto Forum:
  


Current Time: Wed Apr 24 19:03:15 GMT 2024

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

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

Back to the top