diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/callfuncs.c | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/callfuncs.exp | 3 | ||||
-rw-r--r-- | gdb/valops.c | 4 |
5 files changed, 28 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5db0b0c53cf..99b8f54209d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2008-07-26 Tom Tromey <tromey@redhat.com> + PR gdb/1158: + * valops.c (value_struct_elt): Treat function-valued field as a + static method. + +2008-07-26 Tom Tromey <tromey@redhat.com> + PR gdb/1136: * macroexp.c (get_punctuator) <punctuators>: Rearrange to put longer tokens first. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4047c48bca0..75b90e1add0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2008-07-26 Tom Tromey <tromey@redhat.com> + * 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. + +2008-07-26 Tom Tromey <tromey@redhat.com> + * gdb.base/macscp.exp: Add test for macro lexing bug. 2008-07-18 Tom Tromey <tromey@redhat.com> diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c index 5a150b09718..655c698121b 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 1a4da6e0b69..bb855083da0 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 diff --git a/gdb/valops.c b/gdb/valops.c index aad9871f713..8c99218683e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1819,6 +1819,10 @@ value_struct_elt (struct value **argp, struct value **args, back. If it's not callable (i.e., a pointer to function), gdb should give an error. */ v = search_struct_field (name, *argp, 0, t, 0); + /* If we found an ordinary field, then it is not a method call. + So, treat it as if it were a static member function. */ + if (v && static_memfuncp) + *static_memfuncp = 1; } if (!v) |