dwarf_loader: DW_TAG_subroutine_type may have a DW_AT_byte_size

First seen in Go, where DW_TAG_member don't come with a DW_AT_byte_size,
so we need to figure it out from its type using tag__byte_size() in
class_member__cache_byte_size() so either use the DW_AT_byte size that
comes in DW_TAG_subroutine_type or the cu->addr_size to use the pointer
size.

With this we manage to pretty print this Go class:

  $ pahole -C runtime._type ../prometheus-uprobes/main
  struct runtime._type {
  	uintptr                    size;                 /*     0     8 */
  	uintptr                    ptrdata;              /*     8     8 */
  	uint32                     hash;                 /*    16     4 */
  	runtime.tflag              tflag;                /*    20     1 */
  	uint8                      align;                /*    21     1 */
  	uint8                      fieldAlign;           /*    22     1 */
  	uint8                      kind;                 /*    23     1 */
  	func(unsafe.Pointer, unsafe.Pointer) bool equal; /*    24     8 */
  	uint8 *                    gcdata;               /*    32     8 */
  	runtime.nameOff            str;                  /*    40     4 */
  	runtime.typeOff            ptrToThis;            /*    44     4 */

  	/* size: 48, cachelines: 1, members: 11 */
  	/* last cacheline: 48 bytes */
  };

At some point we should select how to pretty print this, with a Go
formatter and the above C one :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
3 files changed