NullPointerException windows

16 views
Skip to first unread message

Patrick

unread,
Jun 22, 2016, 10:39:04 PM6/22/16
to Avian
Hello,

I'm using avian as a dll (compiled with cygwin) for a project (compiled Visual Studio Express 2015). 
I'm trying to capture NullPointerExceptions and log the stack trace, but the program crashes instead. All other exceptions work fine. 

I've read through https://groups.google.com/forum/#!msg/avian/GoutPJOk65I/9t1nPBg6BAAJ but still can't come up with a fix.

Is there any way to properly get the exception description rather having the program crash in windows?

Thanks,

Patrick

patrick...@byte4byte.com

unread,
Jun 25, 2016, 3:25:46 PM6/25/16
to Avian
Ok got it. It was because it was being run in the debugger.

Also setting the mode to interpret allows me to run from the debugger without crashing.

Joel Dice .

unread,
Jun 25, 2016, 3:32:51 PM6/25/16
to Avian
Ah, that explains it. Yes, the debugger will always trap the access
violation before the VM gets a chance to handle it. The way the VM
handles null dereferences is to install an OS-level handler using
AddVectoredExceptionHandler so it can turn the access violation into a
Java-level exception. The debugger steps in before the VM's handler
gets a chance, and unless the debugger gives you a way resume
execution and allow the VM's handler to run (GDB lets you do that, I
don't know about Windows debuggers), the program will crash.

Glad you figured it out.
> --
> You received this message because you are subscribed to the Google Groups
> "Avian" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to avian+un...@googlegroups.com.
> To post to this group, send email to av...@googlegroups.com.
> Visit this group at https://groups.google.com/group/avian.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages