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 | f5cc5be604d9e798ea8ffba7e3789777e5490970 (patch) | |
tree | c64d0f948ffd626ab568d7522b28e94ac2bc3523 /gdb/value.c | |
parent | edcba4c0937878414ee8a19997aeaf30ad71d004 (diff) | |
download | gdb-f5cc5be604d9e798ea8ffba7e3789777e5490970.tar.gz |
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 8435404d687..5f39bc8054b 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) { |