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]

Don't allow dereferencing void pointers, in agent expressions


Don't let the user collect *(void *)FOO, as we don't allow
printing *(void *)FOO as well.

Applied.

-- 
Pedro Alves

2010-02-11  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* ax-gdb.c (gen_deref): Don't allow dereferencing void pointers.

Index: gdb/ax-gdb.c
===================================================================
--- gdb/ax-gdb.c	(revisÃo 267866)
+++ gdb/ax-gdb.c	(revisÃo 267867)
@@ -1091,6 +1091,8 @@ gen_deref (struct agent_expr *ax, struct
      T" to "T", and mark the value as an lvalue in memory.  Leave it
      to the consumer to actually dereference it.  */
   value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
+  if (TYPE_CODE (value->type) == TYPE_CODE_VOID)
+    error (_("Attempt to dereference a generic pointer."));
   value->kind = ((TYPE_CODE (value->type) == TYPE_CODE_FUNC)
 		 ? axs_rvalue : axs_lvalue_memory);
 }


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