Re: [patch] Fix Darwin breakage

Christian Thalinger
2009-08-18T11:52:34Z

Paul Pluzhnikov wrote:
> Greetings,
>
> This patch:
> http://sourceware.org/ml/gdb-patches/2009-07/msg00417.html
> caused Darwin/MacOSX to stop working with assertion:
> objfiles.c:793: internal-error: qsort_cmp: Assertion
> `obj_section_endaddr (sect1) <= sect2_addr' failed.
>
> Turns out this worked only "by accident" before.
>
> Here is a proposed fix. Tested by running "./gdb ./gdb", setting
> breakpoints, etc.
> (I don't have dejagnu setup on MacOS yet).

I tried that patch and it kind of works. But running a program takes
ages (about 5-10 minutes), with GDB using 100% CPU time.

A backtrace looks like this:

(gdb) thr 6
[Switching to thread 6 (Thread 0x2703 of process 55928)]#0 0x94e9c136
in __semwait_signal_nocancel () from /usr/lib/libSystem.B.dylib
(gdb) bt
#0 0x94e9c136 in __semwait_signal_nocancel () from
/usr/lib/libSystem.B.dylib
#1 0x94e9bd1b in nanosleep$NOCANCEL$UNIX2003 () from
/usr/lib/libSystem.B.dylib
#2 0x94e95013 in usleep$NOCANCEL$UNIX2003 () from
/usr/lib/libSystem.B.dylib
#3 0x94eac62e in __abort () from /usr/lib/libSystem.B.dylib
#4 0x94eac68a in abort () from /usr/lib/libSystem.B.dylib
#5 0x01ebdcaa in os::abort(bool) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#6 0x0206cf4e in VMError::report_and_die() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#7 0x01b03c4a in report_assertion_failure(char const*, int, char
const*) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#8 0x01ed2cf9 in Compile::Fill_buffer() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#9 0x01ed4d53 in Compile::Output() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#10 0x01a93198 in Compile::Code_Gen() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#11 0x01a93795 in Compile::Compile(ciEnv*, TypeFunc const* (*)(),
unsigned char*, char const*, int, bool, bool, bool) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#12 0x01f68030 in OptoRuntime::generate_stub(ciEnv*, TypeFunc const*
(*)(), unsigned char*, char const*, int, bool, bool, bool) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#13 0x01f680ba in OptoRuntime::generate(ciEnv*) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#14 0x019cfeac in C2Compiler::initialize_runtime() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#15 0x01771c9e in AbstractCompiler::initialize_runtimes (this=0x11e148,
f=0x19cfd6a <C2Compiler::initialize_runtime()>, state=0x21c955c) at
/Users/twisti/bsd-port/hotspot/src/share/vm/compiler/abstractCompiler.cpp:50
#16 0x019cff11 in C2Compiler::initialize() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#17 0x019cff88 in C2Compiler::compile_method(ciEnv*, ciMethod*, int) ()
from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#18 0x01a9e00c in CompileBroker::invoke_compiler_on_method(CompileTask*)
() from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#19 0x01a9e744 in CompileBroker::compiler_thread_loop() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#20 0x020103c8 in compiler_thread_entry(JavaThread*, Thread*) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#21 0x02011eac in JavaThread::thread_main_inner() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#22 0x02012031 in JavaThread::run() () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#23 0x01ebdeb6 in java_start(Thread*) () from
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
#24 0x94df1155 in _pthread_start () from /usr/lib/libSystem.B.dylib
#25 0x94df1012 in thread_start () from /usr/lib/libSystem.B.dylib
warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

#26 0x00000000 in ?? ()

The backtrace looks fine, but arguments and local variables are not
visible. Loaded shared libraries look OK:

(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x01771b90 0x026a7c27 Yes
/Users/twisti/bsd-port/hotspot/build/bsd/bsd_i486_compiler2/jvmg/libjvm.dylib
0x94dc00c0 0x94f67fbf Yes /usr/lib/libSystem.B.dylib
0x96160780 0x9616904b Yes /usr/lib/libgcc_s.1.dylib
0x910d3fb4 0x9113f6f2 Yes /usr/lib/libstdc++.6.dylib
0x975e12b0 0x975e500c Yes /usr/lib/system/libmathCommon.A.dylib
0x0000d850 0x00018130 Yes
/Users/twisti/bsd-port/hotspot/build/bsd/jdk-bsd-i586/debug/jre/lib/i386/libverify.dylib
0x000267e0 0x00041379 Yes
/Users/twisti/bsd-port/hotspot/build/bsd/jdk-bsd-i586/debug/jre/lib/i386/libjava.dylib
0x0004e390 0x00053248 Yes
/Users/twisti/bsd-port/hotspot/build/bsd/jdk-bsd-i586/debug/jre/lib/i386/native_threads/libhpi.dylib
0x000720f0 0x0008210d Yes
/Users/twisti/bsd-port/hotspot/build/bsd/jdk-bsd-i586/debug/jre/lib/i386/libzip.dylib

-- Christian