From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31377 invoked by alias); 9 Sep 2011 07:28:11 -0000 Received: (qmail 31363 invoked by uid 22791); 9 Sep 2011 07:28:09 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Sep 2011 07:27:50 +0000 Received: by fxg9 with SMTP id 9so2707354fxg.0 for ; Fri, 09 Sep 2011 00:27:49 -0700 (PDT) Received: by 10.223.42.24 with SMTP id q24mr2242912fae.148.1315553269148; Fri, 09 Sep 2011 00:27:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.112.68 with HTTP; Fri, 9 Sep 2011 00:27:09 -0700 (PDT) In-Reply-To: <20110907095850.GA25473@host1.jankratochvil.net> References: <20110906085007.GA19880@host1.jankratochvil.net> <20110907095850.GA25473@host1.jankratochvil.net> From: Hui Zhu Date: Fri, 09 Sep 2011 07:59:00 -0000 Message-ID: Subject: Re: [PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory To: Jan Kratochvil Cc: Tom Tromey , gdb-patches ml Content-Type: multipart/mixed; boundary=0015174733104a6b9804ac7d1d8b X-IsSubscribed: yes 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 X-SW-Source: 2011-09/txt/msg00155.txt.bz2 --0015174733104a6b9804ac7d1d8b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 1281 On Wed, Sep 7, 2011 at 17:58, Jan Kratochvil wr= ote: > On Wed, 07 Sep 2011 04:55:32 +0200, Hui Zhu wrote: >> +#Test printing internal var values with printf >> +proc test_printf_with_internalvar {} { >> + =A0 =A0gdb_test "set \$a=3D{\'a\',\'b\'}" "" > > Escaping of ' is redundant. > >> + =A0 =A0gdb_test "printf \"%s\\n\", \$a" "ab" > > I would find easier { and } instead of " and " to prevent so many backsla= shes > but opinions differ on it, FYI: > =A0 =A0gdb_test_no_output {set $a=3D{'a','b'}} > =A0 =A0gdb_test {printf "%s\n", $a} "ab" > Thanks for your help Jan. I make a new patch according to it. And I add more test_printf_with_internalvar in the end of test because I think it can test this issue after the inferior exec. > > Still this testcase FAILs for me: > printf "%s\n", $a^M > abX^M > (gdb) FAIL: gdb.base/printcmds.exp: printf "%s\n", $a > > Where X is some binary unprintable garbage character, not sure which way = you > plan to fix it (maybe some `error' call if there is no zero-terminator?). I didn't got this issue. Could you post more info about this issue? > > > Thanks, > Jan > Best, Hui 2011-09-07 Hui Zhu * gdb.base/printcmds.exp: Add test for printing internal var values with printf. --0015174733104a6b9804ac7d1d8b Content-Type: text/plain; charset=US-ASCII; name="test-v-string.txt" Content-Disposition: attachment; filename="test-v-string.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gscuc4ln0 Content-length: 1310 LS0tCiB0ZXN0c3VpdGUvZ2RiLmJhc2UvcHJpbnRjbWRzLmV4cCB8ICAgIDkg KysrKysrKysrCiAxIGZpbGUgY2hhbmdlZCwgOSBpbnNlcnRpb25zKCspCgot LS0gYS90ZXN0c3VpdGUvZ2RiLmJhc2UvcHJpbnRjbWRzLmV4cAorKysgYi90 ZXN0c3VpdGUvZ2RiLmJhc2UvcHJpbnRjbWRzLmV4cApAQCAtNzc1LDYgKzc3 NSwxMiBAQCBwcm9jIHRlc3RfcHJpbnRmX3dpdGhfZGZwIHt9IHsKICAgICBn ZGJfdGVzdCAicHJpbnRmIFwiJUREZlxcblwiLDEuMkU2MTQ0ZGwiICIxLjIw MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMEVcXCs2MTQ0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