Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Do not consider reference types as dynamic
Date: Fri, 03 Apr 2015 13:02:00 -0000	[thread overview]
Message-ID: <551E8F70.9070408@adacore.com> (raw)
In-Reply-To: <20150403124724.GC4704@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

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

[-- Attachment #2: 0001-gdbtypes.c-remove-the-usuned-top_level-parameter.patch --]
[-- Type: text/x-diff, Size: 5196 bytes --]

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


  reply	other threads:[~2015-04-03 13:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 11:57 Pierre-Marie de Rodat
2015-03-23 13:36 ` Joel Brobecker
2015-04-01  8:52   ` Pierre-Marie de Rodat
2015-04-03  8:45     ` Pierre-Marie de Rodat
2015-04-03 12:47       ` Joel Brobecker
2015-04-03 13:02         ` Pierre-Marie de Rodat [this message]
2015-04-03 13:12           ` Joel Brobecker
2015-04-03 13:25             ` Pierre-Marie de Rodat
2015-04-17 10:47       ` Yao Qi
2015-04-17 11:20         ` Pierre-Marie de Rodat
2015-04-17 15:07           ` Pierre-Marie de Rodat
2015-04-17 15:29             ` Joel Brobecker
2015-04-20 14:27               ` Pierre-Marie de Rodat
2015-04-24 14:22                 ` Pierre-Marie de Rodat

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=551E8F70.9070408@adacore.com \
    --to=derodat@adacore.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

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

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