This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC]: remove inconsistency in printcmd.c: print_scalar_formatted

(gdb) print/x doublevar
>$1 = 0xc000000000000000
>(gdb) print/i doublevar
>???? [no preference really]

No. That would be wrong. print/<format> prints the value (not the implementation) using the specified format. Being able to examine the underlying implementation in various formats is more of an "examine" command.

Andrew, please explain to us all how you can respond to "I think this
would be a better, different-than-the-current behavior" with "No, that
would be wrong".

"us all"?

"print" displays the value, not the underlying representation, using normal language rules. Consider:
int i = 1.0;
extern foo (int i);
foo (1.0:
which don't leave something like 0xc0000000 in i. On the other hand "examine" lets you display the underlying [memory] representation in various forms.

The problem here is not print/f, but rather that there isn't way to examine the underlying representation of non-memory values (most often registers) this leaves people attempting:
x/x $fp0
and then:
p/x $fp0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]