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

Xie Xianshan xiexs@cn.fujitsu.com
Mon Jul 9 08:28:58 GMT 2012

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 
  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?

Thanks in advance for any advice.

More information about the Dwarf-discuss mailing list