Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Odd errors, debugger problems and "_cmd" values

Odd errors, debugger problems and "_cmd" values
Thread Tools
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Aug 20, 2001, 04:28 PM
 
Hello,

I just started having some very unusual problems with a program I am writing and the Project Builder debugger. For some reason, the program works fine sometimes and crashes other times. I don't know what could be causing this unpredictable behavior (especially when I get different results with identical data). I decided to step through it and see if anything odd happens to data integrity. The only variable I noticed having any particularly odd behavior was "_cmd". I am not sure what this does so if anyone can help me out there I would be much appreciative.

I also had great difficulty using the debugger since the code refused to execute in a linear fashion. Instead, it would jump forward and back a couple lines each time I used the "step-over" command.

I am completely confused so could someone please help shed some light on this problem?

Thanks,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Aug 20, 2001, 07:56 PM
 
Originally posted by Apocalypse:
<STRONG>The only variable I noticed having any particularly odd behavior was "_cmd". I am not sure what this does so if anyone can help me out there I would be much appreciative.</STRONG>
<font face = "courier">/Developer/Documentation/Cocoa/ObjectiveC</font>
Object-Oriented Programming and the Objective-C Language, page 91:

When the messaging function finds the procedure that implements a method, it calls the procedure and passes it all the arguments in the message. It also passes the procedure two hidden arguments:
  • The receiving object (<font face = "courier">self</font>)
  • The selector for the method (<font face = "courier">_cmd</font>)
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Aug 24, 2001, 02:34 AM
 
Make sure you do a debug build, not a regular build (i.e. the -g option should be passed to cc, and not -O or -O2, which are optimize flags). The compiler can optimize code in very interesting ways, and is totally confusing in the debugger since things seem to execute all out of order, only execute once when you think it should happen multiple times, etc.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:26 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2