This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to handle a NullPointerException


Dimiter Stamenov wrote:
 >__cyg_profile_func_enter() is just a C function that takes two void* args
 >
 >void __cyg_profile_func_enter( void *this, void *callsite )
 >
 >Define it and link with your program.
 >
 >Do *not* compile this C code with `-finstrument-functions'.
 >
 >Andrew.
 >
 >
 >void __cyg_profile_func_enter( void *this, void *callsite )
 >{
 >   /* Function Entry Address */
 >   fprintf(fp, "E%p\n", (int *)this);
 >}
 >
 >
 >void __cyg_profile_func_exit( void *this, void *callsite )
 >{
 >   /* Function Exit Address */
 >   fprintf(fp, "X%p\n", (int *)this);
 >}

OK I have compiled successfully with -finstrument-functions and a new exception is thrown (not thrown when compiled without it)... I am wondering why everything is OK when running with JVM - if there is not an exception with it, then may be the problem is not in the java code?

The result from gdb is:
(gdb) run
Starting program: universal.exe
Loaded symbols for D:\WINDOWS\system32\ntdll.dll
Loaded symbols for D:\WINDOWS\system32\kernel32.dll
Loaded symbols for D:\WINDOWS\system32\advapi32.dll
Loaded symbols for D:\WINDOWS\system32\rpcrt4.dll
Loaded symbols for D:\WINDOWS\system32\msvcrt.dll
Loaded symbols for D:\WINDOWS\system32\user32.dll
Loaded symbols for D:\WINDOWS\system32\gdi32.dll
Loaded symbols for D:\WINDOWS\system32\ws2_32.dll
Loaded symbols for D:\WINDOWS\system32\ws2help.dll
java.io.IOException: Unable to read entire header; 1 byte read; expected 512 bytes
   at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(universal.exe)
   at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(universal.exe)
   at org.apache.poi.hwpf.HWPFDocument.verifyAndBuildPOIFS(universal.exe)
   at org.apache.poi.hwpf.extractor.WordExtractor.<init>(universal.exe)
   at org.apache.poi.Universal.getWordFileText(universal.exe)
   at org.apache.poi.Universal.main(universal.exe)

All I can tell is that there is something wrong. I can't tell why using -finstrument-functions would make any difference. I'd have to debug it.


It seems to me that the system is very unstable, so you are seeing random
corruption.

Do you still see this if the __cyg_profile functions are empty?

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]