aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2001-05-10 16:44:56 +0000
committerFernando Nasser <fnasser@redhat.com>2001-05-10 16:44:56 +0000
commit0755e6c1ab7e46e00d170a3216987008cd302715 (patch)
tree5c062272498920719a0cc048d844d664191a8593
parentd7db6da9f6e63a912cedfe61d720eb3797d42619 (diff)
downloadgdb-0755e6c1ab7e46e00d170a3216987008cd302715.zip
gdb-0755e6c1ab7e46e00d170a3216987008cd302715.tar.gz
gdb-0755e6c1ab7e46e00d170a3216987008cd302715.tar.bz2
2001-05-10 Fernando Nasser <fnasser@redhat.com>
* varobj.c (c_number_of_children): Check for target type of void*, not the target type name. Allow dereferencing char*.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/varobj.c17
2 files changed, 14 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f7ae18b..52287b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2001-05-10 Fernando Nasser <fnasser@redhat.com>
+ * varobj.c (c_number_of_children): Check for target type of void*,
+ not the target type name. Allow dereferencing char*.
+
+2001-05-10 Fernando Nasser <fnasser@redhat.com>
+
* symfile.c (symbol_file_add_main_1): New static function.
Passes the flags arguments to symbol_file_add() and takes care
of any necessary reinitializations.
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 40bc209..c61c313 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1761,7 +1761,13 @@ c_number_of_children (struct varobj *var)
case TYPE_CODE_PTR:
/* This is where things get compilcated. All pointers have one child.
Except, of course, for struct and union ptr, which we automagically
- dereference for the user and function ptrs, which have no children. */
+ dereference for the user and function ptrs, which have no children.
+ We also don't dereference void* as we don't know what to show.
+ We can show char* so we allow it to be dereferenced. If you decide
+ to test for it, please mind that a little magic is necessary to
+ properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and
+ TYPE_NAME == "char" */
+
switch (TYPE_CODE (target))
{
case TYPE_CODE_STRUCT:
@@ -1770,17 +1776,12 @@ c_number_of_children (struct varobj *var)
break;
case TYPE_CODE_FUNC:
+ case TYPE_CODE_VOID:
children = 0;
break;
default:
- /* Don't dereference char* or void*. */
- if (TYPE_NAME (target) != NULL
- && (STREQ (TYPE_NAME (target), "char")
- || STREQ (TYPE_NAME (target), "void")))
- children = 0;
- else
- children = 1;
+ children = 1;
}
break;