[LLVMdev] More DIFactory questions - still stumped
Renato Golin
rengolin at systemcall.org
Sun Sep 5 13:02:21 PDT 2010
On 5 September 2010 19:32, Talin <viridia at gmail.com> wrote:
> I've carefully studied the source code of CGDebugInfo in clang as a working
> example. One puzzlement is that there's a discrepancy between what the
> "source level debugging with LLVM" docs say and what clang does: According
> to the docs, DW_TAG_formal_parameter is used to specify a formal parameter
> in a function type descriptor, but according to a code search, the name
> "DW_TAG_formal_parameter" does not appear anywhere in the clang source code.
> Instead, the argument array that is used when creating a function type
> descriptor contains only the bare types, not types wrapped in a formal
> parameter DIE.
Hi Talin,
Like in CGDebugInfo, you have to use the Subprogram type only for the
return type. What gives you the parameters is passing the Function* as
the last parameter on DIFactory.CreateSubprogram().
I suppose DIFactory was done tailored to C-like languages using Clang
as the primary driver for changes. I'd not be surprised if you could
do things that it didn't expect and then it'd generate images with bad
Dwarf (enough to cause segfault in dwarfdump).
I'd try to mimic exactly what CGDebugInfo does, even if that makes
your "info func" look like C functions in GDB, or if the parameters
are all mixed up. At least you get something out of it and can, then,
work your way to fix it in LLVM.
I'm putting together some help with using DIFactory, maybe I can turn
that into a proper doc. I'll keep you posted.
--
cheers,
--renato
http://systemcall.org/
Reclaim your digital rights, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm
More information about the llvm-dev
mailing list