• 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: Possible GCC Bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible GCC Bug?


  • Subject: Re: Possible GCC Bug?
  • From: "B.J. Buchalter" <email@hidden>
  • Date: Tue, 8 Apr 2008 16:19:55 -0400


On Apr 8, 2008, at 12:53 PM, Jack Repenning wrote:

On Apr 8, 2008, at 9:31 AM, Greg Knight wrote:
I've been away from 'C' for over ten years, and just come back to port a legacy app to the MAC. The following code is misbehaving under the XCode 3.0 Debug configuration (GCC4). I'd appreciate any suggestions.

// int fred has value 13
DisposeWindow(WinData->window);    // Carbon call
// int fred now has value 27

Possible, but vastly more likely the code has a heretofore undiscovered memory management bug. Check the documentation for "Guard Malloc" in Xcode (open documentation window, search for guard malloc; probably start with the "Memory Usage Performance Guidelines" document, page "Enabling the Malloc Debugging Features"). Then use Xcode's "Enable Guard Malloc" menu pick (in Run), and see what you can find.


You might also check whatever comes just before fred, and whatever comes just after it, wherever it is fred is declared, to see if they're getting trounced as well.

I don't think GaurdMalloc will help much here, but using the Xcode/GDB "watch variable" command (to enable a watchpoint) will. Set a watchpoint on "fred" and Xcode will stop in the debugger on the precise machine instruction that changes "fred".


Very cool.

B.J. Buchalter
Metric Halo
http://www.mhlabs.com
	


_______________________________________________ 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
  • Follow-Ups:
    • Re: Possible GCC Bug?
      • From: Jack Repenning <email@hidden>
References: 
 >Possible GCC Bug? (From: "Greg Knight" <email@hidden>)
 >Re: Possible GCC Bug? (From: Jack Repenning <email@hidden>)

  • Prev by Date: Re: Target Info: Build: Why sometimes sections of GCC settings?
  • Next by Date: Re: app not starting from xcode
  • Previous by thread: Re: Possible GCC Bug?
  • Next by thread: Re: Possible GCC Bug?
  • Index(es):
    • Date
    • Thread