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]

[commit/Ada] fix ptype of class-wide object


Hello,

Class-wide objects are objects whose type is not known at compile
time.  To print determine the type of these objects, we need to
read into inferior memory.  This is what we do when we print the
value of any such objects, but we had a bug when printing their
type description:

    (gdb) ptype s
    type = new geo.shape with record
        C110b: array (1 .. -1) of system.storage_elements.storage_element;
    end record

For tagged types, when in EVAL_AVOID_SIDE_EFFECTS mode, we have no choice
but to read the value of our object in order to determine its type.
This is what this patch does.

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

        * ada-lang.c (ada_evaluate_subexp): Evaluate tagged types in
        EVAL_NORMAL mode when noside is EVAL_AVOID_SIDE_EFFECTS.

I also wrote a testcase that exercises tagged types in general.
It tests ptype operations, but also print as well.

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

        * gdb.ada/tagged/pck.ads, gdb.ada/tagged/pck.adb,
        gdb.ada/tagged/foo.adb: New file.
        * gdb.ada/tagged.exp: New testcase.

All tested on x86-linux, no regression. Checked in.

-- 
Joel

Attachment: tagged.diff
Description: Text document

Attachment: tagged-tc.diff
Description: Text document


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