Re: gdb won't break at malloc_printf() though I followed MallocDebug directions
Re: gdb won't break at malloc_printf() though I followed MallocDebug directions
- Subject: Re: gdb won't break at malloc_printf() though I followed MallocDebug directions
- From: Alin Pilkington <email@hidden>
- Date: Wed, 18 Aug 2004 12:02:53 -0700
Thanks Jim,
That is exactly what must be happening. I used gdb's
info symbol <breakAddr>
to tell me where the break address returned by
b malloc_printf
existed and it was indeed in the libSystem, not libMallocDebug. My
painful workaround was to add code to print out the address of
malloc_printf from within my application and then did a breakpoint on
that address (which was the libMallocDebug guy). I'll go try the
"rbreak" command now!
Alin :)
On Aug 18, 2004, at 10:27 AM, Jim Ingham wrote:
When you insert the Malloc Debug library into your program, you now
have two copies malloc_printf, one from libSystem and one from
libMallocDebug. The behavior of gdb's "break" command is to set the
breakpoint on the first matching symbol, and stop looking. So it is
presumably finding the one in libSystem, but that one never gets
called.
There is another command in gdb: "rbreak", which does an exhaustive
search for symbols, and will put a breakpoint on each matching
instance. If you use rbreak instead of break, it should find two
copies of malloc_printf & break on both.
Jim
On Aug 17, 2004, at 11:42 PM, Alin Pilkington wrote:
Hi,
I can get 99% of the advertised functionality of MallocDebug to work
for me with one exception...hitting a breakpoint at malloc_printf()
when memory errors are annunciated. Here is my setup:
1) Using CodeWarrior to build a Mach-O, BSD C, MSL C++ Carbon
application...no problems with this step.
2) I can invoke my app from within MallocDebug without any problems
and
MallocDebug does it's thing, finding leaks, overruns, double free's,
writes to freed memory, etc. Some of the messages go to the console as
stated in the documentation for MallocDebug.
So...since I am getting those console messages, I decided to invoke my
program from within gdb and I carefully read the documentation and do
the following steps (copied from the documentation)
% gdb myProgram.app
<gdb> set start-with-shell 0
<gdb> set env DYLD_INSERT_LIBRARIES /usr/lib/libMallocDebug.A.dylib
<gdb> set env DYLD_FORCE_FLAT_NAMESPACE 1
<gdb> run
^C
<gdb> b malloc_printf
<gdb> c
I do the ^C to stop the program after I think the dynamic library has
loaded and then set the breakpoint. The breakpoint goes in fine and
even gives me the memory address of the breakpoint...all seems cool.
When I continue after setting the breakpoint, I get all of the
messages
from MallocDebug (this time in the terminal window instead of the
console) but I NEVER break!!!! I'm at a total loss and I have racked
my
brain for answers. The fact that libMallocDebug.A.dylib is actually
loaded is obvious by the messages being printed to the terminal so
everything seem to work except the breakpoint.
FWIW, I'm using CodeWarrior 9.2, Xcode 1.5, OS X 10.3.5...
Anybody got any ideas?
Many thanks!!
Alin :)
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.