• 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
Setting a breakpoint on malloc_printf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting a breakpoint on malloc_printf


  • Subject: Setting a breakpoint on malloc_printf
  • From: Justin Greenfield <email@hidden>
  • Date: Tue, 24 Feb 2004 10:20:53 -0600

I've got a terribly insidious memory smashing bug in a multi-threaded app that I am trying to track down. I have been beating my head on this for much, much too long now. I am beyond desperate and I my progress has slowed to a crawl.

From the MallocDebug help:

Tracking down stale pointers and writes to freed memory

The second example -- holding on to an out of date pointer -- can also be detected using MallocDebug. MallocDebug finds writes to freed memory by erasing memory when it is freed, overwriting the contents of the buffer with the hexadecimal value 0x55. MallocDebug then watches for changes to that memory on each call to free. When it finds memory has been smashed, it prints a warning to the console:

MallocDebug: target application recently wrote to freed malloc'd memory at: 0x194f808, suggesting it didn't realize the memory had been freed

This shows that a memory smasher exists; by putting a break point on malloc_printf, the function that prints the error, you can find what point in your code might be near the smash.


My problem is, I absolutely cannot cause a breakpoint to fire on malloc_printf when I get these errors printed. I am on 10.3 using xcode 1.1. I tried going to the breakpoints window, clicking "New breakpoint" and entering "malloc_printf" but it never fires. I started gdb in a terminal window and tried "fb malloc_printf" and it never fires.


If anybody has the slightest idea what to do differently to find this bug, I would be eternally grateful. I have run out of ideas and options.

Justin
_______________________________________________
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.

  • Follow-Ups:
    • Re: Setting a breakpoint on malloc_printf
      • From: Jim Ingham <email@hidden>
  • Prev by Date: Re: CVS Fixes
  • Next by Date: Hiding a warning?
  • Previous by thread: Link errors without zerolink option
  • Next by thread: Re: Setting a breakpoint on malloc_printf
  • Index(es):
    • Date
    • Thread