Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Help How do you get GDB to "p (cast) *pointer?

(1/2) > >>

Pecan:
I'm trying to run down some of the crashes in the RC3 wxKeybinder code.
In the following example (at bottom) GDB refuses to "p (wxMenuItem) *m_pItem" even though it knows about the structure.

How can I dump the object of "m_pItem->".

I've read the G*#!@D#!@B documentation twice. GDB can be so frustrating
at times.
 

--- Code: ---(gdb) frame 2
#2  0x0044d5c6 in wxMenuCmd::Update (this=0x1e3e798)
    at src/wxKeyBinder/src/menuutils.cpp:78
78           strText = m_pItem->GetText();
Current language:  auto; currently c++
(gdb) l
73              //Pecan 01
74              // CodeBlocks contains filenames in menuitems
75              // which contain "\\" that look like accelerators
76              // and hotkeys that crash GetLabel()
77          wxString strText("");
78           strText = m_pItem->GetText();
79              if (strText.Contains(_T("\\\\")))
80                return ;
81
82              wxString str = m_pItem->GetLabel();
(gdb) p this
$1 = (wxMenuCmd * const) 0x1e3e798
(gdb) p *this
$2 = {<wxCmd> = {_vptr$wxCmd = 0x4b32ac, m_keyShortcut = {{
        _vptr$wxKeyBind = 0x4b3294, m_nFlags = -1, m_nKeyCode = -1}, {
        _vptr$wxKeyBind = 0x4b3294, m_nFlags = -1, m_nKeyCode = -1}, {
        _vptr$wxKeyBind = 0x4b3294, m_nFlags = -1, m_nKeyCode = -1}},
    m_nShortcuts = 0, m_strName = {<wxStringBase> = {static npos = 4294967295,
        m_pchData = 0x1e3518c "1 CodeBlocks-NewBuild.cbp"}, <No data fields>},
    m_strDescription = {<wxStringBase> = {static npos = 4294967295,
        m_pchData = 0x104cfbcc ""}, <No data fields>}, m_nId = 520,
    static m_arrCmdType = 0x4b5d00, static m_nCmdTypes = 1},
  m_pItem = 0x16eca88, static m_pMenuBar = 0x165b008}
(gdb) p m_pItem
$3 = (struct wxMenuItem *) 0x16eca88
(gdb) p *m_pItem
$4 = <incomplete type>
(gdb) p (wxMenuItem) *m_pItem
No symbol "wxMenuItem" in current context.
(gdb) p (wxMenuItem) *0x16eca88
No symbol "wxMenuItem" in current context.
(gdb)

--- End code ---

thanks
Pecan

rickg22:
Pecan: You can compile the SVN head version, it has improved the built-in debugger interface A LOT.

Pecan:
Rick, a little help here..

So, from a cmd window with the path set to ...\devel,
I started codeblocks.exe.
It starts and loads the plugin to be tested.
I load the project and the source files open.
I set a breakpoint.
I look in Task Mgr for the PID
I menu->debug->attach to PID

codeblocks is now frozen. Cant even activate the menus.
Task Manger cant even kill c::b. I have to reboot the system.

WinXpSp2 1/2 gig, 1.9 ghz M processor.

AND, worst of all, the Mass in C Minor is hosed with some
female screaming to the top of her MayWests.

thanks
Pecan

Urxae:

--- Quote from: Pecan on December 10, 2005, 04:48:26 pm ---So, from a cmd window with the path set to ...\devel,
I started codeblocks.exe.
It starts and loads the plugin to be tested.
I load the project and the source files open.
I set a breakpoint.
I look in Task Mgr for the PID
I menu->debug->attach to PID

codeblocks is now frozen. Cant even activate the menus.
Task Manger cant even kill c::b. I have to reboot the system.

--- End quote ---

You realize you should do that from a separate instance of Code::Blocks, right :shock:? Having a process debug itself is pretty much a recipy for deadlock...

Pecan:
Oh, no I did not realize that...

Ok, so does that mean I have to have two
codeblocks running.  Im still confused (a congenital state for me).

Which one has the plugin running and which one has the source?

thanks
pecan

Navigation

[0] Message Index

[#] Next page

Go to full version