Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: gdb@sources.redhat.com, gcc@gcc.gnu.org, rth@redhat.com
Cc: Elena Zannoni <ezannoni@redhat.com>
Subject: rfc: DW_AT_vector
Date: Thu, 21 Feb 2002 20:10:00 -0000	[thread overview]
Message-ID: <20020222041007.GA2446@redhat.com> (raw)

hullo.

it was brought to my attention that the dwarf2 information emitted
by gcc for vector types is an array of ints/floats within a structure.

this causes problems for gdb because vectors and structures may have
different calling conventions.  for example, in altivec, vectors
go in registers and get returned in registers.  this may not necessarily
be true for structures on the same platform so gdb is unable to get
the correct information.

richard suggested:

  I suppose we could invent either (1) a DW_AT_vector flag to go along
  with the current struct-of-array-of representation or (2) a new
  DW_TAG_vector_type, which looks cleaner but wouldn't work at all with
  older gdb or other debuggers.

i am completely clueless in all this, having never heard of DW_AT_
or DW_TAG_ until about 30 minutes ago.  but of course, that doesn't
keep me from coming up with a patch which i obviously think is correct. :)

i suggest coming up with a DW_AT_vector flag to go along with the
structure business.  this will work with any debugger, and will not
break any type of compatibility.  then gdb can be tweaked to look for
the right values if a structure has a vector tag as well.

of course, i'm willing to volunteer to code the DW_TAG_vector_type
stuff, but only as a last and painful resort :).

here is a proof of concept patch for gcc, gdb, binutils, etc.

comments?

2002-02-22  Aldy Hernandez  <aldyh@redhat.com>

	* gdb/dwarf2read.c (dwarf_attr_name): Add case for DW_AT_vector.

	* include/elf/dwarf2.h (dwarf_attribute): Add DW_AT_vector.

	* binutils/readelf.c (get_AT_name): Add case for DW_AT_vector.

	* dwarf2.h (dwarf_attribute): Add DW_AT_vector.

	* dwarf2out.c (gen_struct_or_union_type_die): Add vector tag.
	(dwarf_attr_name): Add case for DW_AT_vector.

Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/uberbaum/gcc/dwarf2out.c,v
retrieving revision 1.353
diff -c -p -r1.353 dwarf2out.c
*** dwarf2out.c	2002/01/30 00:19:23	1.353
--- dwarf2out.c	2002/02/22 03:39:41
*************** dwarf_attr_name (attr)
*** 4164,4169 ****
--- 4164,4171 ----
        return "DW_AT_body_begin";
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_vector:
+       return "DW_AT_vector";
      case DW_AT_VMS_rtnbeg_pd_address:
        return "DW_AT_VMS_rtnbeg_pd_address";
  
*************** gen_struct_or_union_type_die (type, cont
*** 10888,10893 ****
--- 10890,10897 ----
  	  && ! decl_function_context (TYPE_STUB_DECL (type)))
  	VARRAY_PUSH_TREE (incomplete_types, type);
      }
+   if (TREE_CODE (type) == VECTOR_TYPE)
+     add_AT_flag (type_die, DW_AT_vector, 1);
  }
  
  /* Generate a DIE for a subroutine _type_.  */
Index: gcc/dwarf2.h
===================================================================
RCS file: /cvs/uberbaum/gcc/dwarf2.h,v
retrieving revision 1.22
diff -c -p -r1.22 dwarf2.h
*** dwarf2.h	2002/01/28 23:23:26	1.22
--- dwarf2.h	2002/02/22 03:39:41
*************** enum dwarf_attribute
*** 239,244 ****
--- 239,245 ----
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
      DW_AT_body_end   = 0x2106,
+     DW_AT_vector     = 0x2107,
      /* VMS Extensions.  */
      DW_AT_VMS_rtnbeg_pd_address = 0x2201
    };
Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/uberbaum/gdb/dwarf2read.c,v
retrieving revision 1.48
diff -c -p -r1.48 dwarf2read.c
*** dwarf2read.c	2002/02/15 22:42:33	1.48
--- dwarf2read.c	2002/02/22 03:39:43
*************** dwarf_attr_name (register unsigned attr)
*** 5161,5166 ****
--- 5161,5168 ----
        return "DW_AT_body_begin";
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_vector:
+       return "DW_AT_vector";
      default:
        return "DW_AT_<unknown>";
      }
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/uberbaum/binutils/readelf.c,v
retrieving revision 1.151
diff -c -p -r1.151 readelf.c
*** readelf.c	2002/02/13 18:14:42	1.151
--- readelf.c	2002/02/22 03:39:46
*************** get_AT_name (attribute)
*** 6455,6460 ****
--- 6455,6461 ----
      case DW_AT_src_coords:           return "DW_AT_src_coords";
      case DW_AT_body_begin:           return "DW_AT_body_begin";
      case DW_AT_body_end:             return "DW_AT_body_end";
