aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-07-27 02:00:04 +0000
committerTom Tromey <tromey@redhat.com>2008-07-27 02:00:04 +0000
commitfa8de41e93025afa77b80acac961c517920f7158 (patch)
treecb7b2225f8e0ed6f86f5e7419bb55fd633f07b85 /gdb/testsuite/gdb.base
parentccb3ac8a121682a5fc5fd767f80872ef3e5c7b47 (diff)
downloadgdb-fa8de41e93025afa77b80acac961c517920f7158.zip
gdb-fa8de41e93025afa77b80acac961c517920f7158.tar.gz
gdb-fa8de41e93025afa77b80acac961c517920f7158.tar.bz2
gdb:
PR gdb/1158: * valops.c (value_struct_elt): Treat function-valued field as a static method. gdb/testsuite: * gdb.base/callfuncs.c (struct struct_with_fnptr): New struct. (function_struct, function_struct_ptr): New globals. * gdb.base/callfuncs.exp (do_function_calls): Test calling via a function pointer in a struct.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.c8
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp3
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c
index 5a150b0..655c698 100644
--- a/gdb/testsuite/gdb.base/callfuncs.c
+++ b/gdb/testsuite/gdb.base/callfuncs.c
@@ -490,6 +490,14 @@ int a, b;
return ((*func_arg1)(a, b));
}
+struct struct_with_fnptr
+{
+ int (*func) PARAMS((int));
+};
+
+struct struct_with_fnptr function_struct = { doubleit };
+
+struct struct_with_fnptr *function_struct_ptr = &function_struct;
/* Gotta have a main to be able to generate a linked, runnable
executable, and also provide a useful place to set a breakpoint. */
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 1a4da6e..bb85508 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -190,6 +190,9 @@ proc do_function_calls {} {
gdb_test "p t_func_values(func_val2,func_val1)" " = 0"
gdb_test "p t_func_values(func_val1,func_val2)" " = 1"
+ gdb_test "p function_struct.func(5)" " = 10"
+ gdb_test "p function_struct_ptr->func(10)" " = 20"
+
# GDB currently screws up the passing of function parameters for
# ABIs that use function descriptors. Instead of passing the
# address of te function descriptor, GDB passes the address of the