diff --git a/gui/framecache.py b/gui/framecache.py index 94c230d..ad40503 100644 --- a/gui/framecache.py +++ b/gui/framecache.py @@ -16,6 +16,9 @@ import gdb import gui.events import gui.adapt +import gui.invoker + +from gui.startup import in_gdb_thread _last_selected_frame = None @@ -30,6 +33,14 @@ def check_frame(): _last_selected_frame = sel gui.events.frame_changed.post() +# We need this because we rely on the before_prompt hook to notify us +# of frame changes. A dedicated frame change hook would be better. +class FrameCommandInvoker(gui.invoker.Invoker): + @in_gdb_thread + def do_call(self): + gui.invoker.Invoker.do_call(self) + check_frame() + # See my gdb branch on github. if hasattr(gdb.events, 'before_prompt'): gdb.events.before_prompt.connect(check_frame) diff --git a/gui/source.py b/gui/source.py index 6772f49..84b455b 100644 --- a/gui/source.py +++ b/gui/source.py @@ -19,6 +19,7 @@ import gdb import gui import gui.updatewindow from gui.invoker import Invoker +from gui.framecache import FrameCommandInvoker import gui.startup from gui.startup import in_gdb_thread, in_gtk_thread import gui.toplevel @@ -287,8 +288,8 @@ class SourceWindow(gui.updatewindow.UpdateWindow): self.do_continue = Invoker("continue") self.do_finish = Invoker("finish") self.do_stop = Invoker("interrupt") - self.do_up = Invoker("up") - self.do_down = Invoker("down") + self.do_up = FrameCommandInvoker("up") + self.do_down = FrameCommandInvoker("down") builder = gui.startup.create_builder('sourcewindow.xml') builder.connect_signals(self) diff --git a/gui/sourcewindow.xml b/gui/sourcewindow.xml index fa2f218..00facc8 100644 --- a/gui/sourcewindow.xml +++ b/gui/sourcewindow.xml @@ -124,13 +124,14 @@ - + True False Up one frame Up True go-down + @@ -139,13 +140,14 @@ - + True False Down one frame Down True go-up + diff --git a/gui/stack.py b/gui/stack.py index ae9a81b..56c3e8b 100644 --- a/gui/stack.py +++ b/gui/stack.py @@ -24,7 +24,7 @@ import gui.startup import gui.markup import gui.params -from gui.invoker import Invoker +from gui.framecache import FrameCommandInvoker from gui.startup import in_gdb_thread, in_gtk_thread from gi.repository import Gtk @@ -52,8 +52,8 @@ class StackWindow(gui.updatewindow.UpdateWindow): @in_gtk_thread def gtk_initialize(self): - self.do_up = Invoker("up") - self.do_down = Invoker("down") + self.do_up = FrameCommandInvoker("up") + self.do_down = FrameCommandInvoker("down") builder = gui.startup.create_builder('stackwindow.xml') builder.connect_signals(self)