MAL - Memória Auxiliar do Lutieri

segunda-feira, maio 03, 2010

debugging with GDB

Print value as hexa:

print/x variable


or

p/x variable



If you need more printing formats type: help x
basically:

s -> string
c -> char
t -> binary




if you coded something like this:

char * stream;


then you allocate enough memory to store you text and try to print out the contents with p *stream you will get just the first character, I guess this is because gdb sees stream as a char(1 byte long). To get the whole string one should use:

p/s (char[3])*p1.question.qname


or

p/s *p1.question.qname@3


These lines will print the first 3 chars of the string

Marcadores:

0 Comentários:

Postar um comentário

<< Home



Chat with Lutieri G. B.

Subscribe in a reader