문제

I am using Solaris x86 box. My application crashes with following stack trace.

fed155f9 realfree (816d878) + 97 fed151be _malloc_unlocked (7e0, 8047eac, 8047e3c, feffb7d8, 8047bac, 809dd6a) + 18c fed15008 malloc (7e0) + 34

I need to debug it with "watchmalloc". My application will be started by system inetd process. I cannot control its execution. Please let me know how to use watchmalloc in this scenario.

I set the following environment variable it helps only for process started from the shell.

LD_PRELOAD=watchmalloc.so.1 MALLOC_DEBUG=WATCH,RW
도움이 되었습니까?

해결책

What about renaming your app to lets say myapp.bin, and install a small shell script like:

! /bin/sh

LD_PRELOAD=watchmalloc.so.1 MALLCO_DEBUG=WATCH,RW export LD_PRELOAD MALLOC_DEBUG exec myapp.bin "$@"

다른 팁

Just replace your application by a wrapper that sets the required variables then launch the real application.

eg:

cd <path to myapp>
mv myapp myapp.real
cat > myapp <<%
#!/bin/ksh
export LD_PRELOAD=watchmalloc.so.1
export MALLOC_DEBUG=RW
exec $(dirname $0)/myapp.real "$@"
%
chmod +x myapp
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top