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 V4 3/6] Typeprint: Resolve any dynamic target type of a pointer.


On 05/10/2016 12:09, Yao Qi wrote:
Bernhard Heckel <bernhard.heckel@intel.com> writes:

+extern "C" {
+#include <stddef.h>
+}
+
Why do you include stddef.h?
definition of NULL
+  typeof (vla) *ptr = NULL;

diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index e77513e..e3d84c7 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -485,6 +485,25 @@ whatis_exp (char *exp, int show)
        printf_filtered (" */\n");
      }
+ /* Resolve any dynamic target type, as we might print
+     additional information about the target.
+     For example, in Fortran and C we are printing the dimension of the
+     dynamic array the pointer is pointing to.  */
+  if (TYPE_CODE (type) == TYPE_CODE_PTR
+      && is_dynamic_type (type) == 1)
is_dynamic_type returns bool-like value, so don't check it with 1.
Looks we need to check is_dynamic_type (TYPE_TARGET_TYPE (type)), no?
is_dynamic_type takes care of target types for pointer and reference types.
So, we can keep it.

+    {
+      CORE_ADDR addr;
+      if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE(type)))
+	addr = value_address (val);
+      else
+	addr = value_as_address (val);
+
+      if (addr != 0
+	  && type_not_associated (type) == 0)
likewise, !type_not_associated (type)

+	TYPE_TARGET_TYPE (type) = resolve_dynamic_type (TYPE_TARGET_TYPE (type),
+							NULL, addr);
+    }

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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