This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Revert "Do not consider reference types as dynamic"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e771e4be1393b629bc243e2b5ee1e91850334d5a

commit e771e4be1393b629bc243e2b5ee1e91850334d5a
Author: Pierre-Marie de Rodat <derodat@adacore.com>
Date:   Mon Apr 20 16:06:50 2015 +0200

    Revert "Do not consider reference types as dynamic"
    
    This reverts commit 961f41602529c9cd4f88af6c02fb61fb55100e27.
    
    Note that the revert is partial: it keeps the new testcases
    gdb.ada/funcall_ref.exp.

Diff:
---
 gdb/ChangeLog  |  9 +++++++++
 gdb/gdbtypes.c | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ea70a6b..d8aafa6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -2,6 +2,15 @@
 
 	Revert:
 	2015-04-03  Pierre-Marie de Rodat  <derodat@adacore.com>
+	* gdbtypes.c (is_dynamic_type_internal): Remove special handling of
+	TYPE_CODE_REF types so that they are not considered as dynamic
+	depending on the referenced type.
+	(resolve_dynamic_type_internal): Likewise.
+
+2015-04-20  Pierre-Marie de Rodat  <derodat@adacore.com>
+
+	Revert:
+	2015-04-03  Pierre-Marie de Rodat  <derodat@adacore.com>
 	* gdbtypes.c (is_dynamic_type_internal): Remove the unused
 	"top_level" parameter.
 	(resolve_dynamic_type_internal): Remove the unused "top_level"
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6fb2e9a..217ec70 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1752,6 +1752,10 @@ is_dynamic_type_internal (struct type *type, int top_level)
 {
   type = check_typedef (type);
 
+  /* We only want to recognize references at the outermost level.  */
+  if (top_level && TYPE_CODE (type) == TYPE_CODE_REF)
+    type = check_typedef (TYPE_TARGET_TYPE (type));
+
   /* Types that have a dynamic TYPE_DATA_LOCATION are considered
      dynamic, even if the type itself is statically defined.
      From a user's point of view, this may appear counter-intuitive;
@@ -2041,6 +2045,21 @@ resolve_dynamic_type_internal (struct type *type,
 
       switch (TYPE_CODE (type))
 	{
+	case TYPE_CODE_REF:
+	  {
+	    struct property_addr_info pinfo;
+
+	    pinfo.type = check_typedef (TYPE_TARGET_TYPE (type));
+	    pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
+	    pinfo.next = addr_stack;
+
+	    resolved_type = copy_type (type);
+	    TYPE_TARGET_TYPE (resolved_type)
+	      = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type),
+					       &pinfo, top_level);
+	    break;
+	  }
+
 	case TYPE_CODE_ARRAY:
 	  resolved_type = resolve_dynamic_array (type, addr_stack);
 	  break;


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