* set print null-stop
[not found] <1292149712.15669.ezmlm@sourceware.org>
@ 2011-01-22 8:54 ` Alexander Petukhov
2011-01-23 13:20 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Petukhov @ 2011-01-22 8:54 UTC (permalink / raw)
To: gdb
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?
Another question - is there a corresponding gdm/mi command?
Thank you,
Alexander
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set print null-stop
2011-01-22 8:54 ` set print null-stop Alexander Petukhov
@ 2011-01-23 13:20 ` Jan Kratochvil
2011-01-23 18:11 ` Alexander Petukhov
2011-01-23 18:23 ` Alexander Petukhov
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kratochvil @ 2011-01-23 13:20 UTC (permalink / raw)
To: Alexander Petukhov; +Cc: gdb
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set print null-stop
2011-01-23 13:20 ` Jan Kratochvil
@ 2011-01-23 18:11 ` Alexander Petukhov
2011-01-23 18:23 ` Alexander Petukhov
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Petukhov @ 2011-01-23 18:11 UTC (permalink / raw)
To: gdb
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 <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
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 <jan.kratochvil@redhat.com> 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 <Alexander.Petukhov@mail.ru>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set print null-stop
2011-01-23 13:20 ` Jan Kratochvil
2011-01-23 18:11 ` Alexander Petukhov
@ 2011-01-23 18:23 ` Alexander Petukhov
2011-01-23 18:32 ` Joel Brobecker
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Petukhov @ 2011-01-23 18:23 UTC (permalink / raw)
To: gdb
well, sorry for inattention, 7.2 doesn't have this bug and I've found it in the tracker
http://sourceware.org/bugzilla/show_bug.cgi?id=11049
Thanks for giving a right direction.
By the way, after executing "set print null-stop" in MI mode -data-evaluate-expression also start to
work well, though I understand it's not a good idea to mix MI and not-MI commands
(gdb)
-data-evaluate-expression str
^done,value="\"i=0\\000\\000\\000\""
(gdb)
set print null-stop
&"set print null-stop\n"
^done
(gdb)
-data-evaluate-expression str
^done,value="\"i=0\""
On Sun, 23 Jan 2011 14:20:05 +0100
Jan Kratochvil <jan.kratochvil@redhat.com> 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 <Alexander.Petukhov@mail.ru>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set print null-stop
2011-01-23 18:23 ` Alexander Petukhov
@ 2011-01-23 18:32 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2011-01-23 18:32 UTC (permalink / raw)
To: Alexander Petukhov; +Cc: gdb
> By the way, after executing "set print null-stop" in MI mode
> -data-evaluate-expression also start to work well, though I understand
> it's not a good idea to mix MI and not-MI commands
I think that the recommended way of doing this would be to use
the -interpreter-exec command. For instance, the following should
work (I'm not a GDB/MI expert):
-interpreter-exec console "set print null-stop"
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-23 18:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1292149712.15669.ezmlm@sourceware.org>
2011-01-22 8:54 ` set print null-stop Alexander Petukhov
2011-01-23 13:20 ` Jan Kratochvil
2011-01-23 18:11 ` Alexander Petukhov
2011-01-23 18:23 ` Alexander Petukhov
2011-01-23 18:32 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox