This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Don't allow dereferencing void pointers, in agent expressions
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 11 Feb 2010 18:50:24 +0000
- Subject: 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);
}