mirror of
https://github.com/tromey/gdb-gui.git
synced 2025-12-16 07:10:04 +01:00
add "gui log" and friends
This adds the "gui log" command, which pops up a window you can use for logging. There are also new "gui" subcommands for sending output to a log window: gui print, gui output, gui printf, and gui dprintf. These all work pretty much like their non-gui counterparts, except that the output goes to the log window. If you have more than one log window you can specify which one to use with an "@", like gui print @1 value
This commit is contained in:
@@ -56,38 +56,18 @@ class _ToplevelState(object):
|
||||
print ' %3d %s' % (window.number,
|
||||
window.window.get_title())
|
||||
|
||||
_toplevel_state = _ToplevelState()
|
||||
state = _ToplevelState()
|
||||
|
||||
class Toplevel(object):
|
||||
def __init__(self):
|
||||
_toplevel_state.add(self)
|
||||
state.add(self)
|
||||
# The subclass must set this.
|
||||
self.window = None
|
||||
|
||||
def destroy(self):
|
||||
_toplevel_state.remove(self)
|
||||
state.remove(self)
|
||||
gui.startup.send_to_gtk(self.window.destroy)
|
||||
self.window = None
|
||||
|
||||
class InfoWindowsCommand(gdb.Command):
|
||||
def __init__(self):
|
||||
super(InfoWindowsCommand, self).__init__('info windows',
|
||||
gdb.COMMAND_SUPPORT)
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
self.dont_repeat()
|
||||
_toplevel_state.display()
|
||||
|
||||
class DeleteWindowsCommand(gdb.Command):
|
||||
def __init__(self):
|
||||
super(DeleteWindowsCommand, self).__init__('delete window',
|
||||
gdb.COMMAND_SUPPORT)
|
||||
|
||||
def invoke(self, arg, from_tty):
|
||||
self.dont_repeat()
|
||||
winno = int(arg)
|
||||
window = _toplevel_state.get(winno)
|
||||
if window is not None:
|
||||
window.destroy()
|
||||
|
||||
InfoWindowsCommand()
|
||||
DeleteWindowsCommand()
|
||||
def valid(self):
|
||||
return self.window is not None
|
||||
|
||||
Reference in New Issue
Block a user