Vineel
Vineel

Reputation: 1788

Eclipse (Helios) debugger - getting different Results in Debug mode and Run mode

I am debugging RCP( multi-threaded GUI application) using Eclipse Helios.

When I am executing the same method, I get a null pointer exception in run mode, but in

debug mode, I don't get any exception. I think it works fine in Debug mode.

Null pointer exception doesn't come in debug mode , but in run mode only..

Please help me out. Could it be a multi-threading issue.

Upvotes: 1

Views: 1879

Answers (3)

Gaoqiang Liu
Gaoqiang Liu

Reputation: 21

Please check whether you have used for each to traverse a collection. The traversal order of the collection may be inconsistent between run and debug, which may lead to different results.

Upvotes: 0

Heiko Schmitz
Heiko Schmitz

Reputation: 330

Different behavior in run and debug mode is not unusual. Once I spent a day to find that a toString() had side effects. The debugger calls this method when displaying variables. Another reason for differences is concurrency. The execution order in the debugger may be different from run mode.

Upvotes: 3

Kane
Kane

Reputation: 8172

You can add a breakpoint to the line that NPE happened in run mode. And you need set the property of breakpoint to pause the entire vm.

Then debugging your program, the entire vm will be suspended when a thread tries to execute that line. You can let other threads which don't try to execute that line to resume, the second thread will be suspended on that line as well. You can analysis the flaw of your code.

Upvotes: 1

Related Questions