Code::Blocks
Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: ouille on January 26, 2006, 05:01:45 pm
-
Hello,
It will be great if we can modify watches value during a debug session.
Testing the sdk to add this feature, i try to recompile debuggergdb plugins
But i have a link error
undefined reference :wxdialog::MSWProcessMessage(...)
What's wrong in my conf ?
Have a nice day
Ouille
-
Have you looked at the watches script thread below? Maybe an expansion of that concept would be what you want.
-
Hello,
I've look at scripts but it's too complex for me sorry. It seem complex to just modify the value of a watch :(
After managing to get debuggergdb compiling :D, i try to modify On edit watch that way to allow modification of a watch
void DebuggerTree::OnEditWatch(wxCommandEvent& event)
{
wxString cmd;
wxString item = m_pTree->GetItemText(m_pTree->GetSelection());
wxString w = wxGetTextFromUser(_("Edit watch"), _("Enter New Value:"), item);
cmd << _T("set var ") << item << _T("=") << w;
SendCommand(cmd);
return;
if (!w.IsEmpty())
{
DeleteWatch(item);
AddWatch(w);
}
}
BUT my c++ courses are far away now, the sendcommand belong to debuggergdb class, is there a simple way to call it from an other class.
I think it's possible, but don't remember how.
Looking forward at the code it seem's that comunication between debuggergdb an other class are uniderectionnal. To modifiy watch i'll to make them working from debuggergdb to debugger tree and backward, is it right ?
Have a nice day
Ouille
-
Never, ever, use SendCommand(). This is just to pipe a command to the debugger process. It is only to be used by debugger drivers.
Assuming you 're talking gdb here, you have to create a new debugger command inheriting DebuggerCmd and put it inside gdb_commands.h. Look there for examples of how commands are created and what they do. It should be pretty straightforward.
-
Hello,
I just want to pipe a command to the debugger, gdb in fact
sending for example set var i=17
My problem is that i need to send that command from debuggertree class wich manage watch tree class.
I look at debuggercmd.
Bye
Ouille
-
where are gdb_commands.h ?????
Havn't found in source tree !
Bye
Ouille
-
where are gdb_commands.h ?????
Havn't found in source tree !
Bye
Ouille
Open C::B project.
Headers -> plugins -> debuggergdb -> gdb_commands.h
-
Here is it.
haven't found here Headers -> plugins -> debuggergdb -> gdb_commands.h :(
:) :) Here is the function: :) :)
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;
}
This allow watches modification using edit submenus
To add edit submenu on each watches:
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);
}
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
DebuggerGDB* m_pDebugger;
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
-
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.
-
Here is it.
<snip...>
If someone interested ...
Any feedback welcome !
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...
-
Here we go
First of all
Game_ender
Here is my directory
ocks-1.0rc2\src\plugins\debuggergdb
26/01/2006 09:13 <REP> .
26/01/2006 09:13 <REP> ..
25/10/2005 08:59 4 381 backtracedlg.cpp
11/05/2005 11:02 608 backtracedlg.h
25/10/2005 08:59 51 482 debuggergdb.cpp
26/01/2006 23:16 4 340 debuggergdb.h
25/10/2005 08:59 3 108 debuggeroptionsdlg.cpp
18/03/2005 23:23 564 debuggeroptionsdlg.h
27/01/2006 00:01 9 667 debuggertree.cpp
26/01/2006 23:13 1 395 debuggertree.h
25/10/2005 08:59 4 997 disassemblydlg.cpp
28/09/2005 14:56 869 disassemblydlg.h
04/10/2005 20:59 674 Makefile.am
26/01/2006 09:13 <REP> resources
11 fichier(s) 82 085 octets
3 Rép(s) 121 221 120 octets libres
Bah no gdb_commands.h,
This directory is from source code of code block, perhaps i miss something, but codeblock compile.
Sorry if i bother you, but i'll try to find this file, using a search in windows, and dir gdb*.* /s didn't find anything.
So there is a problem in my source tree, sorry, you can understand that looking at debugger:gdb i saw:
cmd << _T("break ") << filename << _T(":") << bp->line + 1;
SendCommand(cmd);
break is a true gdb command ...
So i am perhaps a bit stupid, but source are not sync with your response.
Last but not least, it is not really pleasent when i try to add my to cents to a project to be treated like this.
Mandrav:
i work on debuggergdb so the command needs to be gdb compiant only ?
I've try to expand debuggergdb plungins to add these fonctionnality
I'll try to find gdb_commands.h
Thank's
Have a nice day
-
break is a true gdb command ...
So i am perhaps a bit stupid, but source are not sync with your response.
Last but not least, it is not really pleasent when i try to add my to cents to a project to be treated like this.
No one treated you like stupid. But the responses you got are valid for the development version. You are probably talking about RC2 which would explain a lot :). All you had to do was say which version you 're using in your first post ;).
-
to get up to date :
1) download/install a nightly
2) get the sources from svn
3) build CB and happy coding
Good luck, it's a nice feature you are trying to implement. Looking forward to it.
Cheers,
Lieven
-
2) get the sources from svn
If you're on windows, just install TortoiseSVN (http://tortoisesvn.tigris.org/).
And checkout from svn://svn.berlios.de/codeblocks/trunk
Or if you're in linux, install SVN (http://subversion.tigris.org/).
And checkout doing a svn checkout svn://svn.berlios.de/codeblocks/trunk
:wink:
-
:( Sorry, i was working on the rc2, i though that there where only minors modifs.
I get last svn update, and found gdb_commands :D
I have some problem to compile it, libwxmsv26u why u ???
wxstring beforefirst missing, and working in the rc2 ???
I'll try and give you my code if i manage to make it working.
Have a nice day.
-
:( Sorry, i was working on the rc2, i though that there where only minors modifs.
I get last svn update, and found gdb_commands :D
I have some problem to compile it, libwxmsv26u why u ???
wxstring beforefirst missing, and working in the rc2 ???
I'll try and give you my code if i manage to make it working.
Have a nice day.
u is for UNICODE. :) If you didn't compile wx with UNICODE=1 then leave off the u. :)
-
That u means unicode.
If you don't want to recompile wxWidgets in Unicode mode, change the variable WX_PREFIX from "u" to "".
EDIT: sethjackson won me :P but the forum didn't tell me that anyone posted before :D
-
I have some problem to compile it, libwxmsv26u why u ???
u for UNICODE :D.
Michael
[EDIT] The forum did not tell me too that someone has already posted. And before posting, I have done a page update...
-
That u means unicode.
If you don't want to recompile wxWidgets in Unicode mode, change the variable WX_PREFIX from "u" to "".
EDIT: sethjackson won me :P but the forum didn't tell me that anyone posted before :D
:lol: it is WX_SUFFIX not WX_PREFIX. :lol:
-
That u means unicode.
If you don't want to recompile wxWidgets in Unicode mode, change the variable WX_PREFIX from "u" to "".
EDIT: sethjackson won me :P but the forum didn't tell me that anyone posted before :D
:lol: it is WX_SUFFIX not WX_PREFIX. :lol:
lol :lol: guess I've got to sleep...
-
too late i began a new compile of wxwidget with unicode ...
And know i'm waiting, waiting waiting ...
-
Ok my compile problem is in the wiki
http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.6.1_to_develop_Code::Blocks_%28MSW%29
Bye