Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb print won't print out something readable from my char array

Tags:

c

printing

gdb

i have a char buffer[100] and i'm trying to use gdb to read the contents out of it at various stages of runtime.

i use p buffer and i get

"/*\000\000\000\000\000\000????X?o\000\025\202\004\b", '\0' <repeats 12 times>, ".N=?", '\0' <repeats 24 times>, "`\203\004\b\000\000\000\000L\227\004\bX????\202\004\b?\017\204\000\f?\203\000\210???i\205\004\b??r"

how do i get p to convert it into a readable format???

like image 491
Tony Stark Avatar asked Apr 11 '10 00:04

Tony Stark


1 Answers

x/s buffer should display the contents of the array as a null terminated string (which is what I assume you'd like).

like image 128
Michael Burr Avatar answered Oct 21 '22 12:10

Michael Burr