dwarf_loader: Ignore DW_TAG_variant_part for now to fix a segfault

[simple.debug.gz](https://github.com/acmel/dwarves/files/5257290/simple.debug.gz)

Simple.debug, a rust executable:
```
$ ~/dwarves/build/pahole simple.debug
die__process_function: tag not supported 0x2f (template_type_parameter)!
die__process_class: DW_TAG_variant_part (0x33) @ <0x220> not handled!
Segmentation fault (core dumped)

Added a XXX for looking into DW_TAG_variant_part later, with that:

  $ pahole examples/rust/simple.debug
  die__process_function: tag not supported 0x2f (template_type_parameter)!
  die__process_class: tag not supported 0x33 (variant_part)!
  die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2da3> not handled!
  struct (core::ptr::non_null::NonNull<u8>, core::alloc::layout::Layout) {
  	struct NonNull<u8>         __0 __attribute__((__aligned__(8))); /*     0     8 */
  	struct Layout              __1 __attribute__((__aligned__(8))); /*     8    16 */

  	/* size: 24, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 24 bytes */
  } __attribute__((__aligned__(8)));
  struct vtable {

  	/* size: 0, cachelines: 0, members: 0 */
  } __attribute__((__aligned__(8)));
  struct (&usize, &usize) {
  	usize *                    __0 __attribute__((__aligned__(8))); /*     0     8 */
  	usize *                    __1 __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &str {
  	u8 *                       data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct *const [u8] {
  	u8 *                       data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct *const [i32] {
  	i32 *                      data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct *mut [u8] {
  	u8 *                       data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &[u8] {
  	u8 *                       data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct (i32, f64) {
  	i32                        __0 __attribute__((__aligned__(4))); /*     0     4 */

  	/* XXX 4 bytes hole, try to pack */

  	f64                        __1 __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* sum members: 12, holes: 1, sum holes: 4 */
  	/* forced alignments: 2, forced holes: 1, sum forced holes: 4 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &[i32] {
  	i32 *                      data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &mut [u8] {
  	u8 *                       data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &[&str] {
  	struct &str *              data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &[core::fmt::rt::v1::Argument] {
  	struct Argument *          data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct &[core::fmt::ArgumentV1] {
  	struct ArgumentV1 *        data_ptr __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      length __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct Opaque {

  	/* size: 0, cachelines: 0, members: 0 */
  } __attribute__((__aligned__(1)));
  struct (usize, usize) {
  	usize                      __0 __attribute__((__aligned__(8))); /*     0     8 */
  	usize                      __1 __attribute__((__aligned__(8))); /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct (core::alloc::layout::Layout, usize) {
  	struct Layout              __0 __attribute__((__aligned__(8))); /*     0    16 */
  	usize                      __1 __attribute__((__aligned__(8))); /*    16     8 */

  	/* size: 24, cachelines: 1, members: 2 */
  	/* forced alignments: 2 */
  	/* last cacheline: 24 bytes */
  } __attribute__((__aligned__(8)));
  struct (usize, bool) {
  	usize                      __0 __attribute__((__aligned__(8))); /*     0     8 */
  	bool                       __1 __attribute__((__aligned__(1))); /*     8     1 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* padding: 7 */
  	/* forced alignments: 2 */
  	/* last cacheline: 16 bytes */
  } __attribute__((__aligned__(8)));
  struct backtrace_state {
  	const char  *              filename;             /*     0     8 */
  	int                        threaded;             /*     8     4 */

  	/* XXX 4 bytes hole, try to pack */

  	void *                     lock;                 /*    16     8 */
  	fileline                   fileline_fn;          /*    24     8 */
  	void *                     fileline_data;        /*    32     8 */
  	syminfo                    syminfo_fn;           /*    40     8 */
  	void *                     syminfo_data;         /*    48     8 */
  	int                        fileline_initialization_failed; /*    56     4 */
  	int                        lock_alloc;           /*    60     4 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	struct backtrace_freelist_struct * freelist;     /*    64     8 */

  	/* size: 72, cachelines: 2, members: 10 */
  	/* sum members: 68, holes: 1, sum holes: 4 */
  	/* last cacheline: 8 bytes */
  };
  struct timespec {
  	__time_t                   tv_sec;               /*     0     8 */
  	__syscall_slong_t          tv_nsec;              /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* last cacheline: 16 bytes */
  };
  struct stat {
  	__dev_t                    st_dev;               /*     0     8 */
  	__ino_t                    st_ino;               /*     8     8 */
  	__nlink_t                  st_nlink;             /*    16     8 */
  	__mode_t                   st_mode;              /*    24     4 */
  	__uid_t                    st_uid;               /*    28     4 */
  	__gid_t                    st_gid;               /*    32     4 */
  	int                        __pad0;               /*    36     4 */
  	__dev_t                    st_rdev;              /*    40     8 */
  	__off_t                    st_size;              /*    48     8 */
  	__blksize_t                st_blksize;           /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	__blkcnt_t                 st_blocks;            /*    64     8 */
  	struct timespec            st_atim;              /*    72    16 */
  	struct timespec            st_mtim;              /*    88    16 */
  	struct timespec            st_ctim;              /*   104    16 */
  	__syscall_slong_t          __glibc_reserved[3];  /*   120    24 */

  	/* size: 144, cachelines: 3, members: 15 */
  	/* last cacheline: 16 bytes */
  };
  struct dl_phdr_info {
  	Elf64_Addr                 dlpi_addr;            /*     0     8 */
  	const char  *              dlpi_name;            /*     8     8 */
  	const Elf64_Phdr  *        dlpi_phdr;            /*    16     8 */
  	Elf64_Half                 dlpi_phnum;           /*    24     2 */

  	/* XXX 6 bytes hole, try to pack */

  	long long unsigned int     dlpi_adds;            /*    32     8 */
  	long long unsigned int     dlpi_subs;            /*    40     8 */
  	size_t                     dlpi_tls_modid;       /*    48     8 */
  	void *                     dlpi_tls_data;        /*    56     8 */

  	/* size: 64, cachelines: 1, members: 8 */
  	/* sum members: 58, holes: 1, sum holes: 6 */
  };
  struct backtrace_view {
  	const void  *              data;                 /*     0     8 */
  	void *                     base;                 /*     8     8 */
  	size_t                     len;                  /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct dwarf_sections {
  	const unsigned char  *     data[9];              /*     0    72 */
  	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
  	size_t                     size[9];              /*    72    72 */

  	/* size: 144, cachelines: 3, members: 2 */
  	/* last cacheline: 16 bytes */
  };
  struct debug_section_info {
  	off_t                      offset;               /*     0     8 */
  	size_t                     size;                 /*     8     8 */
  	const unsigned char  *     data;                 /*    16     8 */
  	int                        compressed;           /*    24     4 */

  	/* size: 32, cachelines: 1, members: 4 */
  	/* padding: 4 */
  	/* last cacheline: 32 bytes */
  };
  struct elf_symbol {
  	const char  *              name;                 /*     0     8 */
  	uintptr_t                  address;              /*     8     8 */
  	size_t                     size;                 /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct elf_syminfo_data {
  	struct elf_syminfo_data *  next;                 /*     0     8 */
  	struct elf_symbol *        symbols;              /*     8     8 */
  	size_t                     count;                /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct elf_ppc64_opd_data {
  	b_elf_addr                 addr;                 /*     0     8 */
  	const char  *              data;                 /*     8     8 */
  	size_t                     size;                 /*    16     8 */
  	struct backtrace_view      view;                 /*    24    24 */

  	/* size: 48, cachelines: 1, members: 4 */
  	/* last cacheline: 48 bytes */
  };
  struct phdr_data {
  	struct backtrace_state *   state;                /*     0     8 */
  	backtrace_error_callback   error_callback;       /*     8     8 */
  	void *                     data;                 /*    16     8 */
  	fileline *                 fileline_fn;          /*    24     8 */
  	int *                      found_sym;            /*    32     8 */
  	int *                      found_dwarf;          /*    40     8 */
  	const char  *              exe_filename;         /*    48     8 */
  	int                        exe_descriptor;       /*    56     4 */

  	/* size: 64, cachelines: 1, members: 8 */
  	/* padding: 4 */
  };
  struct backtrace_vector {
  	void *                     base;                 /*     0     8 */
  	size_t                     size;                 /*     8     8 */
  	size_t                     alc;                  /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct dwarf_buf {
  	const char  *              name;                 /*     0     8 */
  	const unsigned char  *     start;                /*     8     8 */
  	const unsigned char  *     buf;                  /*    16     8 */
  	size_t                     left;                 /*    24     8 */
  	int                        is_bigendian;         /*    32     4 */

  	/* XXX 4 bytes hole, try to pack */

  	backtrace_error_callback   error_callback;       /*    40     8 */
  	void *                     data;                 /*    48     8 */
  	int                        reported_underflow;   /*    56     4 */

  	/* size: 64, cachelines: 1, members: 8 */
  	/* sum members: 56, holes: 1, sum holes: 4 */
  	/* padding: 4 */
  };
  struct attr {
  	enum dwarf_attribute       name;                 /*     0     4 */
  	enum dwarf_form            form;                 /*     4     4 */
  	int64_t                    val;                  /*     8     8 */

  	/* size: 16, cachelines: 1, members: 3 */
  	/* last cacheline: 16 bytes */
  };
  struct abbrev {
  	uint64_t                   code;                 /*     0     8 */
  	enum dwarf_tag             tag;                  /*     8     4 */
  	int                        has_children;         /*    12     4 */
  	size_t                     num_attrs;            /*    16     8 */
  	struct attr *              attrs;                /*    24     8 */

  	/* size: 32, cachelines: 1, members: 5 */
  	/* last cacheline: 32 bytes */
  };
  struct abbrevs {
  	size_t                     num_abbrevs;          /*     0     8 */
  	struct abbrev *            abbrevs;              /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* last cacheline: 16 bytes */
  };
  struct attr_val {
  	enum attr_val_encoding     encoding;             /*     0     4 */

  	/* XXX 4 bytes hole, try to pack */

  	union {
  		uint64_t           uint;                 /*     8     8 */
  		int64_t            sint;                 /*     8     8 */
  		const char  *      string;               /*     8     8 */
  	} u;                                             /*     8     8 */

  	/* size: 16, cachelines: 1, members: 2 */
  	/* sum members: 12, holes: 1, sum holes: 4 */
  	/* last cacheline: 16 bytes */
  };
  struct line_header {
  	int                        version;              /*     0     4 */
  	int                        addrsize;             /*     4     4 */
  	unsigned int               min_insn_len;         /*     8     4 */
  	unsigned int               max_ops_per_insn;     /*    12     4 */
  	int                        line_base;            /*    16     4 */
  	unsigned int               line_range;           /*    20     4 */
  	unsigned int               opcode_base;          /*    24     4 */

  	/* XXX 4 bytes hole, try to pack */

  	const unsigned char  *     opcode_lengths;       /*    32     8 */
  	size_t                     dirs_count;           /*    40     8 */
  	const char  * *            dirs;                 /*    48     8 */
  	size_t                     filenames_count;      /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	const char  * *            filenames;            /*    64     8 */

  	/* size: 72, cachelines: 2, members: 12 */
  	/* sum members: 68, holes: 1, sum holes: 4 */
  	/* last cacheline: 8 bytes */
  };
  struct line_header_format {
  	int                        lnct;                 /*     0     4 */
  	enum dwarf_form            form;                 /*     4     4 */

  	/* size: 8, cachelines: 1, members: 2 */
  	/* last cacheline: 8 bytes */
  };
  struct line {
  	uintptr_t                  pc;                   /*     0     8 */
  	const char  *              filename;             /*     8     8 */
  	int                        lineno;               /*    16     4 */
  	int                        idx;                  /*    20     4 */

  	/* size: 24, cachelines: 1, members: 4 */
  	/* last cacheline: 24 bytes */
  };
  struct line_vector {
  	struct backtrace_vector    vec;                  /*     0    24 */
  	size_t                     count;                /*    24     8 */

  	/* size: 32, cachelines: 1, members: 2 */
  	/* last cacheline: 32 bytes */
  };
  struct function {
  	const char  *              name;                 /*     0     8 */
  	const char  *              caller_filename;      /*     8     8 */
  	int                        caller_lineno;        /*    16     4 */

  	/* XXX 4 bytes hole, try to pack */

  	struct function_addrs *    function_addrs;       /*    24     8 */
  	size_t                     function_addrs_count; /*    32     8 */

  	/* size: 40, cachelines: 1, members: 5 */
  	/* sum members: 36, holes: 1, sum holes: 4 */
  	/* last cacheline: 40 bytes */
  };
  struct function_addrs {
  	uint64_t                   low;                  /*     0     8 */
  	uint64_t                   high;                 /*     8     8 */
  	struct function *          function;             /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct function_vector {
  	struct backtrace_vector    vec;                  /*     0    24 */
  	size_t                     count;                /*    24     8 */

  	/* size: 32, cachelines: 1, members: 2 */
  	/* last cacheline: 32 bytes */
  };
  struct unit {
  	const unsigned char  *     unit_data;            /*     0     8 */
  	size_t                     unit_data_len;        /*     8     8 */
  	size_t                     unit_data_offset;     /*    16     8 */
  	size_t                     low_offset;           /*    24     8 */
  	size_t                     high_offset;          /*    32     8 */
  	int                        version;              /*    40     4 */
  	int                        is_dwarf64;           /*    44     4 */
  	int                        addrsize;             /*    48     4 */

  	/* XXX 4 bytes hole, try to pack */

  	off_t                      lineoff;              /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	uint64_t                   str_offsets_base;     /*    64     8 */
  	uint64_t                   addr_base;            /*    72     8 */
  	uint64_t                   rnglists_base;        /*    80     8 */
  	const char  *              filename;             /*    88     8 */
  	const char  *              comp_dir;             /*    96     8 */
  	const char  *              abs_filename;         /*   104     8 */
  	struct abbrevs             abbrevs;              /*   112    16 */
  	/* --- cacheline 2 boundary (128 bytes) --- */
  	struct line *              lines;                /*   128     8 */
  	size_t                     lines_count;          /*   136     8 */
  	struct function_addrs *    function_addrs;       /*   144     8 */
  	size_t                     function_addrs_count; /*   152     8 */

  	/* size: 160, cachelines: 3, members: 20 */
  	/* sum members: 156, holes: 1, sum holes: 4 */
  	/* last cacheline: 32 bytes */
  };
  struct unit_addrs {
  	uint64_t                   low;                  /*     0     8 */
  	uint64_t                   high;                 /*     8     8 */
  	struct unit *              u;                    /*    16     8 */

  	/* size: 24, cachelines: 1, members: 3 */
  	/* last cacheline: 24 bytes */
  };
  struct unit_addrs_vector {
  	struct backtrace_vector    vec;                  /*     0    24 */
  	size_t                     count;                /*    24     8 */

  	/* size: 32, cachelines: 1, members: 2 */
  	/* last cacheline: 32 bytes */
  };
  struct unit_vector {
  	struct backtrace_vector    vec;                  /*     0    24 */
  	size_t                     count;                /*    24     8 */

  	/* size: 32, cachelines: 1, members: 2 */
  	/* last cacheline: 32 bytes */
  };
  struct dwarf_data {
  	struct dwarf_data *        next;                 /*     0     8 */
  	struct dwarf_data *        altlink;              /*     8     8 */
  	uintptr_t                  base_address;         /*    16     8 */
  	struct unit_addrs *        addrs;                /*    24     8 */
  	size_t                     addrs_count;          /*    32     8 */
  	struct unit * *            units;                /*    40     8 */
  	size_t                     units_count;          /*    48     8 */
  	struct dwarf_sections      dwarf_sections;       /*    56   144 */
  	/* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
  	int                        is_bigendian;         /*   200     4 */

  	/* XXX 4 bytes hole, try to pack */

  	struct function_vector     fvec;                 /*   208    32 */

  	/* size: 240, cachelines: 4, members: 10 */
  	/* sum members: 236, holes: 1, sum holes: 4 */
  	/* last cacheline: 48 bytes */
  };
  struct pcrange {
  	uint64_t                   lowpc;                /*     0     8 */
  	int                        have_lowpc;           /*     8     4 */
  	int                        lowpc_is_addr_index;  /*    12     4 */
  	uint64_t                   highpc;               /*    16     8 */
  	int                        have_highpc;          /*    24     4 */
  	int                        highpc_is_relative;   /*    28     4 */
  	int                        highpc_is_addr_index; /*    32     4 */

  	/* XXX 4 bytes hole, try to pack */

  	uint64_t                   ranges;               /*    40     8 */
  	int                        have_ranges;          /*    48     4 */
  	int                        ranges_is_index;      /*    52     4 */

  	/* size: 56, cachelines: 1, members: 10 */
  	/* sum members: 52, holes: 1, sum holes: 4 */
  	/* last cacheline: 56 bytes */
  };
  struct stat64 {
  	__dev_t                    st_dev;               /*     0     8 */
  	__ino64_t                  st_ino;               /*     8     8 */
  	__nlink_t                  st_nlink;             /*    16     8 */
  	__mode_t                   st_mode;              /*    24     4 */
  	__uid_t                    st_uid;               /*    28     4 */
  	__gid_t                    st_gid;               /*    32     4 */
  	int                        __pad0;               /*    36     4 */
  	__dev_t                    st_rdev;              /*    40     8 */
  	__off_t                    st_size;              /*    48     8 */
  	__blksize_t                st_blksize;           /*    56     8 */
  	/* --- cacheline 1 boundary (64 bytes) --- */
  	__blkcnt64_t               st_blocks;            /*    64     8 */
  	struct timespec            st_atim;              /*    72    16 */
  	struct timespec            st_mtim;              /*    88    16 */
  	struct timespec            st_ctim;              /*   104    16 */
  	__syscall_slong_t          __glibc_reserved[3];  /*   120    24 */

  	/* size: 144, cachelines: 3, members: 15 */
  	/* last cacheline: 16 bytes */
  };

Reported-by: Tom de Vries
Bugtracker: https://github.com/acmel/dwarves/issues/9#issuecomment-696277814
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed