diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-10-01 01:39:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-10-01 01:39:52 +0000 |
commit | c4a3d09a712119df016fead2cc26dc6c0605ed2b (patch) | |
tree | bef6d583ac73aafdb1362439f4e89d4dc8fab84c /gdb/value.c | |
parent | 9f0bdab8028f185719d163f3bfeafd1406ba5a58 (diff) | |
download | gdb-c4a3d09a712119df016fead2cc26dc6c0605ed2b.zip gdb-c4a3d09a712119df016fead2cc26dc6c0605ed2b.tar.gz gdb-c4a3d09a712119df016fead2cc26dc6c0605ed2b.tar.bz2 |
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.
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/gdb/value.c b/gdb/value.c index 8435404..5f39bc8 100644 --- a/gdb/value.c +++ b/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) { |