public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/13041] New: Virtual base class botch
@ 2011-07-29  8:11 dj170590 at hotmail dot com
  2011-08-03 20:37 ` [Bug mi/13041] " tromey at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dj170590 at hotmail dot com @ 2011-07-29  8:11 UTC (permalink / raw)
  To: gdb-prs

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

           Summary: Virtual base class botch
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dj170590@hotmail.com


Hello,

First of all I'd like to say I do use a library (SystemC and TLM)and alot of
classes in it use virtual inherintance. So I cannot ignore the virtual
inheritance. My program uses GDB MI and it really depends on SystemC/TLM so I
can hardly make a program which can construct the realy problem, but i try to
explain the bug I think it is.

When I do use "-var-list-children --all-values VARNAME" on a var where VARNAME
is of an object derived from 2 class in a particular order everything goes
ok(like Example01), but when a switch them I get a virtual base class botch so
I think it's a bug?
Example 01 Everything is ok:

class CPU: public tlm_bw_transport_if<>, public sc_module
{
public:
    tlm_initiator_socket<> socket;

    SC_CTOR(CPU): //constructor 
    socket("CPUSocketNAME")
    {
        socket.bind(*this);
    }
    virtual ~CPU(){} //Destructor
//.......
//....... etc
};

tlm_bw_transport_if is out of the TLM source and this class is declared as:
template <typename TYPES = tlm_base_protocol_types>
class tlm_bw_transport_if
  : public virtual tlm_bw_nonblocking_transport_if<typename
TYPES::tlm_payload_type,
                                                   typename
TYPES::tlm_phase_type>
  , public virtual tlm_bw_direct_mem_if
{};

And those base classes are inherited from some other virtual base classes etc.

With this example it goed wrong:
class CPU: public sc_module, public tlm_bw_transport_if<>
{
public:
    tlm_initiator_socket<> socket;

    SC_CTOR(CPU): //constructor 
    socket("CPUSocketNAME")
    {
        socket.bind(*this);
    }
    virtual ~CPU(){} //Destructor
//.......
//....... etc
};

void main()
{
   CPU cpu01("myCPU");
}

The think my program does is setting a breakpoint in the sc_module constructor
So that's the point my program stays when I do try to get the varname where the
CPU object is stored in(that's cpu01). When I do have it, I use the command 
"-var-list-children --all-values VARNAME" to get all the base classes of CPU
object cpu. But when i try this in the first example everything is OK and I can
get the base classes of tlm_bw_transport_if<>, but when I use the GDB MI
command with example 2 on the variabele it sais "virtual base class botch"

var01 is a gdb variabele on cpu01.
the gdb command I use, is like "-var-list-children --all-values
var01.tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types>"

I hope I am clear about the problem and you can understand the problem. Sorry
if my english or explaination is a bit bad.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2022-08-10 17:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29  8:11 [Bug mi/13041] New: Virtual base class botch dj170590 at hotmail dot com
2011-08-03 20:37 ` [Bug mi/13041] " tromey at redhat dot com
2011-08-04  9:47 ` pedro at codesourcery dot com
2011-08-04  9:48 ` pedro at codesourcery dot com
2011-08-04 10:42 ` dj170590 at hotmail dot com
2011-08-04 14:10 ` pedro at codesourcery dot com
2011-08-04 15:04 ` dj170590 at hotmail dot com
2011-08-04 15:30 ` dj170590 at hotmail dot com
2011-08-04 15:56 ` pedro at codesourcery dot com
2012-12-19 21:56 ` tromey at redhat dot com
2012-12-19 21:58 ` tromey at redhat dot com
2022-08-10 17:09 ` [Bug c++/13041] " tromey at sourceware dot org

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