Author Topic: Debugger output  (Read 2299 times)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 190
Debugger output
« on: March 30, 2016, 04:15:00 pm »
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
Code
> 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
« Last Edit: March 30, 2016, 07:19:24 pm by tigerbeard »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger output
« Reply #1 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

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!]

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 190
Re: Debugger output
« Reply #2 on: March 30, 2016, 07:37:43 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.

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 :-)