dwarves icon indicating copy to clipboard operation
dwarves copied to clipboard

die__process_unit: DW_TAG_member (0xd) @ <0x31> not handled!

Open pjonsson opened this issue 2 years ago • 1 comments

The pahole installed in Ubuntu 22.04 LTS (pahole --version says v1.25) can read x86-64/ARM binaries just fine, but fails on MSP430:

$ pahole build/sky/obj/nullframer.o
die__process_unit: DW_TAG_member (0xd) @ <0x31> not handled!
die__process_unit: tag not supported 0xd (member)!
die__process_unit: DW_TAG_member (0xd) @ <0x3f> not handled!
die__process_unit: DW_TAG_member (0xd) @ <0x4d> not handled!
die__process: got compile_unit unexpected tag after DW_TAG_compile_unit!

Same file built for a different target:

$ pahole build/zoul/remote-revb/obj/nullframer.o 
struct framer {
	int                        (*length)(void);      /*     0     4 */
	int                        (*create)(void);      /*     4     4 */
	int                        (*parse)(void);       /*     8     4 */

	/* size: 12, cachelines: 1, members: 3 */
	/* last cacheline: 12 bytes */
};

Attaching the failing object file so the issue can be reproduced without installing an old MSP430-compiler. nullframer.ZIP

pjonsson avatar Aug 03 '23 12:08 pjonsson

Its really strange, the DW_TAG_structure_type after DW_TAG_compile_unit and DW_TAG_member is being skipped somehow by elfutils:

(gdb) run nullframer.o Starting program: /home/acme/bin/pahole nullframer.o [Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 2, die__process (die=0x7fffffffdcd0, cu=0x417bf0, conf=0x4133c0 <conf_load>) at /home/acme/git/pahole/dwarf_loader.c:2823 2823 const uint16_t tag = dwarf_tag(die); (gdb) n 2825 if (tag == DW_TAG_skeleton_unit) { (gdb) p tag $1 = 17 (gdb) p dwarf_tag dwarf_tag dwarf_tag.decl_line dwarf_tag@got[plt] dwarf_tag__decl_file dwarf_tag__set_spec dwarf_tag_name@got[plt] dwarf_tags_warned dwarf_tag.c dwarf_tag.orig_id dwarf_tag@plt dwarf_tag__decl_line dwarf_tag__spec dwarf_tag_name@plt
dwarf_tag.decl_file dwarf_tag.set_spec dwarf_tag[spec] dwarf_tag__orig_id dwarf_tag_name dwarf_tag_names
(gdb) p dwarf_tag_names[17] $2 = 0x7ffff7f89960 "compile_unit" (gdb) n 2836 if (tag == DW_TAG_partial_unit) { (gdb) n 2848 if (tag != DW_TAG_compile_unit && tag != DW_TAG_type_unit) { (gdb) n 2854 cu->language = attr_numeric(die, DW_AT_language); (gdb) n 2856 if (dwarf_child(die, &child) == 0) { (gdb) p cu->language $3 = 1 (gdb) n 2857 int err = die__process_unit(&child, cu, conf); (gdb) s

Breakpoint 1, die__process_unit (die=0x7fffffffdbe0, cu=0x417bf0, conf=0x4133c0 <conf_load>) at /home/acme/git/pahole/dwarf_loader.c:2242 2242 struct tag *tag = die__process_tag(die, cu, 1, conf); (gdb) s __die__process_tag (die=0x7fffffffdbe0, cu=0x417bf0, top_level=1, fn=0x7ffff7f8cac0 <FUNCTION.11> "die__process_unit", conf=0x4133c0 <conf_load>) at /home/acme/git/pahole/dwarf_loader.c:2172 2172 switch (dwarf_tag(die)) { (gdb) p dwarf_tag(die) $4 = 13 (gdb) p dwarf_tag_names[dwarf_tag(die)] $5 = 0x7ffff7f8993d "member" (gdb)

acmel avatar Mar 01 '24 22:03 acmel