[PATCH] 667723 - can't load core dump



It looks like I broke the core dump file loading feature of Nemiver in
the process of re-organizing frame listing handling, I guess, when I
did the "on-the-fly" disassembling work.

In this issue, Nemiver won't display the call stack after it loads the
core file.  This is because the debugging perspective instructs the
debugger to list frames, but the CallStack graphical component is not
listening; so it won't update its graphical state accordingly.

In this patch, the debugging perspective logically delegates the call
stack updating to the CallStack component.  I have added a parameter
to CallStack::update_stack to let it select the top-most frame of the
call stack, so that the source editor can actually show the point at
which the crash happened.

Tested and applied to master.

commit e2f887c5beb03d88abfa7e5faf5e72203aa22153
Author: Dodji Seketeli <dodji seketeli org>
Date:   Sun Feb 19 18:30:47 2012 +0100

    667723 - can't load core dump
    
    	* src/persp/dbgperspective/nmv-call-stack.h
    	(CallStack::update_stack): Take a parameter to select the top most
    	frame of the call stack.
    	* src/persp/dbgperspective/nmv-call-stack.cc
    	(CallStack::Priv::set_current_frame):  Split from ...
    	(CallStack::Priv::update_selected_frame): ... here.
    	(CallStack::Priv::{on_frames_listed, update_call_stack}): Take a
    	parameter to select the top most frame of the call stack.  Pass it
    	to the new set_current_frame.
    	(CallStack::Priv::finish_update_handling): Adjust.
    	(CallStack::update_stack): Take a parameter to select the top most
    	frame of the call stack.
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::load_core_file): Don't just instruct the debugger
    	to list call frames.  No client code is listening to update.
    	Rather, delegate that job to the call stack widget.

diff --git a/src/persp/dbgperspective/nmv-call-stack.cc b/src/persp/dbgperspective/nmv-call-stack.cc
index c33c9a2..b2b2ca4 100644
--- a/src/persp/dbgperspective/nmv-call-stack.cc
+++ b/src/persp/dbgperspective/nmv-call-stack.cc
@@ -223,6 +223,22 @@ struct CallStack::Priv {
         return callstack_menu;
     }
 
+    /// Set the frame at a_index as the current frame.  This makes the
+    /// whole perspective to udpate accordingly.
+    void
+    set_current_frame (unsigned a_index)
+    {
+        THROW_IF_FAIL (a_index < frames.size ());
+        cur_frame = frames[a_index];
+        THROW_IF_FAIL (cur_frame.level () >= 0);
+        in_set_cur_frame_trans = true;
+
+        LOG_DD ("frame selected: '"<<  (int) cur_frame_index << "'");
+        LOG_DD ("frame level: '" << (int) cur_frame.level () << "'");
+
+        debugger->select_frame (a_index);
+    }
+
     /// If the selected frame is the "expand to see more frames" raw,
     /// ask the debugger engine for more frames.
     /// Otherwise, just set the "current frame" variable.
@@ -245,15 +261,7 @@ struct CallStack::Priv {
             return;
         }
 
-        cur_frame_index = (*a_row_iter)[columns ().frame_index];
-        THROW_IF_FAIL (cur_frame_index < frames.size ());
-        cur_frame = frames[cur_frame_index];
-        THROW_IF_FAIL (cur_frame.level () >= 0);
-        in_set_cur_frame_trans = true;
-
-        LOG_DD ("frame selected: '"<<  (int) cur_frame_index << "'");
-        LOG_DD ("frame level: '" << (int) cur_frame.level () << "'");
-        debugger->select_frame (cur_frame_index);
+        set_current_frame ((*a_row_iter)[columns ().frame_index]);
     }
 
     void 
@@ -261,7 +269,8 @@ struct CallStack::Priv {
     {
         THROW_IF_FAIL (debugger);
         debugger->list_frames (frame_low, frame_high,
-			       sigc::mem_fun (*this, &Priv::on_frames_listed),
+			       sigc::bind (sigc::mem_fun (*this, &Priv::on_frames_listed),
+                                           /*a_select_top_most*/false),
 			       "");
     }
 
@@ -342,7 +351,8 @@ struct CallStack::Priv {
     }
 
     void
-    on_frames_listed (const vector<IDebugger::Frame> &a_stack)
+    on_frames_listed (const vector<IDebugger::Frame> &a_stack,
+                      bool a_select_top_most = false)
     {
         LOG_FUNCTION_SCOPE_NORMAL_DD;
 
@@ -365,6 +375,9 @@ struct CallStack::Priv {
                                          (*this, &Priv::on_frames_args_listed),
                                          "");
 
+        if (a_select_top_most)
+            set_current_frame (0);
+
         NEMIVER_CATCH;
     }
 
@@ -840,11 +853,14 @@ struct CallStack::Priv {
 
     }
 
-    void update_call_stack ()
+    void
+    update_call_stack (bool a_select_top_most = false)
     {
         THROW_IF_FAIL (debugger);
         debugger->list_frames (0, frame_high,
-                               sigc::mem_fun (*this, &Priv::on_frames_listed),
+                               sigc::bind (sigc::mem_fun
+                                           (*this, &Priv::on_frames_listed),
+                                           a_select_top_most),
                                "");
     }
 };//end struct CallStack::Priv
@@ -895,13 +911,16 @@ CallStack::widget () const
     return *m_priv->get_widget ();
 }
 
+/// Query the debugging engine for the call stack and display it.  If
+/// a_select_top_most is true, select the topmost frame of the stack
+/// and emit the CallStack::frame_selected_signal accordingly.
 void
-CallStack::update_stack ()
+CallStack::update_stack (bool a_select_top_most)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     THROW_IF_FAIL (m_priv);
 
-    m_priv->update_call_stack ();
+    m_priv->update_call_stack (a_select_top_most);
 }
 
 void
diff --git a/src/persp/dbgperspective/nmv-call-stack.h b/src/persp/dbgperspective/nmv-call-stack.h
index 57d7fd0..fe6e739 100644
--- a/src/persp/dbgperspective/nmv-call-stack.h
+++ b/src/persp/dbgperspective/nmv-call-stack.h
@@ -62,7 +62,7 @@ public:
     bool is_empty ();
     const vector<IDebugger::Frame>& frames () const;
     IDebugger::Frame& current_frame () const;
-    void update_stack ();
+    void update_stack (bool select_top_most = false);
     void clear ();
     Gtk::Widget& widget () const;
     sigc::signal<void,
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 4163cd8..48cf7bb 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -6333,6 +6333,7 @@ DBGPerspective::run ()
 void
 DBGPerspective::load_core_file ()
 {
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
     LoadCoreDialog dialog (plugin_path ());
 
     int result = dialog.run ();
@@ -6353,6 +6354,8 @@ void
 DBGPerspective::load_core_file (const UString &a_prog_path,
                                 const UString &a_core_file_path)
 {
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+
     THROW_IF_FAIL (m_priv);
 
     if (a_prog_path != m_priv->prog_path && get_num_notebook_pages ()) {
@@ -6360,7 +6363,7 @@ DBGPerspective::load_core_file (const UString &a_prog_path,
     }
 
     debugger ()->load_core_file (a_prog_path, a_core_file_path);
-    debugger ()->list_frames ();
+    get_call_stack ().update_stack (/*select_top_most=*/true);
 }
 
 void

-- 
		Dodji


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