debugging with GDB
Print value as hexa:
or
If you need more printing formats type: help x
basically:
s -> string
c -> char
t -> binary
if you coded something like this:
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:
or
These lines will print the first 3 chars of the string
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: gdb