public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/10233] New: Pretty-printing support for tagged unions
@ 2009-06-03 16:16 drow at sources dot redhat dot com
  2009-06-03 17:42 ` [Bug symtab/10233] " tromey at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: drow at sources dot redhat dot com @ 2009-06-03 16:16 UTC (permalink / raw)
  To: gdb-prs

There are two common paradigms for tagged (variant) unions - tag inside or
outside of the union.  For example:

struct common {
  int tag;
};

struct foo {
  struct common common;
  union u u;
};

struct bar_1 {
  struct common common;
  int x;
};

struct bar_2 {
  struct common common;
  int y;
};

union bar {
  struct bar_1 bar_1;
  struct bar_2 bar_2;
};

I'd like a concise way to write pretty-printers for these.  Real-life examples
include GCC trees and GDB types.

Another compiler I once used put the tag information into DWARF.  I don't know how.

-- 
           Summary: Pretty-printing support for tagged unions
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: drow at sources dot redhat dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10233

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug symtab/10233] Pretty-printing support for tagged unions
  2009-06-03 16:16 [Bug symtab/10233] New: Pretty-printing support for tagged unions drow at sources dot redhat dot com
@ 2009-06-03 17:42 ` tromey at redhat dot com
  2009-06-04 18:39 ` tromey at redhat dot com
  2010-02-04 18:58 ` [Bug python/10233] " tromey at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at redhat dot com @ 2009-06-03 17:42 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10233

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug symtab/10233] Pretty-printing support for tagged unions
  2009-06-03 16:16 [Bug symtab/10233] New: Pretty-printing support for tagged unions drow at sources dot redhat dot com
  2009-06-03 17:42 ` [Bug symtab/10233] " tromey at redhat dot com
@ 2009-06-04 18:39 ` tromey at redhat dot com
  2010-02-04 18:58 ` [Bug python/10233] " tromey at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at redhat dot com @ 2009-06-04 18:39 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-06-04 18:38 -------
When the tag is in the (like gcc's tree), this should work already.
A typical approach would be to examine the type to see if it
"inherits" from the common structure, then examine the tag and return
the appropriate field from the union.

We can write some convenience code to make this very easy.

For a tag outside the union, I think you would have to instead
implement printers that work on the enclosing structs.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-04 18:38:59
               date|                            |


http://sourceware.org/bugzilla/show_bug.cgi?id=10233

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug python/10233] Pretty-printing support for tagged unions
  2009-06-03 16:16 [Bug symtab/10233] New: Pretty-printing support for tagged unions drow at sources dot redhat dot com
  2009-06-03 17:42 ` [Bug symtab/10233] " tromey at redhat dot com
  2009-06-04 18:39 ` tromey at redhat dot com
@ 2010-02-04 18:58 ` tromey at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at redhat dot com @ 2010-02-04 18:58 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|symtab                      |python


http://sourceware.org/bugzilla/show_bug.cgi?id=10233

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-04 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03 16:16 [Bug symtab/10233] New: Pretty-printing support for tagged unions drow at sources dot redhat dot com
2009-06-03 17:42 ` [Bug symtab/10233] " tromey at redhat dot com
2009-06-04 18:39 ` tromey at redhat dot com
2010-02-04 18:58 ` [Bug python/10233] " tromey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).