This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: set print null-stop
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Alexander Petukhov <al_petukhov at mail dot ru>
- Cc: gdb at sourceware dot org
- Date: Sun, 23 Jan 2011 14:20:05 +0100
- Subject: Re: set print null-stop
- References: <1292149712.15669.ezmlm@sourceware.org> <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