News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Debugger output

Started by tigerbeard, March 30, 2016, 04:15:00 PM

Previous topic - Next topic

tigerbeard

I noted that my GDB Watch gave me a incorrect value in the watch window.
The variable wxPoint ptDialgPos showed in the watch the values that gdb produced by the print command.
However, the output /c command produced other values.

Here is the section from the debugger command line while the debugee was running

> output /c ptDialogPos

[debug]> output /c ptDialogPos
[debug]{x = 96 '`', y = 8 '\b'}>>>>>>cb_gdb:

{x = 96 '`', y = 8 '\b'}
> print ptDialogPos

[debug]> print ptDialogPos
[debug]$2 = {x = 39395680, y = 8}
[debug]>>>>>>cb_gdb:

$2 = {x = 39395680, y = 8}


I guess the problem is in the printer scripts I am using, but I am acutally interested to understand why gdb outputs different values for the same variables at a given point. Why isptDialogPos.x=39395680 and isptDialogPos.x=96. If one is unicode, I would still not understand why y is the same...


using C::B V16.01, Win7, ollydbgs GDB from 2016-01-30

oBFusCATed

You're using "output /c" and "print", and the first treat integers as characters and the second uses the default treatment.
See here for details: https://sourceware.org/gdb/download/onlinedocs/gdb/Output-Formats.html#Output-Formats

note: Why are you talking about cdb in your first post? CDB is a debugger produced by microsoft and has nothing in common with gdb.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tigerbeard

Quote from: oBFusCATed on March 30, 2016, 06:34:12 PM
note: Why are you talking about cdb in your first post? CDB is a debugger produced by microsoft and has nothing in common with gdb.
sorry, was a typo. Corrected it in the first post.

Quote from: oBFusCATed on March 30, 2016, 06:34:12 PM
You're using "output /c" and "print", and the first treat integers as characters and the second uses the default treatment.
See here for details: https://sourceware.org/gdb/download/onlinedocs/gdb/Output-Formats.html#Output-Formats
Thanks for the link. I understood that without a format option like /c it prints a default, which might be a registered pretty-printer. I did not understand pretty printing so far, but thankfully the link also contains the native documentation of it with gdb. Seems like I need to get into that a bit deeper than intially anticipated :-)