Mike Morgan <mmor
...@lucent.com> wrote:
> Could anyone tell me if this happens on their systems?
> When I export LD_PRELOAD=libmalloc.so.1 on Solaris 9 and run dbx, it
> crashes.
> truss reports:
> brk(0x1005DC150) = 0
> Incurred fault #6, FLTBOUNDS %pc = 0xFFFFFFFF7F200FC8
> siginfo: SIGSEGV SEGV_MAPERR addr=0x00014000
> Received signal #11, SIGSEGV [default]
> siginfo: SIGSEGV SEGV_MAPERR addr=0x00014000
> dbx version:
> Forte Developer 7 Dbx Debugger 7.0 Patch 115977-02 2004/04/07
> (latest patch 115977-03 crashes as well)
> This problem does not appear on Solaris 7 with dbx version:
> Sun WorkShop 6 update 2 Dbx Debugger 6.2 Patch 115117-01 2003/12/17
> However dbx appears to run fine with any other malloc replacement
> library (watchmalloc/bsdmalloc/mtmalloc).
> Just want to make sure it's not some configuration issue on my end.
> thanks,
> Mike Morgan
No, it's not your fault.
This is yet another manifestation of the bug 4846556.
libmalloc doesn't have valloc() and memalign(),
so any program that uses those to allocate a memory
will get SEGV when it frees the memory
because valloc() and memalign() are libc's version
but free() is from libmalloc.
The cpu performance counters library libcpc is used by dbx and collector
and calls one of those two, making dbx and collector
fail with libmalloc.
Anyway, unless you want to do something about dbx itself,
you don't want to LD_PRELOAD something for dbx.
If you want to preload the library for your debugged program,
use LD_PRELOAD inside dbx:
$ dbx ...your program...
(dbx) LD_PRELOAD=...whatever library...
(dbx) run
This makes sure dbx itself does not preload the library
but your target program does.
But whenever you preload a library, dbx will see
multiple symbols with the same name
so you'll have to be careful whenever you do something inside dbx
(dbx will ask you when it can not uniquely resolve the name
but sometimes it can be confusing).
Seongbae