From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30043 invoked by alias); 23 Jan 2011 18:11:16 -0000 Received: (qmail 30034 invoked by uid 22791); 23 Jan 2011 18:11:16 -0000 X-SWARE-Spam-Status: No, hits=2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FSL_RU_URL,RCVD_IN_DNSWL_NONE,SARE_FREE_WEBM_RuMail,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from smtp1.mail.ru (HELO smtp1.mail.ru) (94.100.176.129) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 23 Jan 2011 18:11:01 +0000 Received: from [93.100.134.215] (port=30165 helo=debian) by smtp1.mail.ru with psmtp id 1Ph4Ov-0006OH-00 for gdb@sourceware.org; Sun, 23 Jan 2011 21:10:57 +0300 Date: Sun, 23 Jan 2011 18:11:00 -0000 From: Alexander Petukhov To: gdb@sourceware.org Subject: Re: set print null-stop Message-Id: <20110123205733.9bb14324.al_petukhov@mail.ru> In-Reply-To: <20110123132005.GA3916@host1.dyn.jankratochvil.net> References: <1292149712.15669.ezmlm@sourceware.org> <20110122114056.6d60d06a.al_petukhov@mail.ru> <20110123132005.GA3916@host1.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00098.txt.bz2 Jan, thanks for help. You won't belive: pit@debian:~/src/test$ echo 'char str[7]="i=0";main(){}'|gcc -x c - -g;gdb -nx ./a.out GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /home/pit/src/test/a.out...done. (gdb) p str $1 = "i=0\000\000\000" (gdb) set print null-stop (gdb) p str $2 = "" (gdb) I'll check out latest GDB version as soon as i can, but this particular version (7.0.1, Deban squeeze x86) seems having kind of bug Alex On Sun, 23 Jan 2011 14:20:05 +0100 Jan Kratochvil wrote: > On Sat, 22 Jan 2011 09:40:56 +0100, Alexander Petukhov wrote: > > Hello, maling list. > > Can't make "set print null-stop" work as written in manual. > > For example: > > > > char str[7]; > > sprintf(str, "i=%i", 0); > > > > (gdb) p str > > $1 = "i=0\000\017\377\267" > > (gdb) set print null-stop > > (gdb) p str > > $2 = "" > > > > Does this feature work or I'm doing something wrong? > > Works for me: > > echo 'char str[7]="i=0";main(){}'|gcc -x c - -g;./gdb -nx ./a.out > GNU gdb (GDB) 7.2.50.20110123-cvs > This GDB was configured as "x86_64-unknown-linux-gnu". > (gdb) p str > $1 = "i=0\000\000\000" > (gdb) set print null-stop > (gdb) p str > $2 = "i=0" > > > > Another question - is there a corresponding gdm/mi command? > > String AFAIK has to be read in MI char-by-char so it is irrelevant. > > -var-create a * str > ^done,name="a",numchild="7",value="[7]",type="char [7]",has_more="0" > -var-evaluate-expression a > ^done,value="[7]" > -var-create - * str[0] > ^done,name="var1",numchild="0",value="105 'i'",type="char",has_more="0" > -var-create - * str[1] > ^done,name="var2",numchild="0",value="61 '='",type="char",has_more="0" > > > Regards, > Jan > -- Best regards, Alexander Petukhov