Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Causing a break into the debugger(Is it possible when debugging Java under Eclipse to invoke a breakpoint halt)
Causing a break into the debugger [message #1768954] Tue, 25 July 2017 08:06 Go to next message
joseph newcomer is currently offline joseph newcomerFriend
Messages: 15
Registered: July 2017
Junior Member
When I programmed using C/C++ under Windows using Microsoft Visual Studio, I could cause my program to simulate hitting a breakpoint by putting a call to DebuBreakpoint() in my code. This was simpler than setting a conditional breakpoint when the condition was complex. If this was called during a non-debug run, it created an exception which stopped execution, but it was wonderfully handy during development. All it did was execute an INT3 instruction, which is the stock debugger breakpoint for the x86 architecture. I would like to do something analogous when running under Eclipse. Currently, I do it by
if(complex_test_for_validity)
      {
       System.out.print(all kinds of stuff);
       System.out.println(); // set breakpoint here
      }

But that seems silly. I set the conditions that would lead to the tests and breakpoint via command-line options that would not normally be known to an end user. Is there any means of replacing the println with a call so that my code looks more like
if(...)
   {
    ...stuff...
    DebugBreak();
   }

?
The goal is to avoid searching for the correct line each time.

I just spent an hour trying different search keys, and came up dry.
Re: Causing a break into the debugger [message #1769005 is a reply to message #1768954] Tue, 25 July 2017 14:28 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I suggest you throw a specific exception and set an exception breakpoint.
Previous Topic:Insert Block from a different AST inside MethodDeclaration
Next Topic:Show Javadoc when hovering over deprecated method call
Goto Forum:
  


Current Time: Thu Oct 03 20:30:55 GMT 2024

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

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

Back to the top