mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
* parser-defs.h (type_stack, type_stack_size, type_stack_depth):
Remove. (struct type_stack): New. * parse.c (type_stack, type_stack_size, type_stack_depth): Remove. (type_stack): New global. (parse_exp_in_context, check_type_stack_depth) (insert_into_type_stack, insert_type, push_type, push_type_int) (insert_type_address_space, pop_type, pop_type_int) (_initialize_parse): Update.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
2012-07-06 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* parser-defs.h (type_stack, type_stack_size, type_stack_depth):
|
||||||
|
Remove.
|
||||||
|
(struct type_stack): New.
|
||||||
|
* parse.c (type_stack, type_stack_size, type_stack_depth):
|
||||||
|
Remove.
|
||||||
|
(type_stack): New global.
|
||||||
|
(parse_exp_in_context, check_type_stack_depth)
|
||||||
|
(insert_into_type_stack, insert_type, push_type, push_type_int)
|
||||||
|
(insert_type_address_space, pop_type, pop_type_int)
|
||||||
|
(_initialize_parse): Update.
|
||||||
|
|
||||||
2012-07-06 Tom Tromey <tromey@redhat.com>
|
2012-07-06 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* c-exp.y (func_mod, direct_abs_decl, abs_decl, ptr_operator):
|
* c-exp.y (func_mod, direct_abs_decl, abs_decl, ptr_operator):
|
||||||
|
48
gdb/parse.c
48
gdb/parse.c
@ -75,8 +75,7 @@ struct block *expression_context_block;
|
|||||||
CORE_ADDR expression_context_pc;
|
CORE_ADDR expression_context_pc;
|
||||||
struct block *innermost_block;
|
struct block *innermost_block;
|
||||||
int arglist_len;
|
int arglist_len;
|
||||||
union type_stack_elt *type_stack;
|
static struct type_stack type_stack;
|
||||||
int type_stack_depth, type_stack_size;
|
|
||||||
char *lexptr;
|
char *lexptr;
|
||||||
char *prev_lexptr;
|
char *prev_lexptr;
|
||||||
int paren_depth;
|
int paren_depth;
|
||||||
@ -1123,7 +1122,7 @@ parse_exp_in_context (char **stringptr, CORE_ADDR pc, struct block *block,
|
|||||||
prev_lexptr = NULL;
|
prev_lexptr = NULL;
|
||||||
|
|
||||||
paren_depth = 0;
|
paren_depth = 0;
|
||||||
type_stack_depth = 0;
|
type_stack.depth = 0;
|
||||||
expout_last_struct = -1;
|
expout_last_struct = -1;
|
||||||
|
|
||||||
comma_terminates = comma;
|
comma_terminates = comma;
|
||||||
@ -1362,11 +1361,12 @@ parse_c_float (struct gdbarch *gdbarch, const char *p, int len,
|
|||||||
static void
|
static void
|
||||||
check_type_stack_depth (void)
|
check_type_stack_depth (void)
|
||||||
{
|
{
|
||||||
if (type_stack_depth == type_stack_size)
|
if (type_stack.depth == type_stack.size)
|
||||||
{
|
{
|
||||||
type_stack_size *= 2;
|
type_stack.size *= 2;
|
||||||
type_stack = (union type_stack_elt *)
|
type_stack.elements
|
||||||
xrealloc ((char *) type_stack, type_stack_size * sizeof (*type_stack));
|
= xrealloc (type_stack.elements,
|
||||||
|
type_stack.size * sizeof (union type_stack_elt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1379,11 +1379,11 @@ insert_into_type_stack (int slot, union type_stack_elt element)
|
|||||||
{
|
{
|
||||||
check_type_stack_depth ();
|
check_type_stack_depth ();
|
||||||
|
|
||||||
if (slot < type_stack_depth)
|
if (slot < type_stack.depth)
|
||||||
memmove (&type_stack[slot + 1], &type_stack[slot],
|
memmove (&type_stack.elements[slot + 1], &type_stack.elements[slot],
|
||||||
(type_stack_depth - slot) * sizeof (union type_stack_elt));
|
(type_stack.depth - slot) * sizeof (union type_stack_elt));
|
||||||
type_stack[slot] = element;
|
type_stack.elements[slot] = element;
|
||||||
++type_stack_depth;
|
++type_stack.depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert a new type, TP, at the bottom of the type stack. If TP is
|
/* Insert a new type, TP, at the bottom of the type stack. If TP is
|
||||||
@ -1404,7 +1404,7 @@ insert_type (enum type_pieces tp)
|
|||||||
/* If there is anything on the stack (we know it will be a
|
/* If there is anything on the stack (we know it will be a
|
||||||
tp_pointer), insert the qualifier above it. Otherwise, simply
|
tp_pointer), insert the qualifier above it. Otherwise, simply
|
||||||
push this on the top of the stack. */
|
push this on the top of the stack. */
|
||||||
if (type_stack_depth && (tp == tp_const || tp == tp_volatile))
|
if (type_stack.depth && (tp == tp_const || tp == tp_volatile))
|
||||||
slot = 1;
|
slot = 1;
|
||||||
else
|
else
|
||||||
slot = 0;
|
slot = 0;
|
||||||
@ -1417,14 +1417,14 @@ void
|
|||||||
push_type (enum type_pieces tp)
|
push_type (enum type_pieces tp)
|
||||||
{
|
{
|
||||||
check_type_stack_depth ();
|
check_type_stack_depth ();
|
||||||
type_stack[type_stack_depth++].piece = tp;
|
type_stack.elements[type_stack.depth++].piece = tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
push_type_int (int n)
|
push_type_int (int n)
|
||||||
{
|
{
|
||||||
check_type_stack_depth ();
|
check_type_stack_depth ();
|
||||||
type_stack[type_stack_depth++].int_val = n;
|
type_stack.elements[type_stack.depth++].int_val = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert a tp_space_identifier and the corresponding address space
|
/* Insert a tp_space_identifier and the corresponding address space
|
||||||
@ -1444,7 +1444,7 @@ insert_type_address_space (char *string)
|
|||||||
/* If there is anything on the stack (we know it will be a
|
/* If there is anything on the stack (we know it will be a
|
||||||
tp_pointer), insert the address space qualifier above it.
|
tp_pointer), insert the address space qualifier above it.
|
||||||
Otherwise, simply push this on the top of the stack. */
|
Otherwise, simply push this on the top of the stack. */
|
||||||
if (type_stack_depth)
|
if (type_stack.depth)
|
||||||
slot = 1;
|
slot = 1;
|
||||||
else
|
else
|
||||||
slot = 0;
|
slot = 0;
|
||||||
@ -1458,16 +1458,16 @@ insert_type_address_space (char *string)
|
|||||||
enum type_pieces
|
enum type_pieces
|
||||||
pop_type (void)
|
pop_type (void)
|
||||||
{
|
{
|
||||||
if (type_stack_depth)
|
if (type_stack.depth)
|
||||||
return type_stack[--type_stack_depth].piece;
|
return type_stack.elements[--type_stack.depth].piece;
|
||||||
return tp_end;
|
return tp_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_type_int (void)
|
pop_type_int (void)
|
||||||
{
|
{
|
||||||
if (type_stack_depth)
|
if (type_stack.depth)
|
||||||
return type_stack[--type_stack_depth].int_val;
|
return type_stack.elements[--type_stack.depth].int_val;
|
||||||
/* "Can't happen". */
|
/* "Can't happen". */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1725,10 +1725,10 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile)
|
|||||||
void
|
void
|
||||||
_initialize_parse (void)
|
_initialize_parse (void)
|
||||||
{
|
{
|
||||||
type_stack_size = 80;
|
type_stack.size = 80;
|
||||||
type_stack_depth = 0;
|
type_stack.depth = 0;
|
||||||
type_stack = (union type_stack_elt *)
|
type_stack.elements = xmalloc (type_stack.size
|
||||||
xmalloc (type_stack_size * sizeof (*type_stack));
|
* sizeof (union type_stack_elt));
|
||||||
|
|
||||||
add_setshow_zinteger_cmd ("expression", class_maintenance,
|
add_setshow_zinteger_cmd ("expression", class_maintenance,
|
||||||
&expressiondebug,
|
&expressiondebug,
|
||||||
|
@ -127,8 +127,18 @@ union type_stack_elt
|
|||||||
enum type_pieces piece;
|
enum type_pieces piece;
|
||||||
int int_val;
|
int int_val;
|
||||||
};
|
};
|
||||||
extern union type_stack_elt *type_stack;
|
|
||||||
extern int type_stack_depth, type_stack_size;
|
/* The type stack is an instance of this structure. */
|
||||||
|
|
||||||
|
struct type_stack
|
||||||
|
{
|
||||||
|
/* Elements on the stack. */
|
||||||
|
union type_stack_elt *elements;
|
||||||
|
/* Current stack depth. */
|
||||||
|
int depth;
|
||||||
|
/* Allocated size of stack. */
|
||||||
|
int size;
|
||||||
|
};
|
||||||
|
|
||||||
/* Helper function to initialize the expout, expout_size, expout_ptr
|
/* Helper function to initialize the expout, expout_size, expout_ptr
|
||||||
trio before it is used to store expression elements created during
|
trio before it is used to store expression elements created during
|
||||||
|
Reference in New Issue
Block a user