RE: Help debugging an issue...
RE: Help debugging an issue...
- Subject: RE: Help debugging an issue...
- From: "David Spells" <email@hidden>
- Date: Fri, 23 Sep 2005 10:53:16 -0700
- Thread-topic: Help debugging an issue...
Thanks! This is very useful
information.
We did solve the issue. It involved re-creating a static
library project (referenced by the application project) and marking it as
ZeroLink. I'm not sure why this fixes the problem
though.
On 22.09.2005, at 18:49, David Spells wrote:
Hi,
Forgive me if this is a newbie
question.
We have converted a project over to Xcode.
Now and it compiles and links.
However, it crashes even before it gets into our
code.
When I step into the code the stack looks
like this -
dyld_stub_ZN20CConvertFromJsInterC1EPF1PI9CMbObjectES0_I7CmbDictEE
__static_initialization_and_destruction_0
...
then it changes to this
dyld_stub_binding_helper
__static_initialization_and_destruction_0
...
and then dyld_stub_binding_helper jumps to a
location that crashes in such a way that the previous stack frame is
trashed.
The part that is confusing, is that the I see no
reason why this constructor ends up binding something dynamically (I believe
that all the data and methods are local, not in a dynamic
library/framework).
Does anyone have any tips/clues on debugging this
type of issue? At this point I cannot even tell what library/symbol it's
trying to bind.
Firstly, it looks like you misspelled the mangled name - maybe just a typo.
Anyway, you can use the utility program "c++filt" to get the demangled
name. Open Terminal app and type this in the command line:
c++filt -s gnu-v3
_ZN19CConvertFromJsInterC1EPF1PI9CMbObjectES0_I7CmbDictEE
(or whatever your correct symbol looks like. Note: your given symbol can't
be demangled because of a typo)
The output in the console is:
CConvertFromJsInter::CConvertFromJsInter(P<CMbObject>
(*)(P<CmbDict>))
Looks like a constructor.
The constructor is most likely called in a static initialization. Thus,
this happens before the function main gets entered.
Well, the easiest would be to just set a breakpoint at the begin of the
constructor, launching the app in debug mode, then waiting till Xcodes stopps
there, and step forward in order to examine the code and what happens.
Unfortunately, setting a breakpoint in a constructor (and as well in a
destructor) isn't that easy as it looks at the first glance. The reason is,
since the event of the new Itanium ABI (gcc-3.x) the compiler may create up to
three versions of code for the same constructor, each having its own unique
symbol - which is a requirement in order to fullfill the ABI spezifications.
However, due to a "missing feature" (or issue or bug) in gdb - the underlaying
debugger for Xcode - Xcode is unable to break at each of all possible three
versions if you set the breakpoint via Xcode using the "gutter" (column on the
left side of the editor, where you visually set breakpoints). Instead, gdb just
breaks at only one out of three possible versions. You cannot determine
beforehand which one this is.
The workaround is to use gdb via the Xcode's debugger console and set the
possible three breakpoints "manually" using gdb commands. In your case, the
three code versions of the one constructor
CConvertFromJsInter::CConvertFromJsInter(P<CMbObject>
(*)(P<CmbDict>))
would be named as
_ZN19CConvertFromJsInterC1EPF1PI9CMbObjectES0_I7CmbDictEE
_ZN19CConvertFromJsInterC2EPF1PI9CMbObjectES0_I7CmbDictEE
_ZN19CConvertFromJsInterC3EPF1PI9CMbObjectES0_I7CmbDictEE
Notice the differentiation of the thee versions via the C1, C2 and C3 tags
in the symbol.
Then you should set a breakpoint in each of this function. Note, that it
might be possible that the version C3 does not exist, and in some cases even C2.
In your case, it is the C1 version which is selected by the compiler in the
static initialization, and you need to set (at least) a breakpoint in version
C1.
I would recommend you the use the gdb console and type "help" to get
familiar with gdb. Especially you need to know how to set and remove a
breakpoint in a function when you know the name.
Basically, its easy: In the gdb console, type:
break _ZN19CConvertFromJsInterC1EPF1PI9CMbObjectES0_I7CmbDictEE
This will set a breakpoint at the start of the constructor - here
the version C1.
good luck ;-)
Andreas
Thanks,
David Spells
Fireworks Engineering Manager
1500 North Greenville, Suite 500
Richardson, TX 75081
Phone: (214) 774-1932
Cell: (214) 395-3482
Fax: (214) 575-3288
mailto: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: