This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcj, gdb warnings & jni method signatures
- From: Rutger Ovidius <r_ovidius at eml dot cc>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 17 Sep 2004 16:42:14 -0700
- Subject: Re: gcj, gdb warnings & jni method signatures
- References: <247092687.20040916234813@eml.cc><m3hdpwg693.fsf@localhost.localdomain>
- Reply-to: Rutger Ovidius <r_ovidius at eml dot cc>
Friday, September 17, 2004, 10:22:32 AM, you wrote:
TT> I would suggest starting your search in jni.cc:_Jv_LookupJNIMethod.
TT> There is probably some kind of buffer overwrite bug in the Windows
TT> specific code.
TT> Tom
Hi,
Thanks for the pointer. I put in some more printf debug lines and it
led me to the find_symbol function in natRuntime.cc (specifically, the
call to lt_dlsym)
The method signatures are different if the .dll is MSVC/gcc/borland,
etc, so _Jv_LookupJNIMethod tries a bunch. SWT is compiled with msvc
(which prepends a "_").
But, the warning pops up before it even gets to the right signature.
I can't explain this at all.
The current signature in swt.dll:
Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2
But if I change it to:
Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW
There is no warning.
Any more suggestions on what to consider next?
natRuntime.cc:
static int
find_symbol (lt_dlhandle handle, lt_ptr data)
{
lookup_data *ld = (lookup_data *) data;
fprintf (stderr, "before_dlsym %d : %s\n", strlen(ld->symname), ld->symname);
ld->result = lt_dlsym (handle, ld->symname);
fprintf (stderr, "after_dlsym %d\n", ld->result);
return ld->result != NULL;
}
In gdb:
---
...
before_dlforeach
before_dlsym 62 : _Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW@12
after_dlsym 0
before_dlsym 62 : _Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW@12
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) c
Continuing.
after_dlsym 0
after_dlforeach
xyz
still null
before_dlforeach
before_dlsym 61 : Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW@12
after_dlsym 0
before_dlsym 61 : Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW@12
after_dlsym 0
after_dlforeach
now what
buf is _Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW_12
after memcpy
before_dlforeach
before_dlsym 102 : Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2
after_dlsym 0
before_dlsym 102 : Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2
after_dlsym 0
after_dlforeach
after lookup
buf is after cat _Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2@12
before_dlforeach
before_dlsym 106 : _Java_org_eclipse_swt_internal_win32_OS_CreateFontIndirectW__Lorg_eclipse_swt_internal_win32_LOGFONTW_2@12
after_dlsym 268441660
after_dlforeach
stupid
End1: 1
stupid
End2: 1
--