public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* gcj 4.6 on OpenBSD/x86
@ 2012-10-08 20:08 Kurt Miller
  2012-10-08 20:35 ` David Daney
  0 siblings, 1 reply; 9+ messages in thread
From: Kurt Miller @ 2012-10-08 20:08 UTC (permalink / raw)
  To: java

Hi,

Previously I ported gcj in gcc 4.2.4 to OpenBSD. I currently use it to build classpath-0.98 and bootstrap Oracle's 1.6 JVM using classpath and jamvm. I'm now working on gcj from gcc 4.6.3 on x86 and have run into an issue that I could use some help with.

gjar is segfaulting while throwing a ClassCastException from frame 3. Here is some debugging output showing the state and some variables leading up to the segfault. I'm not sure where to go from here. I can't seem to find the root cause of this issue other than something is wrong with 'obj' in frame 3 and obj->getClass()->getName() fails. Any ideas on how to proceed with the debugging on this issue?

Core was generated by `egjar'.
Program terminated with signal 11, Segmentation fault.
#0  0x0c392970 in _Jv_NewStringUTF (bytes=0xfc408b05 <Address 0xfc408b05 out of bounds>)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natString.cc:245
245       int size = strlen (bytes);


(gdb) bt full
#0  0x0c392970 in _Jv_NewStringUTF (bytes=0xfc408b05 <Address 0xfc408b05 out of bounds>)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natString.cc:245
        length = -2043263696
        chrs = 0x83244620
        limit = 0xc38e18c <java::lang::Class::isArray()+32> "<[\017\224\300\203\304\024[]\303\220U\211\345S\203\354\024\350\222\r\372\377\201\303\070\227) \213E\b\211\004$\350\347z\370\377\204\300t\b\213E\b\213@$\353\005\270"
        size = 310
        p = 0x3 <Address 0x3 out of bounds>
        jstr = 0xcfbc01a8
#1  0x0c348e2a in _Jv_Utf8Const::toString (this=0xfc408b01) at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/gcj/javaprims.h:970
No locals.
#2  0x0c38a734 in java::lang::Class::getName (this=0xc3b75fb <gnu.gcj.runtime.BootClassLoader.bootLoadClass(java.lang.String)java.lang.Class+123>)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natClass.cc:442
No locals.
#3  0x0c38daba in _Jv_CheckCast (c=0x23896b60 <gnu::classpath::tools::getopt::Option::class$>, obj=0x8321e480)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natClass.cc:1897
No locals.
#4  0x039a3de4 in gnu.classpath.tools.getopt.Parser.handleShortOptions(java.lang.String)void (this=@82f21968, option=@8323b858)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/getopt/Parser.java:394
        i = 9
        found = 0x0
        charIndex = 1
#5  0x039a4a54 in gnu.classpath.tools.getopt.Parser.parse(java.lang.String[], gnu.classpath.tools.getopt.FileArgumentCallback)void (this=@82f21968,
    inArgs=@82db8f90, files=@832b2c80) at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/getopt/Parser.java:455
No locals.
#6  0x039b6e20 in gnu.classpath.tools.common.ClasspathToolParser.parse(java.lang.String[], gnu.classpath.tools.getopt.FileArgumentCallback, boolean)void (
    this=@82f21968, inArgs=@82db8f90, files=@832815d0, handleFileLists=true)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/common/ClasspathToolParser.java:105
        cb = 0x0
#7  0x039b32c8 in gnu.classpath.tools.jar.Main.run(java.lang.String[])void (this=@82e3fac8, args=@82db8f90)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/jar/Main.java:272
        p = 0x82f21968
#8  0x039b3408 in gnu.classpath.tools.jar.Main.main(java.lang.String[])void (args=@82db8f90)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/jar/Main.java:284
        jarprogram = 0x0
#9  0x0c380881 in gnu::java::lang::MainThread::call_main (this=0x82dc1f00)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/gnu/java/lang/natMainThread.cc:54
        main_signature = 0x82d43de0
        main_name = 0x82d3dbb0
        meth = 0x2389c224 <_MT_gnu_classpath_tools_jar_Main+100>
        msg = 0x0
        status = 205084852
        real_main = 0x39b33a0 <gnu.classpath.tools.jar.Main.main(java.lang.String[])void>
#10 0x0c464f9a in gnu.java.lang.MainThread.run()void (this=@82dc1f00) at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/gnu/java/lang/MainThread.java:106
No locals.
#11 0x0c395be0 in _Jv_ThreadRun (thread=0x82dc1f00) at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natThread.cc:335
No locals.
#12 0x0c332ec7 in _Jv_RunMain (vm_args=0x0, klass=0x3c003180 <gnu::classpath::tools::jar::Main::class$>, name=0x0, argc=9, argv=0xcfbc082c, is_jar=false)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/prims.cc:1790
        runtime = 0x82db49f0
#13 0x0c332fea in _Jv_RunMain (klass=0x3c003180 <gnu::classpath::tools::jar::Main::class$>, name=0x0, argc=9, argv=0xcfbc082c, is_jar=false)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/prims.cc:1815
No locals.
#14 0x0c33302b in JvRunMain (klass=0x3c003180 <gnu::classpath::tools::jar::Main::class$>, argc=9, argv=0xcfbc082c)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/prims.cc:1821
---Type <return> to continue, or q <return> to quit---
No locals.
#15 0x1c000861 in main (argc=9, argv=0xcfbc082c) at /tmp//ccaCFDWE.i:11
No locals.


(gdb) frame 0
#0  0x0c392970 in _Jv_NewStringUTF (bytes=0xfc408b05 <Address 0xfc408b05 out of bounds>)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natString.cc:245
245       int size = strlen (bytes);
(gdb) p bytes
$35 = 0xfc408b05 <Address 0xfc408b05 out of bounds>
(gdb) up
#1  0x0c348e2a in _Jv_Utf8Const::toString (this=0xfc408b01) at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/gcj/javaprims.h:970
970       jstring toString() { return _Jv_NewStringUTF(data); }
(gdb) p data
Cannot access memory at address 0xfc408b05
(gdb) up
#2  0x0c38a734 in java::lang::Class::getName (this=0xc3b75fb <gnu.gcj.runtime.BootClassLoader.bootLoadClass(java.lang.String)java.lang.Class+123>)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natClass.cc:442
442       return name->toString();
(gdb) p name
$36 = (_Jv_Utf8Const *) 0xfc408b01
(gdb) p *name
Cannot access memory at address 0xfc408b01
(gdb) up
#3  0x0c38daba in _Jv_CheckCast (c=0x23896b60 <gnu::classpath::tools::getopt::Option::class$>, obj=0x8321e480)
    at /usr/obj/i386/ports/gcc-4.6.3/gcc-4.6.3/libjava/java/lang/natClass.cc:1897
1897           (JvNewStringUTF(" cannot be cast to "))->append
(gdb) list
1892      if (__builtin_expect
1893          (obj != NULL && ! _Jv_IsAssignableFrom(JV_CLASS (obj), c), false))
1894        throw new java::lang::ClassCastException
1895          ((new java::lang::StringBuffer
1896            (obj->getClass()->getName()))->append
1897           (JvNewStringUTF(" cannot be cast to "))->append
1898           (c->getName())->toString());
1899
1900      return obj;
1901    }
(gdb) p c
$38 = (jclass) 0x23896b60 <gnu::classpath::tools::getopt::Option::class$>
(gdb) p *c
$39 = {<java::lang::Object> = {<No data fields>}, static class$ = {<java::lang::Object> = {<No data fields>},
    static class$ = <same as static member of an already seen type>, next_or_version = 0x0, name = 0x2b854788 <_Utf161>, accflags = 49,
    superclass = 0x2bf34ae0 <java::lang::Object::class$>, constants = {size = 37, tags = 0x2bf34bc0 <_CT_java_lang_Class> "",
      data = 0x2bf35500 <_CD_java_lang_Class>}, {methods = 0x2bf34d60 <_MT_java_lang_Class>, element_type = 0x2bf34d60 <_MT_java_lang_Class>},
    method_count = 82, vtable_method_count = 65, fields = 0x0, size_in_bytes = 148, field_count = 0, static_field_count = 0,
    vtable = 0x2bf34c48 <vtable for java::lang::Class+8>, otable = 0x0, otable_syms = 0x0, atable = 0x0, atable_syms = 0x0, itable = 0x0,
    itable_syms = 0x0, catch_classes = 0x2bf34be8 <_catch_classes_java_lang_Class>, interfaces = 0x2bf353c8 <_IF_java_lang_Class>, loader = 0x0,
    interface_count = 4, state = 14 '\016', thread = 0x1, depth = 1, ancestors = 0x82d41ff0, {idt = 0x82d46fc8, ioffsets = 0x82d46fc8},
    arrayclass = 0x82d49ed8, protectionDomain = 0x0, assertion_table = 0x0, hack_signers = 0x0, chain = 0x2c086ca0 <java::lang::Cloneable::class$>,
    aux_info = 0x0, engine = 0x2c63be40 <_Jv_soleCompiledEngine>, reflection_data = 0x2b8547a0 <_reflection_data_0> "\001"},
  next_or_version = 0x238969c0 <gnu::classpath::tools::jarsigner::Main$ToolParser::class$>, name = 0x237ff9f4 <_Utf8>, accflags = 1057,
  superclass = 0x2bf34ae0 <java::lang::Object::class$>, constants = {size = 4, tags = 0x23870d4c <_CT_gnu_classpath_tools_getopt_Option> "",
    data = 0x23896ab8 <_CD_gnu_classpath_tools_getopt_Option>}, {methods = 0x238f4ce0 <_MT_gnu_classpath_tools_getopt_Option>,
    element_type = 0x238f4ce0 <_MT_gnu_classpath_tools_getopt_Option>}, method_count = 15, vtable_method_count = 13,
  fields = 0x23896a60 <_FL_gnu_classpath_tools_getopt_Option>, size_in_bytes = 28, field_count = 5, static_field_count = 0, vtable = 0x82e4e840,
  otable = 0x23936428 <_otable_gnu_classpath_tools_getopt_Option>, otable_syms = 0x23896ac8 <_otable_syms_gnu_classpath_tools_getopt_Option>,
  atable = 0x23936444 <_atable_gnu_classpath_tools_getopt_Option>, atable_syms = 0x23896b10 <_atable_syms_gnu_classpath_tools_getopt_Option>,
  itable = 0x0, itable_syms = 0x0, catch_classes = 0x23870d50 <_catch_classes_gnu_classpath_tools_getopt_Option>, interfaces = 0x0, loader = 0x82d5b000,
  interface_count = 0, state = 14 '\016', thread = 0x82dc1f01, depth = 1, ancestors = 0x82d41a40, {idt = 0x0, ioffsets = 0x0}, arrayclass = 0x0,
  protectionDomain = 0x0, assertion_table = 0x23896b34 <_type_assert_gnu_classpath_tools_getopt_Option>, hack_signers = 0x0,
  chain = 0x23897dc0 <gnu::classpath::tools::getopt::Parser$1::class$>, aux_info = 0x0, engine = 0x2c63be40 <_Jv_soleCompiledEngine>,
  reflection_data = 0x0}
(gdb) p obj
$37 = (jobject) 0x8321e480
(gdb) p *obj
$44 = <incomplete type>
(gdb) x/20w obj
0x8321e480:     0x82e4e100      0x00000000      0x0000006d      0x00000000
0x8321e490:     0x83292738      0x83244080      0x00000000      0x82e3fac8
0x8321e4a0:     0x2c07d8e8      0x00000000      0x832207e0      0x8321e4a0
0x8321e4b0:     0x00000000      0x832285f0      0x00000000      0x00000000
0x8321e4c0:     0x2c08d248      0x00000000      0x83222ab0      0x83222ab0
(gdb)
0x8321e4d0:     0x00000000      0x00000000      0x00000000      0x00000000
0x8321e4e0:     0x2c07d8e8      0x00000000      0x83220810      0x8321e4e0
0x8321e4f0:     0x00000000      0x83228620      0x00000000      0x00000000
0x8321e500:     0x2c07d8e8      0x00000000      0x832208e8      0x8321e500
0x8321e510:     0x00000000      0x83228680      0x00000000      0x00000000
(gdb)
0x8321e520:     0x2c07d8e8      0x00000000      0x83220918      0x8321e520
0x8321e530:     0x00000000      0x832286b0      0x00000000      0x00000000
0x8321e540:     0x2c07d8e8      0x00000000      0x832209c0      0x8321e540
0x8321e550:     0x00000000      0x83228710      0x00000000      0x00000000
0x8321e560:     0x2c07d8e8      0x00000000      0x832209f0      0x8321e560
(gdb)
0x8321e570:     0x00000000      0x83228740      0x00000000      0x00000000
0x8321e580:     0x2c07d8e8      0x00000000      0x83220a98      0x8321e580
0x8321e590:     0x00000000      0x832287a0      0x00000000      0x00000000
0x8321e5a0:     0x2c07d8e8      0x00000000      0x83220ac8      0x8321e5a0
0x8321e5b0:     0x00000000      0x832287d0      0x00000000      0x00000000
(gdb)
0x8321e5c0:     0x2c07d8e8      0x00000000      0x83220b70      0x8321e5c0
0x8321e5d0:     0x00000000      0x83228830      0x00000000      0x00000000
0x8321e5e0:     0x2c07d8e8      0x00000000      0x83220ba0      0x8321e5e0
0x8321e5f0:     0x00000000      0x83228860      0x00000000      0x00000000
0x8321e600:     0x2c07d8e8      0x00000000      0x83220c48      0x8321e600

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-10-14 11:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-08 20:08 gcj 4.6 on OpenBSD/x86 Kurt Miller
2012-10-08 20:35 ` David Daney
2012-10-08 22:10   ` Kurt Miller
2012-10-09  0:51     ` Andrew Haley
2012-10-09 13:06       ` Kurt Miller
2012-10-09 17:22         ` Boehm, Hans
2012-10-09 18:27           ` Kurt Miller
2012-10-10 13:33           ` Kurt Miller
2012-10-14 11:26             ` Kurt Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).