+     case DW_AT_vector:               return "DW_AT_vector";
      default:
        {
  	static char buffer [100];
Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/uberbaum/gcc/dwarf2out.c,v
retrieving revision 1.353
diff -c -p -r1.353 dwarf2out.c
*** dwarf2out.c	2002/01/30 00:19:23	1.353
--- dwarf2out.c	2002/02/22 03:40:26
*************** dwarf_attr_name (attr)
*** 4164,4169 ****
--- 4164,4171 ----
        return "DW_AT_body_begin";
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_vector:
+       return "DW_AT_vector";
      case DW_AT_VMS_rtnbeg_pd_address:
        return "DW_AT_VMS_rtnbeg_pd_address";
  
*************** gen_struct_or_union_type_die (type, cont
*** 10888,10893 ****
--- 10890,10897 ----
  	  && ! decl_function_context (TYPE_STUB_DECL (type)))
  	VARRAY_PUSH_TREE (incomplete_types, type);
      }
+   if (TREE_CODE (type) == VECTOR_TYPE)
+     add_AT_flag (type_die, DW_AT_vector, 1);
  }
  
  /* Generate a DIE for a subroutine _type_.  */
Index: gcc/dwarf2.h
===================================================================
RCS file: /cvs/uberbaum/gcc/dwarf2.h,v
retrieving revision 1.22
diff -c -p -r1.22 dwarf2.h
*** dwarf2.h	2002/01/28 23:23:26	1.22
--- dwarf2.h	2002/02/22 03:40:27
*************** enum dwarf_attribute
*** 239,244 ****
--- 239,245 ----
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
      DW_AT_body_end   = 0x2106,
+     DW_AT_vector     = 0x2107,
      /* VMS Extensions.  */
      DW_AT_VMS_rtnbeg_pd_address = 0x2201
    };
Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/uberbaum/gdb/dwarf2read.c,v
retrieving revision 1.48
diff -c -p -r1.48 dwarf2read.c
*** dwarf2read.c	2002/02/15 22:42:33	1.48
--- dwarf2read.c	2002/02/22 03:40:29
*************** dwarf_attr_name (register unsigned attr)
*** 5161,5166 ****
--- 5161,5168 ----
        return "DW_AT_body_begin";
      case DW_AT_body_end:
        return "DW_AT_body_end";
+     case DW_AT_vector:
+       return "DW_AT_vector";
      default:
        return "DW_AT_<unknown>";
      }
Index: include/elf/dwarf2.h
===================================================================
RCS file: /cvs/uberbaum/include/elf/dwarf2.h,v
retrieving revision 1.8
diff -c -p -r1.8 dwarf2.h
*** dwarf2.h	2002/01/28 23:26:53	1.8
--- dwarf2.h	2002/02/22 03:40:29
*************** enum dwarf_attribute
*** 328,333 ****
--- 328,334 ----
      DW_AT_src_coords = 0x2104,
      DW_AT_body_begin = 0x2105,
      DW_AT_body_end   = 0x2106,
+     DW_AT_vector     = 0x2107,
      /* VMS Extensions.  */
      DW_AT_VMS_rtnbeg_pd_address = 0x2201
    };
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/uberbaum/binutils/readelf.c,v
retrieving revision 1.151
diff -c -p -r1.151 readelf.c
*** readelf.c	2002/02/13 18:14:42	1.151
--- readelf.c	2002/02/22 03:40:35
*************** get_AT_name (attribute)
*** 6455,6460 ****
--- 6455,6461 ----
      case DW_AT_src_coords:           return "DW_AT_src_coords";
      case DW_AT_body_begin:           return "DW_AT_body_begin";
      case DW_AT_body_end:             return "DW_AT_body_end";
+     case DW_AT_vector:               return "DW_AT_vector";
      default:
        {
  	static char buffer [100];


             reply	other threads:[~2002-02-22  4:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21 20:10 Aldy Hernandez [this message]
2002-02-21 20:33 ` Andrew Cagney
2002-02-22  1:28   ` Richard Henderson
2002-02-22  6:26     ` Andrew Cagney
2002-02-22  9:52       ` Richard Henderson
2002-02-21 21:28 ` Elena Zannoni
2002-02-21 21:48   ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020222041007.GA2446@redhat.com \
    --to=aldyh@redhat.com \
    --cc=ezannoni@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sources.redhat.com \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox