aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-06 14:47:00 +0000
committerTom Tromey <tromey@redhat.com>2012-07-06 14:47:00 +0000
commit71918a863fdc11435a0f47a1b3e49bfdf44f6ef5 (patch)
treeeec937131aa13c30d07f679b04e427899e4f7238 /gdb/parse.c
parentfcde5961ebacc85a85adcf858c751dc9c11f8d58 (diff)
downloadgdb-71918a863fdc11435a0f47a1b3e49bfdf44f6ef5.zip
gdb-71918a863fdc11435a0f47a1b3e49bfdf44f6ef5.tar.gz
gdb-71918a863fdc11435a0f47a1b3e49bfdf44f6ef5.tar.bz2
PR exp/9608:
* c-exp.y (%union) <tvec>: Change type. (func_mod): Now uses <tvec> type. (exp): Update for tvec change. (direct_abs_decl): Push the typelist. (func_mod): Return a typelist. (nonempty_typelist): Update for tvec change. * gdbtypes.c (lookup_function_type_with_arguments): New function. * gdbtypes.h (lookup_function_type_with_arguments): Declare. * parse.c (pop_type_list): New function. (push_typelist): New function. (follow_types): Handle tp_function_with_arguments. * parser-defs.h (type_ptr): New typedef. Define a VEC. (enum type_pieces) <tp_function_with_arguments>: New constant. (union type_stack_elt) <typelist_val>: New field. (push_typelist): Declare. testsuite * gdb.base/whatis.exp: Add regression test.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index b1ad832..897002d 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1483,6 +1483,15 @@ pop_type_int (void)
return 0;
}
+/* Pop a type list element from the global type stack. */
+
+static VEC (type_ptr) *
+pop_typelist (void)
+{
+ gdb_assert (type_stack.depth);
+ return type_stack.elements[--type_stack.depth].typelist_val;
+}
+
/* Pop a type_stack element from the global type stack. */
static struct type_stack *
@@ -1545,6 +1554,17 @@ type_stack_cleanup (void *arg)
xfree (stack);
}
+/* Push a function type with arguments onto the global type stack.
+ LIST holds the argument types. */
+
+void
+push_typelist (VEC (type_ptr) *list)
+{
+ check_type_stack_depth ();
+ type_stack.elements[type_stack.depth++].typelist_val = list;
+ push_type (tp_function_with_arguments);
+}
+
/* Pop the type stack and return the type which corresponds to FOLLOW_TYPE
as modified by all the stuff on the stack. */
struct type *
@@ -1632,6 +1652,19 @@ follow_types (struct type *follow_type)
follow_type = lookup_function_type (follow_type);
break;
+ case tp_function_with_arguments:
+ {
+ VEC (type_ptr) *args = pop_typelist ();
+
+ follow_type
+ = lookup_function_type_with_arguments (follow_type,
+ VEC_length (type_ptr, args),
+ VEC_address (type_ptr,
+ args));
+ VEC_free (type_ptr, args);
+ }
+ break;
+
case tp_type_stack:
{
struct type_stack *stack = pop_type_stack ();