From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29359 invoked by alias); 15 Jul 2014 15:25:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29287 invoked by uid 89); 15 Jul 2014 15:25:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 15 Jul 2014 15:25:46 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id E3.DF.25146.CF2F4C35; Tue, 15 Jul 2014 11:23:08 +0200 (CEST) Received: from simark-hp.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 15 Jul 2014 11:25:43 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PUSHED] Handle OP_STRING in dump_subexp_body_standard Date: Tue, 15 Jul 2014 15:33:00 -0000 Message-ID: <1405437917-1170-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00389.txt.bz2 Following this... https://sourceware.org/ml/gdb-patches/2014-07/msg00383.html ...this patched was pushed. 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 * expprint.c (dump_subexp_body_standard): Handle OP_STRING. --- gdb/ChangeLog | 4 ++++ gdb/expprint.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eca73a4..157dc49 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2014-07-15 Simon Marchi + + * expprint.c (dump_subexp_body_standard): Handle OP_STRING. + 2014-07-14 Edjunior Barbosa Machado * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware 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: -- 2.0.0