Re: Debugger doesn't stop in template method?
Re: Debugger doesn't stop in template method?
- Subject: Re: Debugger doesn't stop in template method?
- From: Andreas Grosam <email@hidden>
- Date: Wed, 14 Jan 2004 08:54:05 +0100
On 14.01.2004, at 03:27, Kevin Grant wrote:
I have a template class. . . . .
If I set a breakpoint inside that function the debugger doesn't stop.
(It doesn't warn me in the console that it couldn't set the
breakpoint either.)
The file does have debug info - if I stop in doSomething I can step
until it exits and back up into Foo::Bar.
Is this a known problem? Is there a workaround? (Do I need to build a
sample project that shows the problem and write up a radar issue?)
I can see why it might not allow this; a template has no real code
until it is instantiated, so there are an infinite number of
breakpoints you could be asking for. Theoretically the IDE could
figure out all the ways you've ever instantiated that template and ask
you which instance you want the breakpoint in, but I've never seen
anything that does this.
There is. For instance, look at CW - where it works correctly (mostly).
In XCode, this actually does not work. My experience is, that only
within the *first* instantiation the break point will be set. If there
are other instantiations, the break point will not be set there.
(Please ensure too, that the code has not been inlined!!)
The way it *could* work: let the user define a break point in a
template source as usual; after compiling, before the debugger starts,
the IDE shall *instantiate break points* by associating the source line
with all the corresponding code locations.
After linking (or when the IDE knows all the instantiations), the break
point indicator switches to a popup when there are more than one
instantiations. Within the popup all instantiations are listed and you
can select/deselect a break point for a certain instantiation by
showing a mark near the entry.
As you mentioned, this is feasible and I would be glad if Apple would
implement it.
Instead, you'll have to find a place where the template is actually
used, and use breakpoints there.
(The question is: how? Before the call of the template in a
non-template code? What if we have only template code?)
Or, use other debugging techniques within the code in the template.
Means, step in manually.
Or, if you create template specializations (that is, code that is
unique when a template is instantiated in a particular way), perhaps
you can set a breakpoint in the specialized template code because it
should be sufficiently unique.
IMO, this is only a workaround - and can only be accepted until XCode
is still alpha. The impact of "workaround source" is just too big.
Regards
Andreas Grosam
Kevin G.
http://homepage.mac.com/kmg/
mail to kevin at ieee dot org
_______________________________________________
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.
_______________________________________________
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.