This is the mail archive of the gdb-patches@sourceware.org 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]

[RFA] Fix print/x on references


Hello,

Paul reported in http://www.sourceware.org/ml/gdb/2007-10/msg00133.html:

Currently, there is a slight discrepancy in the behavior of formatted print
commands.  Stop the program below in f.  At that point, we see the
following behavior:

    (gdb) p x
    $4 = (Glorp &) @0x8049850: {x = 1, y = 2}
    (gdb) p/x x
    $5 = 0x8049850

There was a bit of discussion, but I think that, in the end, everyone
agreed that the better output for the second command was:

    (gdb) p /x x
    $5 = (Glorp &) @0x8049850: {x = 0x1, y = 0x2}

The attached patch does just that.

2008-01-08  Paul Hilfinger  <hilfinger@adacore.com>

        * printcmd.c (print_formatted): Handle references as for unformatted
        prints.

Paul also wrote two new testcases, one for C++, and one for Ada:

2008-01-08  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/formatted_ref: New test program.
        * gdb.ada/formatted_ref.exp: New testcase.

        * gdb.cp/formatted-ref.cc: New file.
        * gdb.cp/formatted-ref.exp: New testcase.

Tested on x86-linux, no regression. OK to apply?

Thank you!
-- 
Joel

Attachment: formatted.diff
Description: Text document

Attachment: formatted-tc-ada.diff
Description: Text document

Attachment: formatted-tc-cpp.diff
Description: Text document


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