aboutsummaryrefslogtreecommitdiff
path: root/gdb/expprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-09-04 07:37:18 +0000
committerPer Bothner <per@bothner.com>1992-09-04 07:37:18 +0000
commit35fcebce93a949c589d0569e2b1111c1eb26bc2f (patch)
tree4bf217c00c7022660422bac10180344a14020b9d /gdb/expprint.c
parentd73812a1d62890a28f3be4054614e16690a1b029 (diff)
downloadgdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.zip
gdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.tar.gz
gdb-35fcebce93a949c589d0569e2b1111c1eb26bc2f.tar.bz2
A ton of changes to improve C++ debugging. See ChangeLog.
Diffstat (limited to 'gdb/expprint.c')
-rw-r--r--gdb/expprint.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/gdb/expprint.c b/gdb/expprint.c
index f642ea7..357c890 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -74,12 +74,9 @@ print_subexp (exp, pos, stream, prec)
/* Common ops */
case OP_SCOPE:
- myprec = PREC_PREFIX;
- assoc = 0;
(*pos) += 2;
- print_subexp (exp, pos, stream,
- (enum precedence) ((int) myprec + assoc));
- fputs_filtered (" :: ", stream);
+ type_print (exp->elts[pc + 1].type, "", stream, 0);
+ fputs_filtered ("::", stream);
nargs = strlen (&exp->elts[pc + 2].string);
(*pos) += 1 + (nargs + sizeof (union exp_element)) / sizeof (union exp_element);
@@ -114,7 +111,7 @@ print_subexp (exp, pos, stream, prec)
case OP_REGISTER:
(*pos) += 2;
fprintf_filtered (stream, "$%s",
- reg_names[longest_to_int (exp->elts[pc + 1].longconst));
+ reg_names[longest_to_int (exp->elts[pc + 1].longconst)]);
return;
case OP_INTERNALVAR:
@@ -163,20 +160,30 @@ print_subexp (exp, pos, stream, prec)
return;
case STRUCTOP_STRUCT:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
+ tem = strlen (&exp->elts[pc + 2].string);
+ (*pos) += 3 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered (".", stream);
- fputs_filtered (&exp->elts[pc + 1].string, stream);
+ if (exp->elts[pc + 1].type)
+ {
+ type_print (exp->elts[pc + 1].type, "", stream, 0);
+ fputs_filtered ("::", stream);
+ }
+ fputs_filtered (&exp->elts[pc + 2].string, stream);
return;
/* Will not occur for Modula-2 */
case STRUCTOP_PTR:
- tem = strlen (&exp->elts[pc + 1].string);
- (*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
+ tem = strlen (&exp->elts[pc + 2].string);
+ (*pos) += 3 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered ("->", stream);
- fputs_filtered (&exp->elts[pc + 1].string, stream);
+ if (exp->elts[pc + 1].type)
+ {
+ type_print (exp->elts[pc + 1].type, "", stream, 0);
+ fputs_filtered ("::", stream);
+ }
+ fputs_filtered (&exp->elts[pc + 2].string, stream);
return;
case BINOP_SUBSCRIPT: