简体   繁体   中英

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.

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM