• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory debuggers for MacOS 10.3.9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory debuggers for MacOS 10.3.9


  • Subject: Re: Memory debuggers for MacOS 10.3.9
  • From: "D. Walsh" <email@hidden>
  • Date: Thu, 27 Oct 2005 06:04:35 -0400
  • Mta-interface: amavisd-new-2.3.3 (20050822) at daleenterprise.com


On Oct 27, 2005, at 04:53 , D. Walsh wrote:


On Oct 27, 2005, at 04:01 , Jonas Maebe wrote:



On 27 Oct 2005, at 00:00, Mark Wagner wrote:



 I don't happen to have access to 10.4, so are there any
memory debuggers that work on 10.3.9?



You could try electric fence, it's similar to GuardMalloc: http://perens.com/FreeSoftware/ElectricFence/

I've never tried it under OS X, but don't see why it wouldn't work.


Jonas


I looked at this before, it doesn't build in Mac OSX unless you comment out line 33 of page.c but then it still failed so digging deeper into the source I determined that it required a switch.


I've since added a configure/makefile wrapper around it to make building easier, I'd pass it along to the author but he never responded so I left it at that.

Here's the session of my attempts to build with failure and success, and yes, it even builds using gcc 4.0.

FAIL:

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make
cc -g -c -o efence.o efence.c
cc -g -c -o page.o page.c
page.c:33: error: conflicting types for `sys_nerr'
/usr/include/stdio.h:273: error: previous declaration of `sys_nerr'
make: *** [page.o] Error 1
mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make clean
rm -f efence.o page.o print.o tstheap.o eftest.o tstheap eftest libefence.a \
libefence.cat ElectricFence.shar
mustangrestomods:/SourceCache/electric-fence-2.1.13 root#





I commented out line 33 of page.c and and added a switch to the make command



SUCCESS:

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# gcc_select
Current default compiler:
gcc version 3.3 20030304 (Apple Computer, Inc. build 1809)
mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make CFLAGS="-g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS"
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o efence.o efence.c
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o page.o page.c
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o print.o print.c
rm -f libefence.a
ar crv libefence.a efence.o page.o print.o
a - efence.o
a - page.o
a - print.o
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o tstheap.o tstheap.c
rm -f tstheap
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS tstheap.o libefence.a -o tstheap -lpthread
ld: warning multiple definitions of symbol _calloc
libefence.a(efence.o) definition of _calloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _calloc
ld: warning multiple definitions of symbol _free
libefence.a(efence.o) definition of _free in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _free
ld: warning multiple definitions of symbol _valloc
libefence.a(efence.o) definition of _valloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _valloc
ld: warning multiple definitions of symbol _malloc
libefence.a(efence.o) definition of _malloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _malloc
ld: warning multiple definitions of symbol _realloc
libefence.a(efence.o) definition of _realloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _realloc
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o eftest.o eftest.c
rm -f eftest
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS eftest.o libefence.a -o eftest -lpthread
ld: warning multiple definitions of symbol _calloc
libefence.a(efence.o) definition of _calloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _calloc
ld: warning multiple definitions of symbol _free
libefence.a(efence.o) definition of _free in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _free
ld: warning multiple definitions of symbol _valloc
libefence.a(efence.o) definition of _valloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _valloc
ld: warning multiple definitions of symbol _malloc
libefence.a(efence.o) definition of _malloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _malloc
ld: warning multiple definitions of symbol _realloc
libefence.a(efence.o) definition of _realloc in section (__TEXT,__text)
/usr/lib/libpthread.dylib(malloc.So) definition of _realloc


Testing Electric Fence.
After the last test, it should print that the test has PASSED.
./eftest

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.
./tstheap 3072

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.

Electric Fence confidence test PASSED.

mustangrestomods:/SourceCache/electric-fence-2.1.13 root#


