On 02/01/2013 10:04 PM, sfddfsd wrote:
view the stack with x/8x $esp .
0xb960:0x080484e00xbbb10x0804846b0xb7fc4ff4
0xb970:0x080484600x0xb9f80xb7e96e16
and print the string with value proof 0xbbb1 .
(gdb)x/s 0xbbb1
0xbbb1:proof
print the newly the stack with x/8x $esp and the result is.
0xb960:0xe00x840x040x080xb10xfb0xff0xbf
do you understand ??, this bug is in all version of gdb .
(gdb) help x
Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
t(binary), f(float), a(address), i(instruction), c(char) and s(string).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.
Defaults for format and size letters are those previously used.
^^^
Default count is 1. Default address is following last thing printed
with this command or print.
The manual says:
Each time you specify a unit size with @code{x}, that size becomes the
default unit the next time you use @code{x}. For the @samp{i} format,
the unit size is ignored and is normally not written. For the @samp{s} format,
^^^
the unit size defaults to @samp{b}, unless it is explicitly given.
^
Use @kbd{x /hs} to display 16-bit char strings and @kbd{x /ws} to display
32-bit strings. The next use of @kbd{x /s} will again display 8-bit strings.
^^^
Note that the results depend on the programming language of the
current compilation unit. If the language is C, the @samp{s}
modifier will use the UTF-16 encoding while @samp{w} will use
UTF-32. The encoding is set by the programming language and cannot
be altered.
So x/s implicitly sets size to 'b'. So after x/s, the previously
used size is 'b', and your x/8x $esp becomes equivalent to
x/8xb $esp. Use x/8xw $esp to get back the previous output.
--
Pedro Alves
___
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb