Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref
  2013-07-23 11:03 [PATCH 0/2] Minor dwarf2read cleanups Sanimir Agovic
@ 2013-07-23 11:03 ` Sanimir Agovic
  2013-07-23 13:55   ` Tom Tromey
  2013-07-23 11:03 ` [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates Sanimir Agovic
  1 sibling, 1 reply; 7+ messages in thread
From: Sanimir Agovic @ 2013-07-23 11:03 UTC (permalink / raw)
  To: gdb-patches

Renamed dwarf form predicate function to match the naming schema.
Grouped functions.

gdb:

2013-07-24  Sanimir Agovic  <sanimir.agovi@intel.com>

	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
	All uses updated.

Change-Id: I3df124bebcd491dfd55f64dc7d83ce7c4ecc79f5
---
 gdb/dwarf2read.c |   65 +++++++++++++++++++++++++++--------------------------
 1 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 94727a7..1ee36bb 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1608,8 +1608,6 @@ static void dump_die_1 (struct ui_file *, int level, int max_level,
 static void store_in_ref_table (struct die_info *,
 				struct dwarf2_cu *);
 
-static int is_ref_attr (struct attribute *);
-
 static sect_offset dwarf2_get_ref_die_offset (struct attribute *);
 
 static LONGEST dwarf2_get_attr_constant_value (struct attribute *, int);
@@ -1657,6 +1655,8 @@ static int attr_form_is_section_offset (struct attribute *);
 
 static int attr_form_is_constant (struct attribute *);
 
+static int attr_form_is_ref (struct attribute *);
+
 static void fill_in_loclist_baton (struct dwarf2_cu *cu,
 				   struct dwarf2_loclist_baton *baton,
 				   struct attribute *attr);
@@ -10364,7 +10364,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
       SET_FIELD_DWARF_BLOCK (call_site->target, dlbaton);
     }
-  else if (is_ref_attr (attr))
+  else if (attr_form_is_ref (attr))
     {
       struct dwarf2_cu *target_cu = cu;
       struct die_info *target_die;
@@ -10437,7 +10437,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 
       loc = dwarf2_attr (child_die, DW_AT_location, cu);
       origin = dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
-      if (loc == NULL && origin != NULL && is_ref_attr (origin))
+      if (loc == NULL && origin != NULL && attr_form_is_ref (origin))
 	{
 	  sect_offset offset;
 
@@ -13379,7 +13379,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
   if (attr)
     {
-      if (attr_form_is_block (attr) || is_ref_attr (attr))
+      if (attr_form_is_block (attr) || attr_form_is_ref (attr))
         {
           /* GCC encodes arrays with unspecified or dynamic length
              with a DW_FORM_block1 attribute or a reference attribute.
@@ -14820,7 +14820,7 @@ read_attribute_value (const struct die_reader_specs *reader,
     }
 
   /* Super hack.  */
-  if (cu->per_cu->is_dwz && is_ref_attr (attr))
+  if (cu->per_cu->is_dwz && attr_form_is_ref (attr))
     attr->form = DW_FORM_GNU_ref_alt;
 
   /* We have seen instances where the compiler tried to emit a byte
@@ -17078,7 +17078,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
       per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile);
       this_type = get_die_type_at_offset (offset, per_cu);
     }
-  else if (is_ref_attr (attr))
+  else if (attr_form_is_ref (attr))
     {
       sect_offset offset = dwarf2_get_ref_die_offset (attr);
 
@@ -17107,7 +17107,7 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
       struct die_info *type_die = NULL;
       struct dwarf2_cu *type_cu = cu;
 
-      if (is_ref_attr (attr))
+      if (attr_form_is_ref (attr))
 	type_die = follow_die_ref (die, attr, &type_cu);
       if (type_die == NULL)
 	return build_error_marker_type (cu, die);
@@ -17950,27 +17950,6 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu)
   *slot = die;
 }
 
-/* DW_ADDR is always stored already as sect_offset; despite for the forms
-   besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file.  */
-
-static int
-is_ref_attr (struct attribute *attr)
-{
-  switch (attr->form)
-    {
-    case DW_FORM_ref_addr:
-    case DW_FORM_ref1:
-    case DW_FORM_ref2:
-    case DW_FORM_ref4:
-    case DW_FORM_ref8:
-    case DW_FORM_ref_udata:
-    case DW_FORM_GNU_ref_alt:
-      return 1;
-    default:
-      return 0;
-    }
-}
-
 /* Return DIE offset of ATTR.  Return 0 with complaint if ATTR is not of the
    required kind.  */
 
@@ -17979,7 +17958,7 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
 {
   sect_offset retval = { DW_UNSND (attr) };
 
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     return retval;
 
   retval.sect_off = 0;
@@ -18022,7 +18001,7 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr,
 {
   struct die_info *die;
 
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     die = follow_die_ref (src_die, attr, ref_cu);
   else if (attr->form == DW_FORM_ref_sig8)
     die = follow_die_sig (src_die, attr, ref_cu);
@@ -18505,7 +18484,7 @@ get_DW_AT_signature_type (struct die_info *die, struct attribute *attr,
 			  struct dwarf2_cu *cu) /* ARI: editCase function */
 {
   /* Yes, DW_AT_signature can use a non-ref_sig8 reference.  */
-  if (is_ref_attr (attr))
+  if (attr_form_is_ref (attr))
     {
       struct dwarf2_cu *type_cu = cu;
       struct die_info *type_die = follow_die_ref (die, attr, &type_cu);
@@ -19873,6 +19852,28 @@ attr_form_is_constant (struct attribute *attr)
     }
 }
 
+
+/* DW_ADDR is always stored already as sect_offset; despite for the forms
+   besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file.  */
+
+static int
+attr_form_is_ref (struct attribute *attr)
+{
+  switch (attr->form)
+    {
+    case DW_FORM_ref_addr:
+    case DW_FORM_ref1:
+    case DW_FORM_ref2:
+    case DW_FORM_ref4:
+    case DW_FORM_ref8:
+    case DW_FORM_ref_udata:
+    case DW_FORM_GNU_ref_alt:
+      return 1;
+    default:
+      return 0;
+    }
+}
+
 /* Return the .debug_loc section to use for CU.
    For DWO files use .debug_loc.dwo.  */
 
-- 
1.7.1.1


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

* [PATCH 0/2] Minor dwarf2read cleanups
@ 2013-07-23 11:03 Sanimir Agovic
  2013-07-23 11:03 ` [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref Sanimir Agovic
  2013-07-23 11:03 ` [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates Sanimir Agovic
  0 siblings, 2 replies; 7+ messages in thread
From: Sanimir Agovic @ 2013-07-23 11:03 UTC (permalink / raw)
  To: gdb-patches

Hello,

the following two patches do minor cleanups in dwarf2read to
streamline the naming schema and to constify the argument passed 
to dwarf form predicate functions.

 -Sanimir

Sanimir Agovic (2):
  cleanup: rename is_ref_attr to attr_form_is_ref
  cleanup: constify argument passed to dwarf form predicates

 gdb/dwarf2read.c |   77 +++++++++++++++++++++++++++--------------------------
 1 files changed, 39 insertions(+), 38 deletions(-)


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

* [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates
  2013-07-23 11:03 [PATCH 0/2] Minor dwarf2read cleanups Sanimir Agovic
  2013-07-23 11:03 ` [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref Sanimir Agovic
@ 2013-07-23 11:03 ` Sanimir Agovic
  2013-07-23 13:53   ` Tom Tromey
  1 sibling, 1 reply; 7+ messages in thread
From: Sanimir Agovic @ 2013-07-23 11:03 UTC (permalink / raw)
  To: gdb-patches

Dwarf form predicate functions do not modify their argument and thus made
them const.

gdb:

2013-07-23  Sanimir Agovic  <sanimir.agovic@inte.com>

	dwarf2read.c (attr_form_is_block): Make argument const.
	(attr_form_is_section_offset): Make argument const.
	(attr_form_is_constant): Make argument const.
	(attr_form_is_ref): Make argument const.

Change-Id: Ide9aae7260e904b76470b48973037d43e23c180a
---
 gdb/dwarf2read.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1ee36bb..6fe1686 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1649,13 +1649,13 @@ static struct die_info *dwarf_alloc_die (struct dwarf2_cu *, int);
 static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int,
 				 const char *, int);
 
-static int attr_form_is_block (struct attribute *);
+static int attr_form_is_block (const struct attribute *);
 
-static int attr_form_is_section_offset (struct attribute *);
+static int attr_form_is_section_offset (const struct attribute *);
 
-static int attr_form_is_constant (struct attribute *);
+static int attr_form_is_constant (const struct attribute *);
 
-static int attr_form_is_ref (struct attribute *);
+static int attr_form_is_ref (const struct attribute *);
 
 static void fill_in_loclist_baton (struct dwarf2_cu *cu,
 				   struct dwarf2_loclist_baton *baton,
@@ -19795,7 +19795,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
    if so return true else false.  */
 
 static int
-attr_form_is_block (struct attribute *attr)
+attr_form_is_block (const struct attribute *attr)
 {
   return (attr == NULL ? 0 :
       attr->form == DW_FORM_block1
@@ -19815,7 +19815,7 @@ attr_form_is_block (struct attribute *attr)
    of them.  */
 
 static int
-attr_form_is_section_offset (struct attribute *attr)
+attr_form_is_section_offset (const struct attribute *attr)
 {
   return (attr->form == DW_FORM_data4
           || attr->form == DW_FORM_data8
@@ -19836,7 +19836,7 @@ attr_form_is_section_offset (struct attribute *attr)
    taken as section offsets, not constants.  */
 
 static int
-attr_form_is_constant (struct attribute *attr)
+attr_form_is_constant (const struct attribute *attr)
 {
   switch (attr->form)
     {
@@ -19857,7 +19857,7 @@ attr_form_is_constant (struct attribute *attr)
    besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file.  */
 
 static int
-attr_form_is_ref (struct attribute *attr)
+attr_form_is_ref (const struct attribute *attr)
 {
   switch (attr->form)
     {
-- 
1.7.1.1


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

* Re: [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates
  2013-07-23 11:03 ` [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates Sanimir Agovic
@ 2013-07-23 13:53   ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2013-07-23 13:53 UTC (permalink / raw)
  To: Sanimir Agovic; +Cc: gdb-patches

>>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:

Sanimir> 2013-07-23  Sanimir Agovic  <sanimir.agovic@inte.com>
Sanimir> 	dwarf2read.c (attr_form_is_block): Make argument const.
Sanimir> 	(attr_form_is_section_offset): Make argument const.
Sanimir> 	(attr_form_is_constant): Make argument const.
Sanimir> 	(attr_form_is_ref): Make argument const.

Ok.

Tom


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

* Re: [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref
  2013-07-23 11:03 ` [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref Sanimir Agovic
@ 2013-07-23 13:55   ` Tom Tromey
  2013-07-23 14:10     ` Agovic, Sanimir
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2013-07-23 13:55 UTC (permalink / raw)
  To: Sanimir Agovic; +Cc: gdb-patches

>>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:

Sanimir> 2013-07-24  Sanimir Agovic  <sanimir.agovi@intel.com>

Sanimir> 	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
Sanimir> 	All uses updated.

The patch is ok.
I think the ChangeLog should mention that the function moved.

thanks,
Tom


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

* RE: [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref
  2013-07-23 13:55   ` Tom Tromey
@ 2013-07-23 14:10     ` Agovic, Sanimir
  2013-07-23 14:32       ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Agovic, Sanimir @ 2013-07-23 14:10 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: gdb-patches

2013-07-24  Sanimir Agovic  <sanimir.agovic@intel.com>

	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
	All uses updated.
	(attr_form_is_ref): Move below attr_form_is_constant.

OK?

 -Sanimir

> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Tuesday, July 23, 2013 03:55 PM
> To: Agovic, Sanimir
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref
> 
> >>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:
> 
> Sanimir> 2013-07-24  Sanimir Agovic  <sanimir.agovi@intel.com>
> 
> Sanimir> 	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
> Sanimir> 	All uses updated.
> 
> The patch is ok.
> I think the ChangeLog should mention that the function moved.
> 
> thanks,
> Tom
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


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

* Re: [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref
  2013-07-23 14:10     ` Agovic, Sanimir
@ 2013-07-23 14:32       ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2013-07-23 14:32 UTC (permalink / raw)
  To: Agovic, Sanimir; +Cc: gdb-patches

>>>>> "Sanimir" == Agovic, Sanimir <sanimir.agovic@intel.com> writes:

Sanimir> 2013-07-24  Sanimir Agovic  <sanimir.agovic@intel.com>
Sanimir> 	* dwarf2read.c (attr_is_ref): Rename to attr_form_is_ref.
Sanimir> 	All uses updated.
Sanimir> 	(attr_form_is_ref): Move below attr_form_is_constant.

Sanimir> OK?

Sure, thanks.

Tom


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

end of thread, other threads:[~2013-07-23 14:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-23 11:03 [PATCH 0/2] Minor dwarf2read cleanups Sanimir Agovic
2013-07-23 11:03 ` [PATCH 1/2] cleanup: rename is_ref_attr to attr_form_is_ref Sanimir Agovic
2013-07-23 13:55   ` Tom Tromey
2013-07-23 14:10     ` Agovic, Sanimir
2013-07-23 14:32       ` Tom Tromey
2013-07-23 11:03 ` [PATCH 2/2] cleanup: constify argument passed to dwarf form predicates Sanimir Agovic
2013-07-23 13:53   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox