Re: Adding a new menu entry to launch the gdb console...



Hello Seemanta,

Seemanta Dutta a écrit :

[...]

> 1. Is there a way to directly pass on the gdb commands to the underlying gdb
> engine?

No. And it wouldn't be desirable. I explain why below.

> Other approach would be to parse the commands into IDebugger format
> and then IDebugger would again re-convert them into gdb commands which gdb
> only would understand.
> If we follow the first approach, we skip one step and bypass IDebugger
> entirely. Is that advisable? Or do you advise to still convert to IDebugger
> and then let IDebugger do the rest ?

The second approach is the best I think.

There are many arguments in favour of using that approach:

First, the GDBEngine implementation of IDebugger does much more than
just feeding GDB with commands. It does things like understanding GDB's
reply messages, command control flow (making sure that we don't feed GDB
with many commands at once), Integration with the glib mainloop (to make
sure we don't freeze when talking with GDB) etc ...

Second, you want the eventual command line interpreter tp share the same
context as other parts of the debugging perspective; e.g: when you type
"next" to execute the next command, you want the graphical cursor that
shows the next command to move as well. For that, you need to write a
command interpreter on top of IDebugger, so that other parts of Nemiver
that are using IDebugger as well share the same context, by construction.

Another argument to use IDebugger is that Nemiver is /not/ a GDB User
Interface. It's a graphical debugger that /happens/ to use GDB today.
What if you want to support another debugger of another language
tomorrow ? So whatever needs to talk with GDB today should make it
through IDebugger. That way tomorrow, when we want to use another low
level debugging engine, we'll "only" provide another implementation to
IDebugger. The changes that will be required at the debugging
perspective level will hopefully be less intrusive than if it was
depending on the lower level debugging engine.

> 2. Secondly, I tried to add some new action entries within the
> nmv-dbg-perspective.cc  file after line 2932. I just added a new array
> element in the array of the ui_utils::ActionEntry structures. My idea was to
> add a new menu item like View-->Show GDB Console.
> 
> However, when I did `make` and `make install`, nothing happened. My new menu
> item, 'Show GDB console' did not appear on the view menu.
> 
> Can anyone help me? Is there anything else I need to do to be able to add a
> new menu item in nemiver ?

I think this is related to the way the Menu mechanism works in GTK+.

The menu machinery is organized around pieces of UI (named menu items)
and Actions.
A Menu Items represent what you see, and Actions is the behaviour that
occurs whenever you click on a menu item.
The array of elements you talked about earlier defines /Actions/ to be
associated to menu items (and toolbar buttons). Now you need to define
the menu items (and toolbar buttons) you want to /see/ appear, and
"associate" those menu items with the actions you defined in the actions
array.
Menu items are defined in the xml file
src/persp/dbgperspective/menus/menus.xml. Looking at it should self
teach you how to add an entry there.

The formal documentation about Action based menus (and toolbars) in GTK+
is available at http://library.gnome.org/devel/gtk/stable/Actions.html.

I hope this helps.

Dodji.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]