[Dwarf-Discuss] How to create multiple CUs in a single creation

David Anderson davea42@earthlink.net
Mon Jul 9 14:18:40 GMT 2012


On 07/09/2012 01:28 AM, Xie Xianshan wrote:
> Hi All,
>
>  I`m trying to generate my own dwarf files with libdwarf API.
> But i don`t know how to create multiple complication units in a single 
> creation.
>  I`ve tried to call dwarf_new_die(dbg,DW_TAG_compile_unit,...) twice,
> but there was only one CU header generated(two DW_TAG_compile_unit 
> tag),as follows:
> ----------------------------
>  Compilation Unit @ 0:
>   Length:        170
>   Version:       2
>   Abbrev Offset: 0
>   Pointer Size:  4
> <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
>     DW_AT_producer    : GNU C 4.6.12
>     DW_AT_name        : test.c
>     DW_AT_comp_dir    : /home/work/
>     DW_AT_ranges      : 0
>     DW_AT_stmt_list   : 0
> <1><34>: Abbrev Number: 2 (DW_TAG_subprogram)
> <0><47>: Abbrev Number: 4 (DW_TAG_compile_unit)
> ----------------------------
> Does anybody  have experience to this?


libdwarf was not designed to prepare multiple CUs in a single creation. 
Sorry.
There is nothing inherent in DWARF or libdwarf preventing such, of course.
And clearly libdwarf needs updating on this point.   But libdwarf cannot do
what you ask in a single  producer dwarf-init call --- at present.

Libdwarf can really only produce DWARF2 output at the moment as well.
Another serious weakness.    While I've been working on the producer
code for some time, progress has been slow, what with other tasks in life.
Again, sorry.

David Anderson


-- 
If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?





More information about the Dwarf-discuss mailing list