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: gcj, gdb warnings & jni method signatures


Friday, September 17, 2004, 5:08:44 PM, you wrote:

>>>>>> "Rutger" == Rutger Ovidius <r_ovidius@eml.cc> writes:

Rutger>> Thanks for the pointer. I put in some more printf debug lines and it
Rutger>> led me to the find_symbol function in natRuntime.cc (specifically, the
Rutger>> call to lt_dlsym)

TT> So there isn't a buffer overflow?  Or maybe it only is diagnosed later
TT> on?  All I can really suggest is putting a breakpoint in find_symbol
TT> and seeing whether things look ok.  You could also try stepping
TT> through lt_dlsym to see whether it is doing an invalid free.

TT> Tom

Hi,

I've tried doing as you've suggested, but I don't immediately notice
anything wrong.  The warning comes up as soon as the ltdl.c call to
GetProcAddress() is made (in sys_wll_sym()).

I made a simple stand-alone example.  If I make the method
name shorter, or longer it works without warning. If I remove the
__Ljava_lang_String_2 from the jni function signature there is no
warning. If I add an fprintf right before the
memcpy ((buf + long_start + 1 + 1), long_nm_sv, sizeof (long_nm_sv));
in jni.cc, it doesn't show a warning. But, these might all be flukes
for all I know.

Maybe one day I'll get lucky and figure it out.

Attached is my exciting sample (for posterity)..

gcj -fjni -g --main=O O.java -o otest.exe
gcc -shared -I\j2sdk1.4.1_02\include\win32\ -I\j2sdk1.4.1_02\include\  foo.c -o foo.dll
gdb otest ...
class O {

  public static final native int abcdefghijklmnopqrstuvwxyzabcdefghKreateFontIndirect (String s);

  static {
		try {
    	System.loadLibrary("foo");
		} catch (Exception e) {
			e.printStackTrace();
		}
  }
  public static void main(String[] args) {
		System.out.println("Start ");
 		int rc;
	  rc = abcdefghijklmnopqrstuvwxyzabcdefghKreateFontIndirect("");
		System.out.println("End1: " + rc);
 		rc = abcdefghijklmnopqrstuvwxyzabcdefghKreateFontIndirect("");
		System.out.println("End2: " + rc);

	}

}

Attachment: foo.c
Description: Binary data


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