(gdb) p s
$1 = 578159222890430469

No luck :(

try this:

(gdb) x/dwx &mystirng
0xbffff4f4:     0x0000003c        <- size of string
(gdb)
0xbffff4f8:     0xb7ca2540        <- ptr to the string

(gdb) x/s 0xb7ca2540
0xb7ca2540:     "this is my string"
(gdb)

add this macro to your ~/.gdbinit


define ps
  x/s *(unsigned long *)(((char *)&$arg0)+4)
end

then you can do:

(gdb) ps myString
0xb7ca2540:     "this is my string"

Reply via email to