Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Watches modification

<< < (2/5) > >>

ouille:
where are gdb_commands.h ?????
Havn't found in source tree !

Bye
Ouille

sethjackson:

--- Quote from: ouille on January 26, 2006, 11:05:00 pm ---where are gdb_commands.h ?????
Havn't found in source tree !

Bye
Ouille

--- End quote ---

Open C::B project.

Headers -> plugins -> debuggergdb -> gdb_commands.h

ouille:
Here is it.
haven't found here Headers -> plugins -> debuggergdb -> gdb_commands.h :(

:) :) Here is the function: :) :)

--- Code: ---void DebuggerTree::OnEditWatch(wxCommandEvent& event)
{
    wxString cmd,varname;

wxString item = m_pTree->GetItemText(m_pTree->GetSelection());
varname = item.BeforeFirst('=');
item = item.AfterFirst('=');
wxString w = wxGetTextFromUser(_("Edit watch value"), _("Enter New Value:"), item);
if ((item.Contains("\"")) && (!w.Contains("\"")))
            w = _T("\"") + w + _T("\"");

    cmd << _T("set var ") << varname << _T("=") << w;
    m_pDebugger->SendCommand(cmd);
    wxPostEvent(m_pDebugger, event);

    return;
}
--- End code ---

This allow watches modification using edit submenus
To add edit submenu on each watches:

--- Code: ---void DebuggerTree::ShowMenu(wxTreeItemId id, const wxPoint& pt)
{
wxString caption;
    wxMenu menu(wxEmptyString);

// add watch always visible
menu.Append(idEditWatch, _("&Edit watch"));

// we have to have a valid id for the following to be enabled
    if (id.IsOk()  && m_pTree->GetItemParent(id) == m_pTree->GetRootItem())
    {
        menu.Append(idAddWatch, _("&Add watch"));
        menu.Append(idDeleteWatch, _("&Delete watch"));
}

PopupMenu(&menu, pt);
}
--- End code ---
Seem more usefull than add on each element and edit only on root nodes
The rest is not really clean, but i've done what i can

the class definition need's to be modified to have a pointer on the debuggerGDB classe

--- Code: ---        DebuggerGDB* m_pDebugger;
--- End code ---
Copying this from backtrace class

At last
SendCommand need's to be public in debuggerGDB class.
and class debuggerGDB in debuggertree.h

When done you can edit watches values either numerical and strings during debug session.

If someone interested ...
Any feedback welcome !

Have a nice day
Ouille

Game_Ender:
You should of done this the way Mandrav suggested, methods are private for a reason you know.  It was not hard to find gdb_commands.h, you just have to realize that the codeblocks src is not ogranized into and header and include trees.  This is to me is a little messy, but you it means that the header and source files are in the same directory.  So in this case gdb_commands.h is in src/plugins/debuggergdb/gdb_commands.h, I found that in about 3 minutes using viewCVS.  I think a think search in windows or a good old "find . -name gdb_commands.h" in unix would of done the trick.

mandrav:

--- Quote from: ouille on January 27, 2006, 12:15:30 am ---Here is it.

<snip...>

If someone interested ...
Any feedback welcome !

--- End quote ---

May I ask what happens if I am debugging a MSVC executable using CDB? Is "set var" going to work?
Using SendCommand() directly will only give you trouble.
I told you what is the correct way to do it...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version