[nemiver] Properly list arguments of the selected frame, not of the top most only



commit d1aaf19b42eaaa7ca64bf760e6ac4ff1cb9edc92
Author: Dodji Seketeli <dodji redhat com>
Date:   Fri May 1 14:41:30 2009 +0200

    Properly list arguments of the selected frame, not of the top most only
    
    	* src/persp/dbgperspective/nmv-local-vars-inspector.cc,h:
    	(LocalVarsInspector::Priv::finish_handling_debugger_stopped_event):
    	Remember the current frame. List the frame arguments of the current
    	frame, not of the frame which index is 0.
    	(LocalVarsInspector::Priv::on_frames_params_listed_signal):
    	Look for the arguments of the previously saved frame, not just for
    	the frame at level 0.
    	(LocalVarsInspector::show_local_variables_of_current_function):
    	Make this accept a frame in parameter. This is the frame
    	the function needs to fetch the arguments for. It's not clean to do
    	this but we have no easy way to fetch the arguments of the "current"
    	function, unfortunately.
---
 src/persp/dbgperspective/nmv-dbg-perspective.cc    |   15 ++++-
 .../dbgperspective/nmv-local-vars-inspector.cc     |   61 ++++++++++++--------
 .../dbgperspective/nmv-local-vars-inspector.h      |    3 +-
 3 files changed, 49 insertions(+), 30 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 5cfa1d7..59f292e 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -1532,8 +1532,10 @@ DBGPerspective::on_thread_list_thread_selected_signal (int a_tid)
 
     NEMIVER_TRY
 
-    get_call_stack ().update_stack ();
-    get_local_vars_inspector ().show_local_variables_of_current_function ();
+    THROW_IF_FAIL (m_priv);
+
+    get_local_vars_inspector ().show_local_variables_of_current_function
+                                                        (m_priv->current_frame);
 
     NEMIVER_CATCH
 }
@@ -2233,6 +2235,7 @@ DBGPerspective::on_frame_selected_signal (int a_index,
     if (a_index) {}
     NEMIVER_TRY
 
+    m_priv->current_frame = a_frame;
     UString file_path = a_frame.file_full_name ();
 
     if (file_path == "") {
@@ -2254,7 +2257,8 @@ DBGPerspective::on_frame_selected_signal (int a_index,
         //TODO: we should disassemble the current frame and display it.
     }
 
-    get_local_vars_inspector ().show_local_variables_of_current_function ();
+    get_local_vars_inspector ().show_local_variables_of_current_function
+                                                                    (a_frame);
     set_where (file_path, a_frame.line ());
 
     NEMIVER_CATCH
@@ -5831,7 +5835,10 @@ DBGPerspective::set_breakpoint_using_dialog (const UString &a_function_name)
 void
 DBGPerspective::refresh_locals ()
 {
-    get_local_vars_inspector ().show_local_variables_of_current_function ();
+
+    THROW_IF_FAIL (m_priv);
+    get_local_vars_inspector ().show_local_variables_of_current_function
+                                                        (m_priv->current_frame);
 }
 
 void
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.cc b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
index b466b38..bcd0e94 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
@@ -534,34 +534,40 @@ public:
 
     void finish_handling_debugger_stopped_event
                                     (IDebugger::StopReason /*a_reason*/,
-                                     bool /*a_has_frame*/,
+                                     bool a_has_frame,
                                      const IDebugger::Frame &a_frame)
     {
         LOG_FUNCTION_SCOPE_NORMAL_DD;
 
         NEMIVER_TRY
 
-            THROW_IF_FAIL (tree_store);
-            if (is_new_frame) {
-                LOG_DD ("init tree view");
-                re_init_tree_view ();
-                LOG_DD ("list local variables");
-                debugger->list_local_variables ();
-                LOG_DD ("list frames arguments");
-                debugger->list_frames_arguments (0, 0);
-            } else {
-                IVarListWalkerSafePtr walker_list =
-                                    get_local_vars_walker_list ();
-                THROW_IF_FAIL (walker_list);
-                walker_list->do_walk_variables ();
-                walker_list = get_function_args_vars_walker_list ();
-                THROW_IF_FAIL (walker_list);
-                walker_list->do_walk_variables ();
-                walker_list = get_derefed_variables_walker_list ();
-                THROW_IF_FAIL (walker_list);
-                walker_list->do_walk_variables ();
-            }
-            previous_function_name = a_frame.function_name ();
+        if (!a_has_frame)
+            return;
+
+        saved_frame = a_frame;
+
+        THROW_IF_FAIL (tree_store);
+        if (is_new_frame) {
+            LOG_DD ("init tree view");
+            re_init_tree_view ();
+            LOG_DD ("list local variables");
+            debugger->list_local_variables ();
+            LOG_DD ("list frames arguments");
+            debugger->list_frames_arguments (a_frame.level (),
+                                             a_frame.level ());
+        } else {
+            IVarListWalkerSafePtr walker_list =
+                                get_local_vars_walker_list ();
+            THROW_IF_FAIL (walker_list);
+            walker_list->do_walk_variables ();
+            walker_list = get_function_args_vars_walker_list ();
+            THROW_IF_FAIL (walker_list);
+            walker_list->do_walk_variables ();
+            walker_list = get_derefed_variables_walker_list ();
+            THROW_IF_FAIL (walker_list);
+            walker_list->do_walk_variables ();
+        }
+        previous_function_name = a_frame.function_name ();
 
         NEMIVER_CATCH
     }
@@ -649,7 +655,7 @@ public:
         THROW_IF_FAIL (walker_list);
 
         map<int, list<IDebugger::VariableSafePtr> >::const_iterator it;
-        it = a_frames_params.find (0);
+        it = a_frames_params.find (saved_frame.level ());
         if (it == a_frames_params.end ()) {
             LOG_DD ("no frame params found");
             return;
@@ -875,15 +881,20 @@ LocalVarsInspector::widget () const
 }
 
 void
-LocalVarsInspector::show_local_variables_of_current_function ()
+LocalVarsInspector::show_local_variables_of_current_function
+                                                (const IDebugger::Frame &a_frame)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     THROW_IF_FAIL (m_priv);
     THROW_IF_FAIL (m_priv->debugger);
 
+    m_priv->saved_frame = a_frame;
+
     re_init_widget ();
     m_priv->debugger->list_local_variables ();
-    m_priv->debugger->list_frames_arguments (0, 0);
+    int frame_level = m_priv->debugger->get_current_frame_level ();
+    LOG_DD ("current frame level: " <<  (int)frame_level);
+    m_priv->debugger->list_frames_arguments (frame_level, frame_level);
 }
 
 void
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.h b/src/persp/dbgperspective/nmv-local-vars-inspector.h
index 7fea11c..58aaa8e 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.h
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.h
@@ -59,7 +59,8 @@ public:
     Gtk::Widget& widget () const;
     void set_local_variables
                     (const std::list<IDebugger::VariableSafePtr> &a_vars);
-    void show_local_variables_of_current_function ();
+    void show_local_variables_of_current_function
+                                        (const IDebugger::Frame &a_frame);
     void re_init_widget ();
 };//end LocalVarsInspector
 



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