hi, I write for the tool gdb, this has a bug.
you should compile this code with gcc proof.c -o proof .

#include <stdio.h>

int main(int argc,char** argv)
{
    if( argc == 2 )
    {
        printf("%s",argv[1]);
    }
    return 0;
}


the next step is run gdb -q proof and put a breakpoint in function printf.

the direction of prinf is

   0x0804843e <+34>:    call   0x8048300 <printf@plt>

and put break in 0x0804843e , then should run gdb -q proof.

view the stack with x/8x $esp .

0xbffff960:    0x080484e0    0xbffffbb1    0x0804846b    0xb7fc4ff4
0xbffff970:    0x08048460    0x00000000    0xbffff9f8    0xb7e96e16

and print the string with value proof 0xbffffbb1 .

(gdb)x/s 0xbffffbb1
0xbffffbb1:    "proof"

print the newly the stack with x/8x $esp and the result is.

0xbffff960:    0xe0    0x84    0x04    0x08    0xb1    0xfb    0xff    0xbf

do you understand ??, this bug is in all version of gdb .

will wait for you answer,please.
regards.

_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb

Reply via email to