2007-09-30 Mike Frysinger <vapier@gentoo.org>
* value.h (lookup_only_internalvar): New prototype. (create_internalvar): Likewise. * value.c (lookup_only_internalvar): New function. (create_internalvar): Likewise. (lookup_internalvar): Use new lookup_only_internalvar and create_internalvar functions. * parse.c (write_dollar_variable): Look up $ symbols in internal table first rather than last.
This commit is contained in:
parent
9f0bdab802
commit
c4a3d09a71
4 changed files with 61 additions and 4 deletions
|
@ -1,3 +1,14 @@
|
|||
2007-09-30 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* value.h (lookup_only_internalvar): New prototype.
|
||||
(create_internalvar): Likewise.
|
||||
* value.c (lookup_only_internalvar): New function.
|
||||
(create_internalvar): Likewise.
|
||||
(lookup_internalvar): Use new lookup_only_internalvar and
|
||||
create_internalvar functions.
|
||||
* parse.c (write_dollar_variable): Look up $ symbols in internal
|
||||
table first rather than last.
|
||||
|
||||
2007-09-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* linux-nat.c (linux_nat_new_thread): New variable.
|
||||
|
|
16
gdb/parse.c
16
gdb/parse.c
|
@ -469,6 +469,7 @@ write_dollar_variable (struct stoken str)
|
|||
{
|
||||
struct symbol *sym = NULL;
|
||||
struct minimal_symbol *msym = NULL;
|
||||
struct internalvar *isym = NULL;
|
||||
|
||||
/* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
|
||||
and $$digits (equivalent to $<-digits> if you could type that). */
|
||||
|
@ -507,6 +508,17 @@ write_dollar_variable (struct stoken str)
|
|||
if (i >= 0)
|
||||
goto handle_register;
|
||||
|
||||
/* Any names starting with $ are probably debugger internal variables. */
|
||||
|
||||
isym = lookup_only_internalvar (copy_name (str) + 1);
|
||||
if (isym)
|
||||
{
|
||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
||||
write_exp_elt_intern (isym);
|
||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
||||
return;
|
||||
}
|
||||
|
||||
/* On some systems, such as HP-UX and hppa-linux, certain system routines
|
||||
have names beginning with $ or $$. Check for those, first. */
|
||||
|
||||
|
@ -529,10 +541,10 @@ write_dollar_variable (struct stoken str)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Any other names starting in $ are debugger internal variables. */
|
||||
/* Any other names are assumed to be debugger internal variables. */
|
||||
|
||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
||||
write_exp_elt_intern (lookup_internalvar (copy_name (str) + 1));
|
||||
write_exp_elt_intern (create_internalvar (copy_name (str) + 1));
|
||||
write_exp_elt_opcode (OP_INTERNALVAR);
|
||||
return;
|
||||
handle_last:
|
||||
|
|
34
gdb/value.c
34
gdb/value.c
|
@ -742,10 +742,10 @@ init_if_undefined_command (char* args, int from_tty)
|
|||
normally include a dollar sign.
|
||||
|
||||
If the specified internal variable does not exist,
|
||||
one is created, with a void value. */
|
||||
the return value is NULL. */
|
||||
|
||||
struct internalvar *
|
||||
lookup_internalvar (char *name)
|
||||
lookup_only_internalvar (char *name)
|
||||
{
|
||||
struct internalvar *var;
|
||||
|
||||
|
@ -753,6 +753,17 @@ lookup_internalvar (char *name)
|
|||
if (strcmp (var->name, name) == 0)
|
||||
return var;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Create an internal variable with name NAME and with a void value.
|
||||
NAME should not normally include a dollar sign. */
|
||||
|
||||
struct internalvar *
|
||||
create_internalvar (char *name)
|
||||
{
|
||||
struct internalvar *var;
|
||||
var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
|
||||
var->name = concat (name, (char *)NULL);
|
||||
var->value = allocate_value (builtin_type_void);
|
||||
|
@ -763,6 +774,25 @@ lookup_internalvar (char *name)
|
|||
return var;
|
||||
}
|
||||
|
||||
|
||||
/* Look up an internal variable with name NAME. NAME should not
|
||||
normally include a dollar sign.
|
||||
|
||||
If the specified internal variable does not exist,
|
||||
one is created, with a void value. */
|
||||
|
||||
struct internalvar *
|
||||
lookup_internalvar (char *name)
|
||||
{
|
||||
struct internalvar *var;
|
||||
|
||||
var = lookup_only_internalvar (name);
|
||||
if (var)
|
||||
return var;
|
||||
|
||||
return create_internalvar (name);
|
||||
}
|
||||
|
||||
struct value *
|
||||
value_of_internalvar (struct internalvar *var)
|
||||
{
|
||||
|
|
|
@ -434,6 +434,10 @@ extern void set_internalvar_component (struct internalvar *var,
|
|||
int bitpos, int bitsize,
|
||||
struct value *newvalue);
|
||||
|
||||
extern struct internalvar *lookup_only_internalvar (char *name);
|
||||
|
||||
extern struct internalvar *create_internalvar (char *name);
|
||||
|
||||
extern struct internalvar *lookup_internalvar (char *name);
|
||||
|
||||
extern int value_equal (struct value *arg1, struct value *arg2);
|
||||
|
|
Loading…
Reference in a new issue