This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Handle function pointer types when calling functions
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Sun, 10 Sep 2006 11:44:21 -0400
- Subject: [commit] Handle function pointer types when calling functions
This patch fixes some crashes that Michael Veksler reported when calling C++
member functions; function pointer types are involved because of the virtual
keyword. We left FTYPE pointing at a pointer type, and then looked at its
TYPE_FIELDS to find the arguments - eventually concluding that it wasn't
a prototyped function, and failing to pass THIS.
Tested on x86_64-pc-linux-gnu and committed.
--
Daniel Jacobowitz
CodeSourcery
2006-09-10 Daniel Jacobowitz <dan@codesourcery.com>
* infcall.c (call_function_by_hand): Check for function pointer
types.
Index: src/gdb/infcall.c
===================================================================
--- src.orig/gdb/infcall.c 2006-08-30 16:19:00.000000000 -0400
+++ src/gdb/infcall.c 2006-08-30 16:18:43.000000000 -0400
@@ -337,6 +337,9 @@ call_function_by_hand (struct value *fun
struct cleanup *caller_regcache_cleanup;
struct frame_id dummy_id;
+ if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
+
if (!target_has_execution)
noprocess ();