diff options
author | Simon Marchi <simon dot marchi at ericsson dot com> | 2014-06-19 10:45:33 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2014-07-15 11:18:04 -0400 |
commit | 2d40be181fad7aed4aeabafd36529f3684b8bcab (patch) | |
tree | b7294c39f91cb1889ff4b915b3812c42d23a0e25 /gdb/expprint.c | |
parent | ce9e3fe795c05bd7458a1466e14104f489f2b483 (diff) | |
download | gdb-2d40be181fad7aed4aeabafd36529f3684b8bcab.zip gdb-2d40be181fad7aed4aeabafd36529f3684b8bcab.tar.gz gdb-2d40be181fad7aed4aeabafd36529f3684b8bcab.tar.bz2 |
Handle OP_STRING in dump_subexp_body_standard
For some reason, OP_STRING is not handled in dump_subexp_body_standard.
This makes the output of "set debug expression 1" very bad when a string
is involved. Example:
(gdb) set debug expression 1
(gdb) print "hello"
... (random garbage, possibly segfault)
This commit handles OP_STRING and skips the appropriate number of exp
elements. The line corresponding to the string now looks like:
0 OP_STRING Language-specific string type: 0
gdb/ChangeLog:
2014-07-15 Simon Marchi <simon.marchi@ericsson.com>
* expprint.c (dump_subexp_body_standard): Handle OP_STRING.
Diffstat (limited to 'gdb/expprint.c')
-rw-r--r-- | gdb/expprint.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/expprint.c b/gdb/expprint.c index 97188ed..aa9e4d7 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -1011,12 +1011,29 @@ dump_subexp_body_standard (struct expression *exp, elt = dump_subexp (exp, stream, elt); } break; + case OP_STRING: + { + LONGEST len = exp->elts[elt].longconst; + LONGEST type = exp->elts[elt + 1].longconst; + + fprintf_filtered (stream, "Language-specific string type: %s", + plongest (type)); + + /* Skip length. */ + elt += 1; + + /* Skip string content. */ + elt += BYTES_TO_EXP_ELEM (len); + + /* Skip length and ending OP_STRING. */ + elt += 2; + } + break; default: case OP_NULL: case MULTI_SUBSCRIPT: case OP_F77_UNDETERMINED_ARGLIST: case OP_COMPLEX: - case OP_STRING: case OP_BOOL: case OP_M2_STRING: case OP_THIS: |