diff options
author | Nick Roberts <nickrob@snap.net.nz> | 2007-01-04 23:04:26 +0000 |
---|---|---|
committer | Nick Roberts <nickrob@snap.net.nz> | 2007-01-04 23:04:26 +0000 |
commit | 0f0ac1f5fc3b7eaafb1fdae5d3da2ebe059a2851 (patch) | |
tree | 287d966e85bb118260b8cfdec1c23ebc8871d9af /gdb | |
parent | 8e38af42538406f6acfc49ad16214b04dda4e1b5 (diff) | |
download | gdb-0f0ac1f5fc3b7eaafb1fdae5d3da2ebe059a2851.zip gdb-0f0ac1f5fc3b7eaafb1fdae5d3da2ebe059a2851.tar.gz gdb-0f0ac1f5fc3b7eaafb1fdae5d3da2ebe059a2851.tar.bz2 |
(get_type_deref): Fix variable objects for references to
pointers.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/varobj.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c index 33cea73..766fd39 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1441,7 +1441,8 @@ get_type (struct varobj *var) return type; } -/* This returns the type of the variable, dereferencing pointers, too. */ +/* This returns the type of the variable, dereferencing references, pointers + and references to pointers, too. */ static struct type * get_type_deref (struct varobj *var) { @@ -1449,9 +1450,13 @@ get_type_deref (struct varobj *var) type = get_type (var); - if (type != NULL && (TYPE_CODE (type) == TYPE_CODE_PTR - || TYPE_CODE (type) == TYPE_CODE_REF)) - type = get_target_type (type); + if (type) + { + if (TYPE_CODE (type) == TYPE_CODE_REF) + type = get_target_type (type); + if (TYPE_CODE (type) == TYPE_CODE_PTR) + type = get_target_type (type); + } return type; } @@ -1726,9 +1731,9 @@ c_number_of_children (struct varobj *var) break; case TYPE_CODE_PTR: - /* This is where things get compilcated. All pointers have one child. + /* This is where things get complicated. 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 |