public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
@ 2019-10-18 13:53 Tankut Baris Aktemur (Code Review)
  2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-18 13:53 UTC (permalink / raw)
  To: gdb-patches

Tankut Baris Aktemur has uploaded a new change for review.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................

gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.

Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

gdb/ChangeLog:
2019-MM-DD  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the	DW_AT_calling_convention attribute
	of a type.
	* gdbtypes.h (struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the DW_AT_deleted
	attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c:  (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
---
M gdb/dwarf2read.c
M gdb/gdbtypes.c
M gdb/gdbtypes.h
3 files changed, 47 insertions(+), 1 deletion(-)



diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 3a88c45..463d9f3 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15528,6 +15528,16 @@
   if (attr && DW_UNSND (attr) != 0)
     fnp->is_artificial = 1;
 
+  /* Check for defaulted methods.  */
+  attr = dwarf2_attr (die, DW_AT_defaulted, cu);
+  if (attr)
+    fnp->defaulted = DW_UNSND (attr);
+
+  /* Check for deleted methods.  */
+  attr = dwarf2_attr (die, DW_AT_deleted, cu);
+  if (attr && DW_UNSND (attr) != 0)
+    fnp->is_deleted = 1;
+
   fnp->is_constructor = dwarf2_is_constructor (die, cu);
 
   /* Get index in virtual function table if it is a virtual member
@@ -15848,6 +15858,16 @@
   if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
     TYPE_DECLARED_CLASS (type) = 1;
 
+  /* Store the calling convention in the type if it's available in
+     the die.  Otherwise the calling convention remains set to
+     the default value DW_CC_normal.  */
+  attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
+  if (attr)
+    {
+      ALLOCATE_CPLUS_STRUCT_TYPE (type);
+      TYPE_CPLUS_CALLING_CONVENTION (type) = DW_UNSND (attr);
+    }
+
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr)
     {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index fd1c765..d5448cf 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4394,6 +4394,10 @@
 			    TYPE_FN_FIELD_PROTECTED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "is_stub %d\n",
 			    TYPE_FN_FIELD_STUB (f, overload_idx));
+	  printfi_filtered (spaces + 8, "defaulted %d\n",
+			    TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
+	  printfi_filtered (spaces + 8, "is_deleted %d\n",
+			    TYPE_FN_FIELD_DELETED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "voffset %u\n",
 			    TYPE_FN_FIELD_VOFFSET (f, overload_idx));
 	}
@@ -4457,6 +4461,9 @@
     {
       dump_fn_fieldlists (type, spaces);
     }
+
+  printfi_filtered (spaces, "calling_convention %d\n",
+		    TYPE_CPLUS_CALLING_CONVENTION (type));
 }
 
 /* Print the contents of the TYPE's type_specific union, assuming that
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index d431cb6..643122a 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -923,6 +923,11 @@
 
   struct type *fcontext;
 
+  /* * DW_AT_defaulted attribute for this function; the value is one
+     of the DW_DEFAULTED enum dwarf_defaulted_attribute constants.  */
+
+  unsigned int defaulted;
+
   /* Attributes.  */
 
   unsigned int is_const:1;
@@ -940,9 +945,13 @@
 
   unsigned int is_constructor : 1;
 
+  /* * True if this function is deleted, false otherwise.  */
+
+  unsigned int is_deleted : 1;
+
   /* * Unused.  */
 
-  unsigned int dummy:9;
+  unsigned int dummy:8;
 
   /* * Index into that baseclass's virtual function table, minus 2;
      else if static: VOFFSET_STATIC; else: 0.  */
@@ -1084,6 +1093,12 @@
        classes.  */
 
     struct symbol **template_arguments;
+
+    /* * The calling convention for this type, fetched from the
+       DW_AT_calling_convention attribute.  The value is one of the
+       DW_CC enum dwarf_calling_convention constants.  */
+
+    unsigned calling_convention : 8;
   };
 
 /* * Struct used to store conversion rankings.  */
@@ -1414,6 +1429,8 @@
     ? (struct cplus_struct_type*)&cplus_struct_default \
     : TYPE_RAW_CPLUS_SPECIFIC(thistype))
 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
+  TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
@@ -1530,6 +1547,8 @@
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
+#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
 
 /* Accessors for typedefs defined by a class.  */
 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
@ 2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
  2019-10-23 14:31 ` Tom Tromey (Code Review)
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-18 14:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Tankut Baris Aktemur has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

v2 of this patch: https://sourceware.org/ml/gdb-patches/2019-04/msg00474.html
with your comments addressed.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
  2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
@ 2019-10-23 14:31 ` Tom Tromey (Code Review)
  2019-10-29 22:20 ` Tom Tromey (Code Review)
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-23 14:31 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Andrew Burgess

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(2 comments)

Thank you for the patch.  This looks essentially good to me.  I had a couple of nits,
related to structure packing and size.

I assume this is used elsewhere in your series.  Now that we're on gerrit and can't
do cover letters, I think it would be helpful if supporting patches like this could
mention facts like that... something for us all to consider as we write commit
messages.

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@929 
PS1, Line 929:   unsigned int defaulted;
Should this be a bit-field or a narrower integer type?
I see `DW_DEFAULTED` only has 3 values at present.

I guess we'd have to deal with the situation where the DWARF
gives some random value here?

Offhand I'm not sure whether space is a big consideration here
or not, but my default with symbols and types is to assume that it is.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101:     unsigned calling_convention : 8;
This might pack better up near the `is_dynamic` field.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
  2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
  2019-10-23 14:31 ` Tom Tromey (Code Review)
@ 2019-10-29 22:20 ` Tom Tromey (Code Review)
  2019-10-30  3:30 ` Simon Marchi (Code Review)
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey (Code Review) @ 2019-10-29 22:20 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Simon Marchi, Andrew Burgess

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101: 
 986 | struct cplus_struct_type
     | ...
1092 |        N_TEMPLATE_ARGUMENTS elements.  This is NULL for non-template
1093 |        classes.  */
1094 | 
1095 |     struct symbol **template_arguments;
1096 | 
1097 |     /* * The calling convention for this type, fetched from the
1098 |        DW_AT_calling_convention attribute.  The value is one of the
1099 |        DW_CC enum dwarf_calling_convention constants.  */
1100 | 
1101 |     unsigned calling_convention : 8;

> Same here, I would suggest having our own enum, having the dwarf parser validate the input value and convert it to our enum type.

FWIW I thought we had one other case where we just reused a
DWARF enum in gdbtypes?  It seemed to me that this was ok,
because (1) DWARF is probably a superset of anything else we're
likely to deal with, and (2) if not and something else comes along,
we can always require a new enum at that point.

What do you think of this approach?



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 29 Oct 2019 22:20:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (2 preceding siblings ...)
  2019-10-29 22:20 ` Tom Tromey (Code Review)
@ 2019-10-30  3:30 ` Simon Marchi (Code Review)
  2019-10-31  9:43 ` Tankut Baris Aktemur (Code Review)
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-30  3:30 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101: 
 986 | struct cplus_struct_type
     | ...
1092 |        N_TEMPLATE_ARGUMENTS elements.  This is NULL for non-template
1093 |        classes.  */
1094 | 
1095 |     struct symbol **template_arguments;
1096 | 
1097 |     /* * The calling convention for this type, fetched from the
1098 |        DW_AT_calling_convention attribute.  The value is one of the
1099 |        DW_CC enum dwarf_calling_convention constants.  */
1100 | 
1101 |     unsigned calling_convention : 8;

> > Same here, I would suggest having our own enum, having the dwarf parser validate the input value a […]

That makes sense, this is not API so we can change it however we want.  So it's a good argument for not over-complicating things for nothing.

I still think that this field should have the right enum type (enum dwarf_calling_convention), I don't see any downsides to it.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 30 Oct 2019 03:30:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (3 preceding siblings ...)
  2019-10-30  3:30 ` Simon Marchi (Code Review)
@ 2019-10-31  9:43 ` Tankut Baris Aktemur (Code Review)
  2019-10-31 14:10 ` Simon Marchi (Code Review)
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-31  9:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey, Andrew Burgess

Tankut Baris Aktemur has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(2 comments)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101: 
 986 | struct cplus_struct_type
     | ...
1096 | 
1097 |     /* * The calling convention for this type, fetched from the
1098 |        DW_AT_calling_convention attribute.  The value is one of the
1099 |        DW_CC enum dwarf_calling_convention constants.  */
1100 | 
1101 >     unsigned calling_convention : 8;
1102 |   };
1103 | 
1104 | /* * Struct used to store conversion rankings.  */
1105 | 
1106 | struct rank

> That makes sense, this is not API so we can change it however we want. […]

I assume this comment applies to the "defaulted" attribute, too.  Before I send a revision, just to clarify: I don't see another use of "enum dwarf_*" in gdbtypes.h.  In the original patch, my aim was to be consistent with the existing definition; in particular with the 'calling_convention' field in 'func_type' a little bit down (marked with another comment).  So, my question is, would this change create inconsistency in this file?


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1144 
PS1, Line 1144: 
1137 | struct func_type
     | ...
1139 |     /* * The calling convention for targets supporting multiple ABIs.
1140 |        Right now this is only fetched from the Dwarf-2
1141 |        DW_AT_calling_convention attribute.  The value is one of the
1142 |        DW_CC enum dwarf_calling_convention constants.  */
1143 | 
1144 >     unsigned calling_convention : 8;
1145 | 
1146 |     /* * Whether this function normally returns to its caller.  It is
1147 |        set from the DW_AT_noreturn attribute if set on the
1148 |        DW_TAG_subprogram.  */
1149 | 

This is an existing definition I had aimed to be consistent with.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 09:43:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (4 preceding siblings ...)
  2019-10-31  9:43 ` Tankut Baris Aktemur (Code Review)
@ 2019-10-31 14:10 ` Simon Marchi (Code Review)
  2019-10-31 17:22 ` Tankut Baris Aktemur (Code Review)
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 14:10 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101: 
 986 | struct cplus_struct_type
     | ...
1096 | 
1097 |     /* * The calling convention for this type, fetched from the
1098 |        DW_AT_calling_convention attribute.  The value is one of the
1099 |        DW_CC enum dwarf_calling_convention constants.  */
1100 | 
1101 >     unsigned calling_convention : 8;
1102 |   };
1103 | 
1104 | /* * Struct used to store conversion rankings.  */
1105 | 
1106 | struct rank

> I assume this comment applies to the "defaulted" attribute, too. […]

Ah, thanks for pointing out this other usage in func_type.  Well, if I was reviewing that, I would give the same comment there too.

If we're going to document that the field takes one of the values of the dwarf_calling_convention enum, we're already depending on it implicitly.  Making it explicit just makes it clearer, IMO.

If you agree, I think we can change this other spot in another patch to keep it consistent.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 14:10:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (5 preceding siblings ...)
  2019-10-31 14:10 ` Simon Marchi (Code Review)
@ 2019-10-31 17:22 ` Tankut Baris Aktemur (Code Review)
  2019-10-31 17:24 ` [review v2] " Tankut Baris Aktemur (Code Review)
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-31 17:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey, Andrew Burgess

Tankut Baris Aktemur has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 1:

(5 comments)

> I assume this is used elsewhere in your series.  Now that we're on gerrit and can't
> do cover letters, I think it would be helpful if supporting patches like this could
> mention facts like that... something for us all to consider as we write commit
> messages.

Yes.  I update the commit message in v2.

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/dwarf2read.c@15533 
PS1, Line 15533: 
15422 | dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      | ...
15528 |   if (attr && DW_UNSND (attr) != 0)
15529 |     fnp->is_artificial = 1;
15530 | 
15531 |   /* Check for defaulted methods.  */
15532 |   attr = dwarf2_attr (die, DW_AT_defaulted, cu);
15533 >   if (attr)
15534 |     fnp->defaulted = DW_UNSND (attr);
15535 | 
15536 |   /* Check for deleted methods.  */
15537 |   attr = dwarf2_attr (die, DW_AT_deleted, cu);
15538 |   if (attr && DW_UNSND (attr) != 0)

> Use: […]

Done


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/dwarf2read.c@15534 
PS1, Line 15534: 
15422 | dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      | ...
15529 |     fnp->is_artificial = 1;
15530 | 
15531 |   /* Check for defaulted methods.  */
15532 |   attr = dwarf2_attr (die, DW_AT_defaulted, cu);
15533 |   if (attr)
15534 >     fnp->defaulted = DW_UNSND (attr);
15535 | 
15536 |   /* Check for deleted methods.  */
15537 |   attr = dwarf2_attr (die, DW_AT_deleted, cu);
15538 |   if (attr && DW_UNSND (attr) != 0)
15539 |     fnp->is_deleted = 1;

> Shouldn't we do a bit of validation here, making sure `attr` is one of the valid values, issuing a c […]

Done


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@929 
PS1, Line 929: 
899 | struct fn_field
    | ...
924 |   struct type *fcontext;
925 | 
926 |   /* * DW_AT_defaulted attribute for this function; the value is one
927 |      of the DW_DEFAULTED enum dwarf_defaulted_attribute constants.  */
928 | 
929 >   unsigned int defaulted;
930 | 
931 |   /* Attributes.  */
932 | 
933 |   unsigned int is_const:1;
934 |   unsigned int is_volatile:1;

> Should this be a bit-field or a narrower integer type? […]

In v2, I make this 2-bit-wide and move down for better packing.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@929 
PS1, Line 929: 
899 | struct fn_field
    | ...
924 |   struct type *fcontext;
925 | 
926 |   /* * DW_AT_defaulted attribute for this function; the value is one
927 |      of the DW_DEFAULTED enum dwarf_defaulted_attribute constants.  */
928 | 
929 >   unsigned int defaulted;
930 | 
931 |   /* Attributes.  */
932 | 
933 |   unsigned int is_const:1;
934 |   unsigned int is_volatile:1;

> It would be good for this field to be an enum. […]

In v2, I make this an ENUM_BITFIELD.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1101 
PS1, Line 1101: 
 986 | struct cplus_struct_type
     | ...
1096 | 
1097 |     /* * The calling convention for this type, fetched from the
1098 |        DW_AT_calling_convention attribute.  The value is one of the
1099 |        DW_CC enum dwarf_calling_convention constants.  */
1100 | 
1101 >     unsigned calling_convention : 8;
1102 |   };
1103 | 
1104 | /* * Struct used to store conversion rankings.  */
1105 | 
1106 | struct rank

> Ah, thanks for pointing out this other usage in func_type. […]

Yes, agree. In v2, I make this an ENUM_BITFIELD and move near `is_dynamic`.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 1
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 17:22:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v2] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (6 preceding siblings ...)
  2019-10-31 17:22 ` Tankut Baris Aktemur (Code Review)
@ 2019-10-31 17:24 ` Tankut Baris Aktemur (Code Review)
  2019-10-31 17:57 ` Simon Marchi (Code Review)
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-31 17:24 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey, Simon Marchi

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................

gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.

Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

These attributes will be helpful in a future patch about infcall'ing
functions with call-by-value parameters.  GDB will use the attributes
to decide whether the type of a call-by-value parameter is implicitly
pass-by-reference.

gdb/ChangeLog:
2019-10-31  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the DW_AT_calling_convention attribute
	of a type.
	(is_valid_DW_AT_defaulted): New function.
	(is_valid_DW_AT_calling_convention): New function.
	* gdbtypes.h: Include dwarf2.h.
	(struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the
	DW_AT_deleted attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
---
M gdb/dwarf2read.c
M gdb/gdbtypes.c
M gdb/gdbtypes.h
3 files changed, 94 insertions(+), 1 deletion(-)



diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index cac719a..4b701e0 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15436,6 +15436,24 @@
 	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
+/* Check if the given VALUE is a recognized enum
+   dwarf_defaulted_attribute constant.  */
+
+static bool
+is_valid_DW_AT_defaulted (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_DEFAULTED_no:
+    case DW_DEFAULTED_in_class:
+    case DW_DEFAULTED_out_of_class:
+      return true;
+    }
+
+  complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
+  return false;
+}
+
 /* Add a member function to the proper fieldlist.  */
 
 static void
@@ -15548,6 +15566,16 @@
   if (attr && DW_UNSND (attr) != 0)
     fnp->is_artificial = 1;
 
+  /* Check for defaulted methods.  */
+  attr = dwarf2_attr (die, DW_AT_defaulted, cu);
+  if (attr != nullptr && is_valid_DW_AT_defaulted (DW_UNSND (attr)))
+    fnp->defaulted = (enum dwarf_defaulted_attribute) DW_UNSND (attr);
+
+  /* Check for deleted methods.  */
+  attr = dwarf2_attr (die, DW_AT_deleted, cu);
+  if (attr != nullptr && DW_UNSND (attr) != 0)
+    fnp->is_deleted = 1;
+
   fnp->is_constructor = dwarf2_is_constructor (die, cu);
 
   /* Get index in virtual function table if it is a virtual member
@@ -15787,6 +15815,32 @@
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
 }
 
+/* Check if the given VALUE is a valid enum dwarf_calling_convention
+   constant.  */
+
+static bool
+is_valid_DW_AT_calling_convention (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_CC_normal:
+    case DW_CC_program:
+    case DW_CC_nocall:
+    case DW_CC_pass_by_reference:
+    case DW_CC_pass_by_value:
+    case DW_CC_lo_user:
+    case DW_CC_hi_user:
+    /* case DW_CC_GNU_renesas_sh: Duplicate of DW_CC_lo_user.  */
+    case DW_CC_GNU_borland_fastcall_i386:
+    /* case DW_CC_GDB_IBM_OpenCL: Duplicate of DW_CC_hi_user.  */
+      return true;
+    }
+
+  complaint (_("unrecognized DW_AT_calling_convention value (%lu)"),
+	     value);
+  return false;
+}
+
 /* Called when we find the DIE that starts a structure or union scope
    (definition) to create a type for the structure or union.  Fill in
    the type's name and general properties; the members will not be
@@ -15868,6 +15922,18 @@
   if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
     TYPE_DECLARED_CLASS (type) = 1;
 
+  /* Store the calling convention in the type if it's available in
+     the die.  Otherwise the calling convention remains set to
+     the default value DW_CC_normal.  */
+  attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
+  if (attr != nullptr
+      && is_valid_DW_AT_calling_convention (DW_UNSND (attr)))
+    {
+      ALLOCATE_CPLUS_STRUCT_TYPE (type);
+      TYPE_CPLUS_CALLING_CONVENTION (type)
+	= (enum dwarf_calling_convention) (DW_UNSND (attr));
+    }
+
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr)
     {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index fd1c765..d5448cf 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4394,6 +4394,10 @@
 			    TYPE_FN_FIELD_PROTECTED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "is_stub %d\n",
 			    TYPE_FN_FIELD_STUB (f, overload_idx));
+	  printfi_filtered (spaces + 8, "defaulted %d\n",
+			    TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
+	  printfi_filtered (spaces + 8, "is_deleted %d\n",
+			    TYPE_FN_FIELD_DELETED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "voffset %u\n",
 			    TYPE_FN_FIELD_VOFFSET (f, overload_idx));
 	}
@@ -4457,6 +4461,9 @@
     {
       dump_fn_fieldlists (type, spaces);
     }
+
+  printfi_filtered (spaces, "calling_convention %d\n",
+		    TYPE_CPLUS_CALLING_CONVENTION (type));
 }
 
 /* Print the contents of the TYPE's type_specific union, assuming that
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 6d6ff59..24628e7 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -50,6 +50,7 @@
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/print-utils.h"
+#include "dwarf2.h"
 
 /* Forward declarations for prototypes.  */
 struct field;
@@ -940,9 +941,18 @@
 
   unsigned int is_constructor : 1;
 
+  /* * True if this function is deleted, false otherwise.  */
+
+  unsigned int is_deleted : 1;
+
+  /* * DW_AT_defaulted attribute for this function.  The value is one
+     of the DW_DEFAULTED constants.  */
+
+  ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2;
+
   /* * Unused.  */
 
-  unsigned int dummy:9;
+  unsigned int dummy:6;
 
   /* * Index into that baseclass's virtual function table, minus 2;
      else if static: VOFFSET_STATIC; else: 0.  */
@@ -1016,6 +1026,12 @@
 
     int is_dynamic : 2;
 
+    /* * The calling convention for this type, fetched from the
+       DW_AT_calling_convention attribute.  The value is one of the
+       DW_CC constants.  */
+
+    ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+
     /* * The base class which defined the virtual function table pointer.  */
 
     struct type *vptr_basetype;
@@ -1414,6 +1430,8 @@
     ? (struct cplus_struct_type*)&cplus_struct_default \
     : TYPE_RAW_CPLUS_SPECIFIC(thistype))
 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
+  TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
@@ -1530,6 +1548,8 @@
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
+#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
 
 /* Accessors for typedefs defined by a class.  */
 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 2
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v2] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (7 preceding siblings ...)
  2019-10-31 17:24 ` [review v2] " Tankut Baris Aktemur (Code Review)
@ 2019-10-31 17:57 ` Simon Marchi (Code Review)
  2019-10-31 20:07 ` [review v3] " Tankut Baris Aktemur (Code Review)
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 17:57 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 2:

(3 comments)

Thanks for the update.  Just two minor comments about the validation.

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15831 
PS2, Line 15831: 
15822 | is_valid_DW_AT_calling_convention (ULONGEST value)
      | ...
15826 |     case DW_CC_normal:
15827 |     case DW_CC_program:
15828 |     case DW_CC_nocall:
15829 |     case DW_CC_pass_by_reference:
15830 |     case DW_CC_pass_by_value:
15831 >     case DW_CC_lo_user:
15832 >     case DW_CC_hi_user:
15833 |     /* case DW_CC_GNU_renesas_sh: Duplicate of DW_CC_lo_user.  */
15834 |     case DW_CC_GNU_borland_fastcall_i386:
15835 |     /* case DW_CC_GDB_IBM_OpenCL: Duplicate of DW_CC_hi_user.  */
15836 |       return true;
15837 |     }

I don' think we should include lo_user and hi_user in the switch, since they are not "real" values.  They just indicate the range for vendor-specific values.

DW_CC_GNU_renesas_sh and DW_CC_GDB_IBM_OpenCL are "real" values, so they should be included in the switch.  In the end, the behavior will be the same, since as you noted, they are duplicates of lo_user and hi_user.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15928 
PS2, Line 15928: 
15857 | read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
      | ...
15923 |     TYPE_DECLARED_CLASS (type) = 1;
15924 | 
15925 |   /* Store the calling convention in the type if it's available in
15926 |      the die.  Otherwise the calling convention remains set to
15927 |      the default value DW_CC_normal.  */
15928 >   attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
15929 |   if (attr != nullptr
15930 |       && is_valid_DW_AT_calling_convention (DW_UNSND (attr)))
15931 |     {
15932 |       ALLOCATE_CPLUS_STRUCT_TYPE (type);
15933 |       TYPE_CPLUS_CALLING_CONVENTION (type)

According to table 5.5 of DWARF5, the acceptable calling convention values for types are restricted to:

- DW_CC_normal
- DW_CC_pass_by_value
- DW_CC_pass_by_reference

So should we complain and reject the value if it's not one of those? The idea is that if a producer emits an unacceptable value by mistake, the issue is caught as early as possible rather than silently accepted.

In the spot where we read DW_AT_calling_convention for subroutines, we could validate that the value is one of those listed in table 3.3:

- DW_CC_normal
- DW_CC_program
- DW_CC_nocall

... plus the vendor-specific values that we support.  So it might be simpler to do two functions, is_valid_DW_AT_calling_convention_for_types and is_valid_DW_AT_calling_convention_for_subprogram. Therefore, in this patch I suggest calling the new function "is_valid_DW_AT_calling_convention_for_types" to leave room to do the same thing for subprograms.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h 
File gdb/gdbtypes.h:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/1/gdb/gdbtypes.h@1144 
PS1, Line 1144: 
1137 | struct func_type
     | ...
1139 |     /* * The calling convention for targets supporting multiple ABIs.
1140 |        Right now this is only fetched from the Dwarf-2
1141 |        DW_AT_calling_convention attribute.  The value is one of the
1142 |        DW_CC enum dwarf_calling_convention constants.  */
1143 | 
1144 >     unsigned calling_convention : 8;
1145 | 
1146 |     /* * Whether this function normally returns to its caller.  It is
1147 |        set from the DW_AT_noreturn attribute if set on the
1148 |        DW_TAG_subprogram.  */
1149 | 

> This is an existing definition I had aimed to be consistent with.

Ack, let's change it in another patch.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 2
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 17:57:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v3] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (8 preceding siblings ...)
  2019-10-31 17:57 ` Simon Marchi (Code Review)
@ 2019-10-31 20:07 ` Tankut Baris Aktemur (Code Review)
  2019-10-31 20:12 ` Simon Marchi (Code Review)
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-31 20:07 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey, Simon Marchi

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................

gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.

Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

These attributes will be helpful in a future patch about infcall'ing
functions with call-by-value parameters.  GDB will use the attributes
to decide whether the type of a call-by-value parameter is implicitly
pass-by-reference.

gdb/ChangeLog:
2019-10-31  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the DW_AT_calling_convention attribute
	of a type.
	(is_valid_DW_AT_defaulted): New function.
	(is_valid_DW_AT_calling_convention_for_type): New function.
	* gdbtypes.h: Include dwarf2.h.
	(struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the
	DW_AT_deleted attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
---
M gdb/dwarf2read.c
M gdb/gdbtypes.c
M gdb/gdbtypes.h
3 files changed, 89 insertions(+), 1 deletion(-)



diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index cac719a..7fc3937 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15436,6 +15436,25 @@
 	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
+/* Check if the given VALUE is a recognized enum
+   dwarf_defaulted_attribute constant according to DWARF5 spec,
+   Table 7.24.  */
+
+static bool
+is_valid_DW_AT_defaulted (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_DEFAULTED_no:
+    case DW_DEFAULTED_in_class:
+    case DW_DEFAULTED_out_of_class:
+      return true;
+    }
+
+  complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
+  return false;
+}
+
 /* Add a member function to the proper fieldlist.  */
 
 static void
@@ -15548,6 +15567,16 @@
   if (attr && DW_UNSND (attr) != 0)
     fnp->is_artificial = 1;
 
+  /* Check for defaulted methods.  */
+  attr = dwarf2_attr (die, DW_AT_defaulted, cu);
+  if (attr != nullptr && is_valid_DW_AT_defaulted (DW_UNSND (attr)))
+    fnp->defaulted = (enum dwarf_defaulted_attribute) DW_UNSND (attr);
+
+  /* Check for deleted methods.  */
+  attr = dwarf2_attr (die, DW_AT_deleted, cu);
+  if (attr != nullptr && DW_UNSND (attr) != 0)
+    fnp->is_deleted = 1;
+
   fnp->is_constructor = dwarf2_is_constructor (die, cu);
 
   /* Get index in virtual function table if it is a virtual member
@@ -15787,6 +15816,26 @@
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
 }
 
+/* Check if the given VALUE is a valid enum dwarf_calling_convention
+   constant for a type, according to DWARF5 spec, Table 5.5.  */
+
+static bool
+is_valid_DW_AT_calling_convention_for_type (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_CC_normal:
+    case DW_CC_pass_by_reference:
+    case DW_CC_pass_by_value:
+      return true;
+
+    default:
+      complaint (_("unrecognized DW_AT_calling_convention value "
+		   "(%lu) for a type"), value);
+      return false;
+    }
+}
+
 /* Called when we find the DIE that starts a structure or union scope
    (definition) to create a type for the structure or union.  Fill in
    the type's name and general properties; the members will not be
@@ -15868,6 +15917,18 @@
   if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
     TYPE_DECLARED_CLASS (type) = 1;
 
+  /* Store the calling convention in the type if it's available in
+     the die.  Otherwise the calling convention remains set to
+     the default value DW_CC_normal.  */
+  attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
+  if (attr != nullptr
+      && is_valid_DW_AT_calling_convention_for_type (DW_UNSND (attr)))
+    {
+      ALLOCATE_CPLUS_STRUCT_TYPE (type);
+      TYPE_CPLUS_CALLING_CONVENTION (type)
+	= (enum dwarf_calling_convention) (DW_UNSND (attr));
+    }
+
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr)
     {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index fd1c765..d5448cf 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4394,6 +4394,10 @@
 			    TYPE_FN_FIELD_PROTECTED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "is_stub %d\n",
 			    TYPE_FN_FIELD_STUB (f, overload_idx));
+	  printfi_filtered (spaces + 8, "defaulted %d\n",
+			    TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
+	  printfi_filtered (spaces + 8, "is_deleted %d\n",
+			    TYPE_FN_FIELD_DELETED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "voffset %u\n",
 			    TYPE_FN_FIELD_VOFFSET (f, overload_idx));
 	}
@@ -4457,6 +4461,9 @@
     {
       dump_fn_fieldlists (type, spaces);
     }
+
+  printfi_filtered (spaces, "calling_convention %d\n",
+		    TYPE_CPLUS_CALLING_CONVENTION (type));
 }
 
 /* Print the contents of the TYPE's type_specific union, assuming that
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 6d6ff59..24628e7 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -50,6 +50,7 @@
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/print-utils.h"
+#include "dwarf2.h"
 
 /* Forward declarations for prototypes.  */
 struct field;
@@ -940,9 +941,18 @@
 
   unsigned int is_constructor : 1;
 
+  /* * True if this function is deleted, false otherwise.  */
+
+  unsigned int is_deleted : 1;
+
+  /* * DW_AT_defaulted attribute for this function.  The value is one
+     of the DW_DEFAULTED constants.  */
+
+  ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2;
+
   /* * Unused.  */
 
-  unsigned int dummy:9;
+  unsigned int dummy:6;
 
   /* * Index into that baseclass's virtual function table, minus 2;
      else if static: VOFFSET_STATIC; else: 0.  */
@@ -1016,6 +1026,12 @@
 
     int is_dynamic : 2;
 
+    /* * The calling convention for this type, fetched from the
+       DW_AT_calling_convention attribute.  The value is one of the
+       DW_CC constants.  */
+
+    ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+
     /* * The base class which defined the virtual function table pointer.  */
 
     struct type *vptr_basetype;
@@ -1414,6 +1430,8 @@
     ? (struct cplus_struct_type*)&cplus_struct_default \
     : TYPE_RAW_CPLUS_SPECIFIC(thistype))
 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
+  TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
@@ -1530,6 +1548,8 @@
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
+#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
 
 /* Accessors for typedefs defined by a class.  */
 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 3
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v3] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (9 preceding siblings ...)
  2019-10-31 20:07 ` [review v3] " Tankut Baris Aktemur (Code Review)
@ 2019-10-31 20:12 ` Simon Marchi (Code Review)
  2019-10-31 20:12 ` Simon Marchi (Code Review)
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 20:12 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 3:

(2 comments)

Thanks, this patch LGTM for my part.

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15831 
PS2, Line 15831: 
15822 | is_valid_DW_AT_calling_convention (ULONGEST value)
      | ...
15826 |     case DW_CC_normal:
15827 |     case DW_CC_program:
15828 |     case DW_CC_nocall:
15829 |     case DW_CC_pass_by_reference:
15830 |     case DW_CC_pass_by_value:
15831 >     case DW_CC_lo_user:
15832 >     case DW_CC_hi_user:
15833 |     /* case DW_CC_GNU_renesas_sh: Duplicate of DW_CC_lo_user.  */
15834 |     case DW_CC_GNU_borland_fastcall_i386:
15835 |     /* case DW_CC_GDB_IBM_OpenCL: Duplicate of DW_CC_hi_user.  */
15836 |       return true;
15837 |     }

> I don' think we should include lo_user and hi_user in the switch, since they are not "real" values. […]

Done


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15928 
PS2, Line 15928: 
15857 | read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
      | ...
15923 |     TYPE_DECLARED_CLASS (type) = 1;
15924 | 
15925 |   /* Store the calling convention in the type if it's available in
15926 |      the die.  Otherwise the calling convention remains set to
15927 |      the default value DW_CC_normal.  */
15928 >   attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
15929 |   if (attr != nullptr
15930 |       && is_valid_DW_AT_calling_convention (DW_UNSND (attr)))
15931 |     {
15932 |       ALLOCATE_CPLUS_STRUCT_TYPE (type);
15933 |       TYPE_CPLUS_CALLING_CONVENTION (type)

> According to table 5. […]

Done



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 3
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 20:12:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v3] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (10 preceding siblings ...)
  2019-10-31 20:12 ` Simon Marchi (Code Review)
@ 2019-10-31 20:12 ` Simon Marchi (Code Review)
  2019-10-31 20:13 ` Tankut Baris Aktemur (Code Review)
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 20:12 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 3: Code-Review+2


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 3
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 20:12:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v3] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (11 preceding siblings ...)
  2019-10-31 20:12 ` Simon Marchi (Code Review)
@ 2019-10-31 20:13 ` Tankut Baris Aktemur (Code Review)
  2019-10-31 20:18 ` Simon Marchi (Code Review)
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Tankut Baris Aktemur (Code Review) @ 2019-10-31 20:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey, Andrew Burgess

Tankut Baris Aktemur has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 3:

(3 comments)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15831 
PS2, Line 15831: 
15822 | is_valid_DW_AT_calling_convention (ULONGEST value)
      | ...
15826 |     case DW_CC_normal:
15827 |     case DW_CC_program:
15828 |     case DW_CC_nocall:
15829 |     case DW_CC_pass_by_reference:
15830 |     case DW_CC_pass_by_value:
15831 >     case DW_CC_lo_user:
15832 >     case DW_CC_hi_user:
15833 |     /* case DW_CC_GNU_renesas_sh: Duplicate of DW_CC_lo_user.  */
15834 |     case DW_CC_GNU_borland_fastcall_i386:
15835 |     /* case DW_CC_GDB_IBM_OpenCL: Duplicate of DW_CC_hi_user.  */
15836 |       return true;
15837 |     }

> I don' think we should include lo_user and hi_user in the switch, since they are not "real" values. […]

Ack


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/2/gdb/dwarf2read.c@15928 
PS2, Line 15928: 
15857 | read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
      | ...
15923 |     TYPE_DECLARED_CLASS (type) = 1;
15924 | 
15925 |   /* Store the calling convention in the type if it's available in
15926 |      the die.  Otherwise the calling convention remains set to
15927 |      the default value DW_CC_normal.  */
15928 >   attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
15929 |   if (attr != nullptr
15930 |       && is_valid_DW_AT_calling_convention (DW_UNSND (attr)))
15931 |     {
15932 |       ALLOCATE_CPLUS_STRUCT_TYPE (type);
15933 |       TYPE_CPLUS_CALLING_CONVENTION (type)

> According to table 5. […]

Yes, makes much sense.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/3/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/3/gdb/dwarf2read.c@15452 
PS3, Line 15452: 
15444 | is_valid_DW_AT_defaulted (ULONGEST value)
      | ...
15447 |     {
15448 |     case DW_DEFAULTED_no:
15449 |     case DW_DEFAULTED_in_class:
15450 |     case DW_DEFAULTED_out_of_class:
15451 |       return true;
15452 >     }
15453 | 
15454 |   complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
15455 |   return false;
15456 | }
15457 | 

I did not put a "default" case here whereas in 'is_valid_DW_AT_calling_convention_for_type' there is one.  This is intentional.  In case a new enum constant is added to 'dwarf_defaulted_attribute', a friendly compiler may warn about an uncaught case here.  This was not possible in 'is_valid_DW_AT_calling_convention_for_type' as some values are already not valid.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 3
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 20:12:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [review v3] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (12 preceding siblings ...)
  2019-10-31 20:13 ` Tankut Baris Aktemur (Code Review)
@ 2019-10-31 20:18 ` Simon Marchi (Code Review)
  2019-12-20 16:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)
  15 siblings, 0 replies; 17+ messages in thread
From: Simon Marchi (Code Review) @ 2019-10-31 20:18 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches; +Cc: Tom Tromey, Andrew Burgess

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................


Patch Set 3:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/3/gdb/dwarf2read.c 
File gdb/dwarf2read.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135/3/gdb/dwarf2read.c@15452 
PS3, Line 15452: 
15444 | is_valid_DW_AT_defaulted (ULONGEST value)
      | ...
15447 |     {
15448 |     case DW_DEFAULTED_no:
15449 |     case DW_DEFAULTED_in_class:
15450 |     case DW_DEFAULTED_out_of_class:
15451 |       return true;
15452 >     }
15453 | 
15454 |   complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
15455 |   return false;
15456 | }
15457 | 

> I did not put a "default" case here whereas in 'is_valid_DW_AT_calling_convention_for_type' there is […]

I think this is fine, thanks.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 3
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Thu, 31 Oct 2019 20:18:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [pushed] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (14 preceding siblings ...)
  2019-12-20 16:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)
  15 siblings, 0 replies; 17+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:47 UTC (permalink / raw)
  To: Tankut Baris Aktemur, Andrew Burgess, Simon Marchi, gdb-patches
  Cc: Tom Tromey

The original change was created by Tankut Baris Aktemur.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................

gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.

Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

These attributes will be helpful in a future patch about infcall'ing
functions with call-by-value parameters.  GDB will use the attributes
to decide whether the type of a call-by-value parameter is implicitly
pass-by-reference.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the DW_AT_calling_convention attribute
	of a type.
	(is_valid_DW_AT_defaulted): New function.
	(is_valid_DW_AT_calling_convention_for_type): New function.
	* gdbtypes.h: Include dwarf2.h.
	(struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the
	DW_AT_deleted attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
---
M gdb/ChangeLog
M gdb/dwarf2read.c
M gdb/gdbtypes.c
M gdb/gdbtypes.h
4 files changed, 111 insertions(+), 1 deletion(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0f35def..5175ebc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
+	and DW_AT_deleted attributes of a function.
+	(read_structure_type): Read the DW_AT_calling_convention attribute
+	of a type.
+	(is_valid_DW_AT_defaulted): New function.
+	(is_valid_DW_AT_calling_convention_for_type): New function.
+	* gdbtypes.h: Include dwarf2.h.
+	(struct fn_field)<defaulted>: New field to store the
+	DW_AT_defaulted attribute.
+	(struct fn_field)<is_deleted>: New field to store the
+	DW_AT_deleted attribute.
+	(struct cplus_struct_type)<calling_convention>: New field to store
+	the DW_AT_calling_convention attribute.
+	(TYPE_FN_FIELD_DEFAULTED): New macro.
+	(TYPE_FN_FIELD_DELETED): New macro.
+	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
+	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
+	to the .h file.
+	(print_cplus_stuff): Likewise.
+
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui.c (tui_show_source): Remove.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ecfae68..6492889 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15472,6 +15472,25 @@
 	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
+/* Check if the given VALUE is a recognized enum
+   dwarf_defaulted_attribute constant according to DWARF5 spec,
+   Table 7.24.  */
+
+static bool
+is_valid_DW_AT_defaulted (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_DEFAULTED_no:
+    case DW_DEFAULTED_in_class:
+    case DW_DEFAULTED_out_of_class:
+      return true;
+    }
+
+  complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
+  return false;
+}
+
 /* Add a member function to the proper fieldlist.  */
 
 static void
@@ -15584,6 +15603,16 @@
   if (attr && DW_UNSND (attr) != 0)
     fnp->is_artificial = 1;
 
+  /* Check for defaulted methods.  */
+  attr = dwarf2_attr (die, DW_AT_defaulted, cu);
+  if (attr != nullptr && is_valid_DW_AT_defaulted (DW_UNSND (attr)))
+    fnp->defaulted = (enum dwarf_defaulted_attribute) DW_UNSND (attr);
+
+  /* Check for deleted methods.  */
+  attr = dwarf2_attr (die, DW_AT_deleted, cu);
+  if (attr != nullptr && DW_UNSND (attr) != 0)
+    fnp->is_deleted = 1;
+
   fnp->is_constructor = dwarf2_is_constructor (die, cu);
 
   /* Get index in virtual function table if it is a virtual member
@@ -15823,6 +15852,26 @@
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
 }
 
+/* Check if the given VALUE is a valid enum dwarf_calling_convention
+   constant for a type, according to DWARF5 spec, Table 5.5.  */
+
+static bool
+is_valid_DW_AT_calling_convention_for_type (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_CC_normal:
+    case DW_CC_pass_by_reference:
+    case DW_CC_pass_by_value:
+      return true;
+
+    default:
+      complaint (_("unrecognized DW_AT_calling_convention value "
+		   "(%lu) for a type"), value);
+      return false;
+    }
+}
+
 /* Called when we find the DIE that starts a structure or union scope
    (definition) to create a type for the structure or union.  Fill in
    the type's name and general properties; the members will not be
@@ -15904,6 +15953,18 @@
   if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
     TYPE_DECLARED_CLASS (type) = 1;
 
+  /* Store the calling convention in the type if it's available in
+     the die.  Otherwise the calling convention remains set to
+     the default value DW_CC_normal.  */
+  attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
+  if (attr != nullptr
+      && is_valid_DW_AT_calling_convention_for_type (DW_UNSND (attr)))
+    {
+      ALLOCATE_CPLUS_STRUCT_TYPE (type);
+      TYPE_CPLUS_CALLING_CONVENTION (type)
+	= (enum dwarf_calling_convention) (DW_UNSND (attr));
+    }
+
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr != nullptr)
     {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0896f71..7e80b45 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4494,6 +4494,10 @@
 			    TYPE_FN_FIELD_PROTECTED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "is_stub %d\n",
 			    TYPE_FN_FIELD_STUB (f, overload_idx));
+	  printfi_filtered (spaces + 8, "defaulted %d\n",
+			    TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
+	  printfi_filtered (spaces + 8, "is_deleted %d\n",
+			    TYPE_FN_FIELD_DELETED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "voffset %u\n",
 			    TYPE_FN_FIELD_VOFFSET (f, overload_idx));
 	}
@@ -4557,6 +4561,9 @@
     {
       dump_fn_fieldlists (type, spaces);
     }
+
+  printfi_filtered (spaces, "calling_convention %d\n",
+		    TYPE_CPLUS_CALLING_CONVENTION (type));
 }
 
 /* Print the contents of the TYPE's type_specific union, assuming that
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index a1d95e0..12fa437 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -50,6 +50,7 @@
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/print-utils.h"
+#include "dwarf2.h"
 
 /* Forward declarations for prototypes.  */
 struct field;
@@ -957,9 +958,18 @@
 
   unsigned int is_constructor : 1;
 
+  /* * True if this function is deleted, false otherwise.  */
+
+  unsigned int is_deleted : 1;
+
+  /* * DW_AT_defaulted attribute for this function.  The value is one
+     of the DW_DEFAULTED constants.  */
+
+  ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2;
+
   /* * Unused.  */
 
-  unsigned int dummy:9;
+  unsigned int dummy:6;
 
   /* * Index into that baseclass's virtual function table, minus 2;
      else if static: VOFFSET_STATIC; else: 0.  */
@@ -1033,6 +1043,12 @@
 
     int is_dynamic : 2;
 
+    /* * The calling convention for this type, fetched from the
+       DW_AT_calling_convention attribute.  The value is one of the
+       DW_CC constants.  */
+
+    ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+
     /* * The base class which defined the virtual function table pointer.  */
 
     struct type *vptr_basetype;
@@ -1437,6 +1453,8 @@
     ? (struct cplus_struct_type*)&cplus_struct_default \
     : TYPE_RAW_CPLUS_SPECIFIC(thistype))
 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
+  TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
@@ -1553,6 +1571,8 @@
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
+#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
 
 /* Accessors for typedefs defined by a class.  */
 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 5
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [pushed] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
  2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
                   ` (13 preceding siblings ...)
  2019-10-31 20:18 ` Simon Marchi (Code Review)
@ 2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)
  15 siblings, 0 replies; 17+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:47 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches
  Cc: Simon Marchi, Tom Tromey, Andrew Burgess

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/135
......................................................................

gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.

Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

These attributes will be helpful in a future patch about infcall'ing
functions with call-by-value parameters.  GDB will use the attributes
to decide whether the type of a call-by-value parameter is implicitly
pass-by-reference.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the DW_AT_calling_convention attribute
	of a type.
	(is_valid_DW_AT_defaulted): New function.
	(is_valid_DW_AT_calling_convention_for_type): New function.
	* gdbtypes.h: Include dwarf2.h.
	(struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the
	DW_AT_deleted attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
---
M gdb/ChangeLog
M gdb/dwarf2read.c
M gdb/gdbtypes.c
M gdb/gdbtypes.h
4 files changed, 111 insertions(+), 1 deletion(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0f35def..5175ebc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
+	and DW_AT_deleted attributes of a function.
+	(read_structure_type): Read the DW_AT_calling_convention attribute
+	of a type.
+	(is_valid_DW_AT_defaulted): New function.
+	(is_valid_DW_AT_calling_convention_for_type): New function.
+	* gdbtypes.h: Include dwarf2.h.
+	(struct fn_field)<defaulted>: New field to store the
+	DW_AT_defaulted attribute.
+	(struct fn_field)<is_deleted>: New field to store the
+	DW_AT_deleted attribute.
+	(struct cplus_struct_type)<calling_convention>: New field to store
+	the DW_AT_calling_convention attribute.
+	(TYPE_FN_FIELD_DEFAULTED): New macro.
+	(TYPE_FN_FIELD_DELETED): New macro.
+	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
+	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
+	to the .h file.
+	(print_cplus_stuff): Likewise.
+
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui.c (tui_show_source): Remove.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ecfae68..6492889 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15472,6 +15472,25 @@
 	  && (type_name[len] == '\0' || type_name[len] == '<'));
 }
 
+/* Check if the given VALUE is a recognized enum
+   dwarf_defaulted_attribute constant according to DWARF5 spec,
+   Table 7.24.  */
+
+static bool
+is_valid_DW_AT_defaulted (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_DEFAULTED_no:
+    case DW_DEFAULTED_in_class:
+    case DW_DEFAULTED_out_of_class:
+      return true;
+    }
+
+  complaint (_("unrecognized DW_AT_defaulted value (%lu)"), value);
+  return false;
+}
+
 /* Add a member function to the proper fieldlist.  */
 
 static void
@@ -15584,6 +15603,16 @@
   if (attr && DW_UNSND (attr) != 0)
     fnp->is_artificial = 1;
 
+  /* Check for defaulted methods.  */
+  attr = dwarf2_attr (die, DW_AT_defaulted, cu);
+  if (attr != nullptr && is_valid_DW_AT_defaulted (DW_UNSND (attr)))
+    fnp->defaulted = (enum dwarf_defaulted_attribute) DW_UNSND (attr);
+
+  /* Check for deleted methods.  */
+  attr = dwarf2_attr (die, DW_AT_deleted, cu);
+  if (attr != nullptr && DW_UNSND (attr) != 0)
+    fnp->is_deleted = 1;
+
   fnp->is_constructor = dwarf2_is_constructor (die, cu);
 
   /* Get index in virtual function table if it is a virtual member
@@ -15823,6 +15852,26 @@
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
 }
 
+/* Check if the given VALUE is a valid enum dwarf_calling_convention
+   constant for a type, according to DWARF5 spec, Table 5.5.  */
+
+static bool
+is_valid_DW_AT_calling_convention_for_type (ULONGEST value)
+{
+  switch (value)
+    {
+    case DW_CC_normal:
+    case DW_CC_pass_by_reference:
+    case DW_CC_pass_by_value:
+      return true;
+
+    default:
+      complaint (_("unrecognized DW_AT_calling_convention value "
+		   "(%lu) for a type"), value);
+      return false;
+    }
+}
+
 /* Called when we find the DIE that starts a structure or union scope
    (definition) to create a type for the structure or union.  Fill in
    the type's name and general properties; the members will not be
@@ -15904,6 +15953,18 @@
   if (cu->language == language_cplus && die->tag == DW_TAG_class_type)
     TYPE_DECLARED_CLASS (type) = 1;
 
+  /* Store the calling convention in the type if it's available in
+     the die.  Otherwise the calling convention remains set to
+     the default value DW_CC_normal.  */
+  attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
+  if (attr != nullptr
+      && is_valid_DW_AT_calling_convention_for_type (DW_UNSND (attr)))
+    {
+      ALLOCATE_CPLUS_STRUCT_TYPE (type);
+      TYPE_CPLUS_CALLING_CONVENTION (type)
+	= (enum dwarf_calling_convention) (DW_UNSND (attr));
+    }
+
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
   if (attr != nullptr)
     {
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0896f71..7e80b45 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4494,6 +4494,10 @@
 			    TYPE_FN_FIELD_PROTECTED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "is_stub %d\n",
 			    TYPE_FN_FIELD_STUB (f, overload_idx));
+	  printfi_filtered (spaces + 8, "defaulted %d\n",
+			    TYPE_FN_FIELD_DEFAULTED (f, overload_idx));
+	  printfi_filtered (spaces + 8, "is_deleted %d\n",
+			    TYPE_FN_FIELD_DELETED (f, overload_idx));
 	  printfi_filtered (spaces + 8, "voffset %u\n",
 			    TYPE_FN_FIELD_VOFFSET (f, overload_idx));
 	}
@@ -4557,6 +4561,9 @@
     {
       dump_fn_fieldlists (type, spaces);
     }
+
+  printfi_filtered (spaces, "calling_convention %d\n",
+		    TYPE_CPLUS_CALLING_CONVENTION (type));
 }
 
 /* Print the contents of the TYPE's type_specific union, assuming that
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index a1d95e0..12fa437 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -50,6 +50,7 @@
 #include "gdbsupport/enum-flags.h"
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/print-utils.h"
+#include "dwarf2.h"
 
 /* Forward declarations for prototypes.  */
 struct field;
@@ -957,9 +958,18 @@
 
   unsigned int is_constructor : 1;
 
+  /* * True if this function is deleted, false otherwise.  */
+
+  unsigned int is_deleted : 1;
+
+  /* * DW_AT_defaulted attribute for this function.  The value is one
+     of the DW_DEFAULTED constants.  */
+
+  ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2;
+
   /* * Unused.  */
 
-  unsigned int dummy:9;
+  unsigned int dummy:6;
 
   /* * Index into that baseclass's virtual function table, minus 2;
      else if static: VOFFSET_STATIC; else: 0.  */
@@ -1033,6 +1043,12 @@
 
     int is_dynamic : 2;
 
+    /* * The calling convention for this type, fetched from the
+       DW_AT_calling_convention attribute.  The value is one of the
+       DW_CC constants.  */
+
+    ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+
     /* * The base class which defined the virtual function table pointer.  */
 
     struct type *vptr_basetype;
@@ -1437,6 +1453,8 @@
     ? (struct cplus_struct_type*)&cplus_struct_default \
     : TYPE_RAW_CPLUS_SPECIFIC(thistype))
 #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
+  TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
@@ -1553,6 +1571,8 @@
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
 #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
+#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
 
 /* Accessors for typedefs defined by a class.  */
 #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I54192f363115b78ec7435a8563b73fcace420765
Gerrit-Change-Number: 135
Gerrit-PatchSet: 5
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-12-20 16:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 13:53 [review] gdb: recognize new DWARF attributes: defaulted, deleted, calling conv Tankut Baris Aktemur (Code Review)
2019-10-18 14:02 ` Tankut Baris Aktemur (Code Review)
2019-10-23 14:31 ` Tom Tromey (Code Review)
2019-10-29 22:20 ` Tom Tromey (Code Review)
2019-10-30  3:30 ` Simon Marchi (Code Review)
2019-10-31  9:43 ` Tankut Baris Aktemur (Code Review)
2019-10-31 14:10 ` Simon Marchi (Code Review)
2019-10-31 17:22 ` Tankut Baris Aktemur (Code Review)
2019-10-31 17:24 ` [review v2] " Tankut Baris Aktemur (Code Review)
2019-10-31 17:57 ` Simon Marchi (Code Review)
2019-10-31 20:07 ` [review v3] " Tankut Baris Aktemur (Code Review)
2019-10-31 20:12 ` Simon Marchi (Code Review)
2019-10-31 20:12 ` Simon Marchi (Code Review)
2019-10-31 20:13 ` Tankut Baris Aktemur (Code Review)
2019-10-31 20:18 ` Simon Marchi (Code Review)
2019-12-20 16:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:47 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).