This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not consider reference types as dynamic


On 04/03/2015 02:47 PM, Joel Brobecker wrote:
This is OK, thank you, Pierre-Marie.

Cool! Thank you for the review!

Note that the parameter "top_level" is no longer useful after
this patch is applied, which is actually quite a nice side-effect
of this patch. I hum'ed and ah'ed about whether to ask that it be
removed as part of this patch, but in the end, I decided that this patch
was fine without the cleanup, as "top_level" is used a several places,
and I felt that cleaning it up here would dilute a bit the essence of
this patch.  So, I think we can clean it up separately.

Oh, you are right, I did not notice this. The attached patch does this cleanup. No regression on x86_64-linux. Better to push these two in the same time. ;-)

[PATCH] gdbtypes.c: remove the usuned "top_level" parameter

This paramater is no longer useful after the previous commit, so remove
it as a cleanup.

gdb/ChangeLog:

        * gdbtypes.c (is_dynamic_type_internal): Remove the unused
        "top_level" parameter.
        (resolve_dynamic_type_internal): Remove the unused "top_level"
        parameter.  Update call to is_dynamic_type_internal.
        (is_dynamic_type): Update call to is_dynamic_type_internal.
        (resolve_dynamic_range): Update call to
        resolve_dynamic_type_internal.
        (resolve_dynamic_union): Likewise.
        (resolve_dynamic_struct): Likewise.
        (resolve_dynamic_type): Likewise.

--
Pierre-Marie de Rodat
>From 3e0a648d8c966e902a3d1c2779b499535d3f443b Mon Sep 17 00:00:00 2001
From: Pierre-Marie de Rodat <derodat@adacore.com>
Date: Fri, 3 Apr 2015 14:53:12 +0200
Subject: [PATCH] gdbtypes.c: remove the usuned "top_level" parameter

This paramater is no longer useful after the previous commit, so remove
it as a cleanup.

gdb/ChangeLog:

	* gdbtypes.c (is_dynamic_type_internal): Remove the unused
	"top_level" parameter.
	(resolve_dynamic_type_internal): Remove the unused "top_level"
	parameter.  Update call to is_dynamic_type_internal.
	(is_dynamic_type): Update call to is_dynamic_type_internal.
	(resolve_dynamic_range): Update call to
	resolve_dynamic_type_internal.
	(resolve_dynamic_union): Likewise.
	(resolve_dynamic_struct): Likewise.
	(resolve_dynamic_type): Likewise.
---
 gdb/gdbtypes.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6fb2e9a..4aec5ec 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1748,7 +1748,7 @@ stub_noname_complaint (void)
 /* Worker for is_dynamic_type.  */
 
 static int
-is_dynamic_type_internal (struct type *type, int top_level)
+is_dynamic_type_internal (struct type *type)
 {
   type = check_typedef (type);
 
@@ -1773,7 +1773,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
 	   of the range type are static.  It allows us to assume that
 	   the subtype of a static range type is also static.  */
 	return (!has_static_range (TYPE_RANGE_DATA (type))
-		|| is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0));
+		|| is_dynamic_type_internal (TYPE_TARGET_TYPE (type)));
       }
 
     case TYPE_CODE_ARRAY:
@@ -1782,9 +1782,9 @@ is_dynamic_type_internal (struct type *type, int top_level)
 
 	/* The array is dynamic if either the bounds are dynamic,
 	   or the elements it contains have a dynamic contents.  */
-	if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0))
+	if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type)))
 	  return 1;
-	return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0);
+	return is_dynamic_type_internal (TYPE_TARGET_TYPE (type));
       }
 
     case TYPE_CODE_STRUCT:
@@ -1794,7 +1794,7 @@ is_dynamic_type_internal (struct type *type, int top_level)
 
 	for (i = 0; i < TYPE_NFIELDS (type); ++i)
 	  if (!field_is_static (&TYPE_FIELD (type, i))
-	      && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
+	      && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i)))
 	    return 1;
       }
       break;
@@ -1808,11 +1808,11 @@ is_dynamic_type_internal (struct type *type, int top_level)
 int
 is_dynamic_type (struct type *type)
 {
-  return is_dynamic_type_internal (type, 1);
+  return is_dynamic_type_internal (type);
 }
 
 static struct type *resolve_dynamic_type_internal
-  (struct type *type, struct property_addr_info *addr_stack, int top_level);
+  (struct type *type, struct property_addr_info *addr_stack);
 
 /* Given a dynamic range type (dyn_range_type) and a stack of
    struct property_addr_info elements, return a static version
@@ -1860,7 +1860,7 @@ resolve_dynamic_range (struct type *dyn_range_type,
 
   static_target_type
     = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type),
-				     addr_stack, 0);
+				     addr_stack);
   static_range_type = create_range_type (copy_type (dyn_range_type),
 					 static_target_type,
 					 &low_bound, &high_bound);
@@ -1928,7 +1928,7 @@ resolve_dynamic_union (struct type *type,
 	continue;
 
       t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
-					 addr_stack, 0);
+					 addr_stack);
       TYPE_FIELD_TYPE (resolved_type, i) = t;
       if (TYPE_LENGTH (t) > max_len)
 	max_len = TYPE_LENGTH (t);
@@ -1985,7 +1985,7 @@ resolve_dynamic_struct (struct type *type,
 
       TYPE_FIELD_TYPE (resolved_type, i)
 	= resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
-					 &pinfo, 0);
+					 &pinfo);
       gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
 		  == FIELD_LOC_KIND_BITPOS);
 
@@ -2016,23 +2016,21 @@ resolve_dynamic_struct (struct type *type,
 
 static struct type *
 resolve_dynamic_type_internal (struct type *type,
-			       struct property_addr_info *addr_stack,
-			       int top_level)
+			       struct property_addr_info *addr_stack)
 {
   struct type *real_type = check_typedef (type);
   struct type *resolved_type = type;
   struct dynamic_prop *prop;
   CORE_ADDR value;
 
-  if (!is_dynamic_type_internal (real_type, top_level))
+  if (!is_dynamic_type_internal (real_type))
     return type;
 
   if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
     {
       resolved_type = copy_type (type);
       TYPE_TARGET_TYPE (resolved_type)
-	= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack,
-					 top_level);
+	= resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack);
     }
   else 
     {
@@ -2077,7 +2075,7 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr)
 {
   struct property_addr_info pinfo = {check_typedef (type), addr, NULL};
 
-  return resolve_dynamic_type_internal (type, &pinfo, 1);
+  return resolve_dynamic_type_internal (type, &pinfo);
 }
 
 /* See gdbtypes.h  */
-- 
2.3.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]