This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/16933] p omits trailing 0 when printing a range of chars


https://sourceware.org/bugzilla/show_bug.cgi?id=16933

--- Comment #2 from Frank Heckenbach <f.heckenbach@fh-soft.de> ---
> https://sourceware.org/bugzilla/show_bug.cgi?id=16933
> 
> --- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
> "\001\002\000\004\000" would be wrong because that has 6 elements and implies
> that there is another zero following.

I see. But for the same reason this is then also wrong:

# echo 'char foo[5] = { 1, 2, 0, 4 };' > foo.c
# gcc -c -g foo.c
# gdb foo.o
(gdb) p foo[0]@4
$1 = "\001\002\000\004"

So AIUI gdb must not print a range of chars as a string at all and
should really print "{1, 2, 0, 4, 0}" or "{1, 2, 0, 4}", resp., as
I'd actually prefer anyway.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]