]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Handle OP_STRING in dump_subexp_body_standard
authorSimon Marchi <simon dot marchi at ericsson dot com>
Thu, 19 Jun 2014 14:45:33 +0000 (10:45 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 15 Jul 2014 15:18:04 +0000 (11:18 -0400)
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.

gdb/ChangeLog
gdb/expprint.c

index eca73a4fe4ada470ec8e633dc1348197ff7b7100..157dc4933e85c73e2f1cb0e0346279a433bab613 100644 (file)
@@ -1,3 +1,7 @@
+2014-07-15  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * expprint.c (dump_subexp_body_standard): Handle OP_STRING.
+
 2014-07-14  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
 
        * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
index 97188edcb6512773acc7058860da598996500b8c..aa9e4d76a34ccc3d0f4ea92b9384971e6dfaa6a5 100644 (file)
@@ -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: