Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libgmalloc problem



Hi all.

Hopefully this is the right list to report this problem. 

To debug our SW, we try to use libgmalloc, as described here: 
http://developer.apple.com/technotes/tn2004/tn2124.html
However we encountered troubles with libgmalloc. The following 
simple program is good enough to demonstrate it.


/* problem.c */

#include <stdio.h>

int
main(int argc, char** argv)
{
    int i;
    for(i = 0; i < argc; i++)
        printf("argv[%d]: %s\n", i, argv[i]);
    return 0;
}


The following commands then lead to a crash:

$ gcc -O2 -fomit-frame-pointer problem.c
$ DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib ./a.out foo bar
Allocations will be placed on word (4 byte) boundaries.
 - Small buffer overruns may not be noticed.
 - Applications using AltiVec instructions may fail.
GuardMalloc-11
Segmentation fault (core dumped)

Backtrace from gdb shows:
#0  0x9b1e7882 in GMmalloc ()
#1  0x900f6b7b in localeconv_l ()
#2  0x9000b201 in __vfprintf ()
#3  0x900e3b50 in vfprintf_l ()
#4  0x9001c90f in printf ()
#5  0x00001f8f in main ()

When not using -fomit-frame-pointer or not using libgmalloc, the program
works as expected. 

Our configuration:
- Intel based mac with Mac OS X 10.4.x
- gcc 4.0.1
   
Is it bug in gcc or in libgmalloc, or is it (documented?) limitation of 
libgmalloc? What compiler/linker options can/cannot be used with
libgmalloc?

Any relevant answer or pointer to documentation would be appreciated.

Mity

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.