gcj, gdb warnings & jni method signatures

Rutger Ovidius r_ovidius@eml.cc
Fri Sep 17 06:49:00 GMT 2004


Hi,
As I've stated in previous messages I experience strange crashes and
gdb warnings in my SWT app compiled with gcj. When run under gdb, I
will receive between 3 and 5 warning messages like the following at very
specific points in the app:
warning: Invalid Address specified to RtlFreeHeap( 00240000, 0022F800 )
But 'c'ontinuing will work and the app keeps going. Under gdb the app
will always continue and work.
When the app isn't being run under gdb, there is a point at which the
app will (sometimes) crash (unpredictability is wonderful, isn't it?)
but the timing of the crash correlates to a point at which, under gdb,
it would have output one of those warnings.
So I've been trying to investigate the warnings a little further.
Maybe they relate to the point at which it crashes, and maybe they
don't, but they are interesting all the same.
I am using win32 (XP).
gcj (GCC) 4.0.0 20040914 (experimental)
GNU gdb 6.2.1 (with addr2line in path)
I wrote a simple test app that still accesses the swt.dll file for
native calls but accesses one of the native calls that always causes
the warning above. Note: It only causes the warning the first time
this native call is made; subsequent calls to the same native method
do not cause the warning.
I run the test app under gdb:
---
Starting program: /cygdrive/e/dev/wb/ostest.exe
Start
ThreadID: 4068
Start: org.eclipse.swt.internal.win32.LOGFONTW@fd7d48
warning: HEAP[ostest.exe]:
warning: Invalid Address specified to RtlFreeHeap( 00240000, 0022F800 )
Program received signal SIGTRAP, Trace/breakpoint trap.
0x77f767ce in ntdll!DbgUiConnectToDbg () from ntdll.dll
(gdb) bt
#0 0x77f767ce in ntdll!DbgUiConnectToDbg () from ntdll.dll
#1 0x77fa2612 in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#2 0x77f881c0 in ntdll!RtlCheckRegistryKey () from ntdll.dll
#3 0x00240000 in ?? ()
#4 0x0022f800 in ?? ()
#5 0x0022f6a4 in ?? ()
#6 0x77fa2f17 in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#7 0x00240000 in ?? ()
#8 0x0022f7f8 in ?? ()
#9 0x77fb1bd4 in wcstombs () from ntdll.dll
Previous frame inner to this frame (corrupt stack?)
(gdb) c
Continuing.
stupid
End1: 1
stupid
End2: 1
Program exited normally.
---
Thanks so much gdb.. anyway..
The first native call didn't cause any warning:
public static final native int GetCurrentThreadId ();
The call causing the warning is:
public static final native int CreateFontIndirectW (LOGFONTW lplf);
CreateFontIndirectW(new LOGFONTW());
So, I look it up in the swt.dll's source, and see the signature is:
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2
{ fprintf "stupid"; return 1 }...
But, for fun, I change it to:
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW
recompile the .dll and re-run the app under gdb. No more warning!
---
(gdb) r
Starting program: /cygdrive/e/dev/wb/ostest.exe
Start
ThreadID: 1788
Start: org.eclipse.swt.internal.win32.LOGFONTW@fd7d48
stupid
End1: 1
stupid
End2: 1
Program exited normally.
---
The only other method with the same name is CreateFontIndirectW__I so
there is no jobject argument conflict.
So, what is going on here? I've tried to make a stand-alone test app
but of course I can't duplicate the problem (even with a bunch of
same-name methods with different fully qualified classes as
signatures).
Here is the swt.dll with source: ftp://download.eclipse.org/R-3.0-200406251208/swt-3.0-win32.zip
And attached is my small console test app to call the native methods.
gcj -fjni --main=org.eclipse.swt.internal.win32.OS OS.java LOGFONT.java LOGFONTW.java -o ostest.exe
How can I find the real cause of this warning (if this is indeed a
problem)?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OS.java
Type: text/java
Size: 751 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040917/0fba1ed7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LOGFONT.java
Type: text/java
Size: 505 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040917/0fba1ed7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LOGFONTW.java
Type: text/java
Size: 191 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040917/0fba1ed7/attachment-0002.bin>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /