Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Alexander Petukhov <al_petukhov@mail.ru>
Cc: gdb@sourceware.org
Subject: Re: set print null-stop
Date: Sun, 23 Jan 2011 13:20:00 -0000	[thread overview]
Message-ID: <20110123132005.GA3916@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <20110122114056.6d60d06a.al_petukhov@mail.ru>

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


  reply	other threads:[~2011-01-23 13:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1292149712.15669.ezmlm@sourceware.org>
2011-01-22  8:54 ` Alexander Petukhov
2011-01-23 13:20   ` Jan Kratochvil [this message]
2011-01-23 18:11     ` Alexander Petukhov
2011-01-23 18:23     ` Alexander Petukhov
2011-01-23 18:32       ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110123132005.GA3916@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=al_petukhov@mail.ru \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox