How to stop at the crash source statement when debugging with Eclipse ?

J

Jochen Brenzlinger

Assume I have a java project in Eclipse and start to debug it.
The first stop is at main() function - ok. Then I hit F8 (=Resume)
and the program runs until an unknown crash statement.

The only information I got is the trace stack in the output window.
But what I want is that the statement pointer in the debug source window
jumps to exactly this (last) statement before the crash.
When I can achieve this I can peek e.g. into certain variable values.

Currently neither the statement exection pointer jumps to this critical statement
nor there is a statement pointer at all.

How do I get such a "jump-and-show-before-crash" in the source window ?

Jochen
 
P

Patricia Shanahan

Jochen said:
Assume I have a java project in Eclipse and start to debug it.
The first stop is at main() function - ok. Then I hit F8 (=Resume)
and the program runs until an unknown crash statement.

The only information I got is the trace stack in the output window.
But what I want is that the statement pointer in the debug source window
jumps to exactly this (last) statement before the crash.
When I can achieve this I can peek e.g. into certain variable values.

Currently neither the statement exection pointer jumps to this critical statement
nor there is a statement pointer at all.

How do I get such a "jump-and-show-before-crash" in the source window ?

Jochen

In Eclipse terms, you want an "exception breakpoint".

Under the "Run" menu, look for "Add Java Exception Breakpoint".

Also, search the documentation for "exception breakpoint".

Patricia
 
O

Oliver Wong

Jochen Brenzlinger said:
Assume I have a java project in Eclipse and start to debug it.
The first stop is at main() function - ok. Then I hit F8 (=Resume)
and the program runs until an unknown crash statement.

The only information I got is the trace stack in the output window.
But what I want is that the statement pointer in the debug source window
jumps to exactly this (last) statement before the crash.
When I can achieve this I can peek e.g. into certain variable values.

Currently neither the statement exection pointer jumps to this critical
statement
nor there is a statement pointer at all.

How do I get such a "jump-and-show-before-crash" in the source window ?

This "crash" is actually an uncaught exception. You can configure the
Eclipse debugger to stop at all thrown exceptions, or only thrown exceptions
which are uncaught, or only thrown exceptions that are caught. To be safe,
have it stop at all exceptions.

Alos, if you're running the program via Eclipse, the stack trace should
have a bunch of filenames and line numbers which act liek hyperlinks. If you
click on the uppermost one, it'll take you to line in the source code where
the exception is being thrown.

- Oliver
 
D

Daniel Rohe

Jochen said:
Assume I have a java project in Eclipse and start to debug it.
The first stop is at main() function - ok. Then I hit F8 (=Resume)
and the program runs until an unknown crash statement.

The only information I got is the trace stack in the output window.
But what I want is that the statement pointer in the debug source window
jumps to exactly this (last) statement before the crash.
When I can achieve this I can peek e.g. into certain variable values.

Currently neither the statement exection pointer jumps to this critical statement
nor there is a statement pointer at all.

How do I get such a "jump-and-show-before-crash" in the source window ?

Jochen

You can look in the stack trace for the first class that you know is in
your project and click on the provided link to get to the implementation
of the method where the exception raises. Then set a breakpoint there
and debug with F5 until you reach the point where the exception raises.

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top