• 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
problem debugging scripting addition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem debugging scripting addition


  • Subject: problem debugging scripting addition
  • From: Nigel Redmon <email@hidden>
  • Date: Mon, 26 Mar 2007 17:41:49 -0700

I'm writing a scripting addition, and seeing problems when stepping through the code. I don't think it has anything to do with the code itself--I've noticed that "skeleton addition" from TN1164 exhibits the same quirks. It's setup for debugging, and I just run it "out of the box" with similar problems.

I build my scripting addition, copy it to ~/Library/ ScriptingAdditions, set breakpoints, and debug executable. Script Editor is the custom executable. I can break on the scripting addition's start code, or set breakpoints in my commands, and I break into the debugger, but the "current line" that the source pane shows may be a line after a breakpoint, and sometimes appears to have skipped breakpoints ahead of it. When I look at the assembly listing, it's obvious that the source isn't in sync. Stepping through the code at that point may jump back to statements before it in the source pane (the assembly pane steps through fine, of course). For example, say I set a breakpoint on the fifth executable line of a subroutine. it may appear to break into the debugger on that line, but the assembly listing indicates that I'm well before the indicated current source line. If I "step over", the current source line may back up a few statements, and subsequent steps seem to jump around in the source, maybe getting to my breakpoint statement two or three times until it's "really" there (that is, the current position in the assembly pane agrees with the current position in the source pane).

The synchronization seems to be better as the routine goes on (that is, something like the skeleton addition, which has little code per subroutine never really gets in sync, but a more sizable subroutine can be more usefully debugged once you get a number of lines into it. (Though I've noticed some sync problem well into a routine, especially in things like "for" loops, where I should be stepping to the next statement, and instead the debugger thinks I'm outside of it and some variables I'd like to look at are unexpectedly "out of scope".)

The problem isn't stale code (I'm sure that I'm really debugging the executable that corresponds to the project's source code), it doesn't seem to have anything to do with optimizations messing up the stepping synchronization), and I don't think it has anything to do with zero link (not even sure that's a potential problem).

I've rechecked debugging on simple applications under Xcode, and they step just fine. (I'm using the latest Xcode, OS X 10.4.9 , PowerMac G5 quad.)

Here's an example--I inserted a few do-nothing lines of code into the skeleton addition event handler. On the left, I've inserted the execution order of the lines as they appear in the source pane. I set a breakpoint on the first line, and it stops there (1). I "step over", and it goes to (2), step again (3), etc. The assembly listing looks fine during the process (the execution there proceeds as you would expect).


OSErr MyEventHandler(const AppleEvent *ev, AppleEvent *reply, long refcon)
{
1 3 ++gAdditionReferenceCount; // increment the reference count first thing!


            // Go do that voodoo that you do so well...

2 4 if (gAdditionReferenceCount > 1000)
gAdditionReferenceCount -= 5;
5 7 if (gAdditionReferenceCount > 2000)
6 return gAdditionReferenceCount;

8 --gAdditionReferenceCount; // don't forget to decrement the reference count when you leave!


            return noErr;
9    }


I'm wondering if I'm missing something obvious, or if there is a known problem. I've had no problems stepping through other kinds of programs. :-/


Thanks

_______________________________________________
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: problem debugging scripting addition
      • From: Nigel Redmon <email@hidden>
    • Re: problem debugging scripting addition
      • From: "Mark Wagner" <email@hidden>
  • Prev by Date: Re: Argument list too long error
  • Next by Date: Re: Why are Xcode "updates" so friggin' big??
  • Previous by thread: Re: Argument list too long error
  • Next by thread: Re: problem debugging scripting addition
  • Index(es):
    • Date
    • Thread