SUCCESS:

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# gcc_select 4.0
Default compiler has been set to:
gcc version 4.0.0 (Apple Computer, Inc. build 5026)
mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make clean
rm -f efence.o page.o print.o tstheap.o eftest.o tstheap eftest libefence.a \
libefence.cat ElectricFence.shar
mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make CFLAGS="-g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS"
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o efence.o efence.c
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o page.o page.c
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o print.o print.c
rm -f libefence.a
ar crv libefence.a efence.o page.o print.o
a - efence.o
a - page.o
a - print.o
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o tstheap.o tstheap.c
rm -f tstheap
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS tstheap.o libefence.a -o tstheap -lpthread
/usr/bin/ld: warning multiple definitions of symbol _calloc
libefence.a(efence.o) definition of _calloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _calloc
/usr/bin/ld: warning multiple definitions of symbol _free
libefence.a(efence.o) definition of _free in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _free
/usr/bin/ld: warning multiple definitions of symbol _valloc
libefence.a(efence.o) definition of _valloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _valloc
/usr/bin/ld: warning multiple definitions of symbol _malloc
libefence.a(efence.o) definition of _malloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _malloc
/usr/bin/ld: warning multiple definitions of symbol _realloc
libefence.a(efence.o) definition of _realloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _realloc
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS -c -o eftest.o eftest.c
rm -f eftest
cc -g -DPAGE_PROTECTION_VIOLATED_SIGNAL=SIGBUS eftest.o libefence.a -o eftest -lpthread
/usr/bin/ld: warning multiple definitions of symbol _calloc
libefence.a(efence.o) definition of _calloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _calloc
/usr/bin/ld: warning multiple definitions of symbol _free
libefence.a(efence.o) definition of _free in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _free
/usr/bin/ld: warning multiple definitions of symbol _valloc
libefence.a(efence.o) definition of _valloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _valloc
/usr/bin/ld: warning multiple definitions of symbol _malloc
libefence.a(efence.o) definition of _malloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _malloc
/usr/bin/ld: warning multiple definitions of symbol _realloc
libefence.a(efence.o) definition of _realloc in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libpthread.dylib (malloc.So) definition of _realloc


Testing Electric Fence.
After the last test, it should print that the test has PASSED.
./eftest

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.
./tstheap 3072

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.

Electric Fence confidence test PASSED.

mustangrestomods:/SourceCache/electric-fence-2.1.13 root#


I forgot to mention the install commands and generating a shared library that is much easier to use.


As root user and in the efence srouce directory do the following:

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# make LIB_INSTALL_DIR=/usr/local/lib MAN_INSTALL_DIR=/usr/share/man/man3 install

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# cp efence.h /usr/local/include

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# libtool - dynamic -o /usr/local/lib/libefence.2.1.13.dylib -lSystem - compatibility_version 1.0.0 -current_version 1.0.0 -arch_only ppc libefence.a

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# (cd /usr/ local/lib && ln -sf libefence.2.1.13.dylib libefence.dylib)

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# (cd /usr/ local/lib && ln -sf libefence.2.1.13.dylib libefence.2.dylib)


Now to check your work:

mustangrestomods:/SourceCache/electric-fence-2.1.13 root# otool -L / usr/local/lib/libefence.2.1.13.dylib/usr/local/lib/libefence. 2.1.13.dylib:
/usr/local/lib/libefence.2.1.13.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.2.1)
mustangrestomods:/SourceCache/electric-fence-2.1.13 root#



or if you're really looking for the solve-all, use: (my favorite solution for flexibility in 10.3.x and 10.4.x)


using gcc 3.3:
libtool -dynamic -o /usr/local/lib/libefence.2.1.13.dylib -L/usr/lib - framework ApplicationServices -lgcc_s.1 -lcc_dynamic -lSystem_debug - compatibility_version 1.0.0 -current_version 1.0.0 -arch_only ppc libefence.a


using gcc 4.0:
libtool -dynamic -o /usr/local/lib/libefence.2.1.13.dylib -L/usr/lib - framework ApplicationServices -lgcc_s.1 -lSystemStubs_debug - lSystem_debug -compatibility_version 1.0.0 -current_version 1.0.0 - arch_only ppc libefence.a



mustangrestomods:/SourceCache/electric-fence-2.1.13 root# otool -L / usr/local/lib/libefence.2.1.13.dylib/usr/local/lib/libefence. 2.1.13.dylib:
/usr/local/lib/libefence.2.1.13.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/ApplicationServices.framework/ Versions/A/ApplicationServices (compatibility version 1.0.0, current version 22.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.2.1)
mustangrestomods:/SourceCache/electric-fence-2.1.13 root#



-- Dale

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Memory debuggers for MacOS 10.3.9 (From: Mark Wagner <email@hidden>)
 >Re: Memory debuggers for MacOS 10.3.9 (From: Jonas Maebe <email@hidden>)
 >Re: Memory debuggers for MacOS 10.3.9 (From: "D. Walsh" <email@hidden>)

  • Prev by Date: Re: Memory debuggers for MacOS 10.3.9
  • Next by Date: Problem with Header Search Paths at Project level.
  • Previous by thread: Re: Memory debuggers for MacOS 10.3.9
  • Next by thread: Re: Memory debuggers for MacOS 10.3.9
  • Index(es):
    • Date
    • Thread