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]

[unavailable values part 1, 07/17] get rid of INTERNALVAR_POINTER


INTERNALVAR_POINTER was introduced in
<http://sourceware.org/ml/gdb-patches/2009-08/msg00310.html>

	* value.c (enum internalvar_kind): Replace INTERNALVAR_SCALAR by
	INTERNALVAR_INTEGER and INTERNALVAR_POINTER.

But looking at the code, I can't see any reason to have
INTERNALVAR_POINTER, if we're always storing a type and a
CORE_ADDR and reconstructing a struct value from those
unconditionaly.  Might as well just let the INTERNALVAR_VALUE
code handle pointers and avoid the peeling/reconstructing:

     /* The value of the internal variable is provided directly as
	 a GDB value object.  */
      INTERNALVAR_VALUE,

... and avoids having to teach INTERNALVAR_POINTER
about unavailable bytes.

Running the testsuite showed nothing regressing.

-- 
Pedro Alves

2011-02-07  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* value.c (struct internalvar) <enum internalvar_kind>: Remove
	INTERNALVAR_POINTER.
	<pointer>: Delete.
	(value_of_internalvar): Remove INTERNALVAR_POINTER handling.
	(set_internalvar): Remove special TYPE_CODE_PTR handling.
	(preserve_one_internalvar): Remove INTERNALVAR_POINTER handling.

---
 gdb/value.c |   26 --------------------------
 1 file changed, 26 deletions(-)

Index: src/gdb/value.c
===================================================================
--- src.orig/gdb/value.c	2011-01-31 19:54:04.944645004 +0000
+++ src/gdb/value.c	2011-01-31 19:57:59.424645004 +0000
@@ -1305,9 +1305,6 @@ struct internalvar
       /* The variable holds an integer value.  */
       INTERNALVAR_INTEGER,
 
-      /* The variable holds a pointer value.  */
-      INTERNALVAR_POINTER,
-
       /* The variable holds a GDB-provided string.  */
       INTERNALVAR_STRING,
 
@@ -1339,13 +1336,6 @@ struct internalvar
 	  LONGEST val;
         } integer;
 
-      /* A pointer value used with INTERNALVAR_POINTER.  */
-      struct
-        {
-	  struct type *type;
-	  CORE_ADDR val;
-        } pointer;
-
       /* A string value used with INTERNALVAR_STRING.  */
       char *string;
     } u;
@@ -1497,10 +1487,6 @@ value_of_internalvar (struct gdbarch *gd
 	val = value_from_longest (var->u.integer.type, var->u.integer.val);
       break;
 
-    case INTERNALVAR_POINTER:
-      val = value_from_pointer (var->u.pointer.type, var->u.pointer.val);
-      break;
-
     case INTERNALVAR_STRING:
       val = value_cstring (var->u.string, strlen (var->u.string),
 			   builtin_type (gdbarch)->builtin_char);
@@ -1631,12 +1617,6 @@ set_internalvar (struct internalvar *var
       new_data.integer.val = value_as_long (val);
       break;
 
-    case TYPE_CODE_PTR:
-      new_kind = INTERNALVAR_POINTER;
-      new_data.pointer.type = value_type (val);
-      new_data.pointer.val = value_as_address (val);
-      break;
-
     default:
       new_kind = INTERNALVAR_VALUE;
       new_data.value = value_copy (val);
@@ -1835,12 +1815,6 @@ preserve_one_internalvar (struct interna
 	  = copy_type_recursive (objfile, var->u.integer.type, copied_types);
       break;
 
-    case INTERNALVAR_POINTER:
-      if (TYPE_OBJFILE (var->u.pointer.type) == objfile)
-	var->u.pointer.type
-	  = copy_type_recursive (objfile, var->u.pointer.type, copied_types);
-      break;
-
     case INTERNALVAR_VALUE:
       preserve_one_value (var->u.value, objfile, copied_types);
       break;


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