[nemiver/gtk2-branch] Simplify logic in nmv-local-vars-inspector.cc



commit c099bf2e2985d0ee8afae241eaa5648af4f7fb01
Author: Dodji Seketeli <dodji seketeli org>
Date:   Sun Nov 13 15:02:56 2011 +0100

    Simplify logic in nmv-local-vars-inspector.cc
    
    	* src/persp/dbgperspective/nmv-local-vars-inspector.cc
    	(on_stopped_signal):  Simplify logic.
    	* src/dbgengine/nmv-i-debugger.h (IDebugger::operator==): Make
    	this const.
    	(IDebugger::operator!=): New.

 src/dbgengine/nmv-i-debugger.h                     |    4 ++-
 .../dbgperspective/nmv-local-vars-inspector.cc     |   35 +++++++-------------
 2 files changed, 15 insertions(+), 24 deletions(-)
---
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index e7f4736..fcfca88 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -286,11 +286,13 @@ public:
         /// \operators
         /// @{
 
-        bool operator== (const Frame &a)
+        bool operator== (const Frame &a) const
         {
             return (address () == a.address ());
         }
 
+        bool operator!= (const Frame &a) const {return !(operator== (a));}
+
         /// @}
         /// \name accessors
 
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.cc b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
index 8ead5b3..bf9321f 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
@@ -715,34 +715,23 @@ public:
         LOG_DD ("stopped, reason: " << a_reason);
         if (a_reason == IDebugger::EXITED_SIGNALLED
             || a_reason == IDebugger::EXITED_NORMALLY
-            || a_reason == IDebugger::EXITED) {
+            || a_reason == IDebugger::EXITED
+            || !a_has_frame) {
             return;
         }
 
         THROW_IF_FAIL (debugger);
-        if (a_has_frame) {
-            saved_frame = a_frame;
-            LOG_DD ("prev frame address: '"
-                    << previous_function_name
-                    << "'");
-            LOG_DD ("cur frame address: "
-                    << a_frame.function_name ()
-                    << "'");
-            if (previous_function_name == a_frame.function_name ()) {
-                is_new_frame = false;
-            } else {
-                is_new_frame = true;
-            }
+        is_new_frame = (saved_frame != a_frame);
+        saved_frame = a_frame;
 
-            if (should_process_now ()) {
-                finish_handling_debugger_stopped_event (a_reason,
-                                                        a_has_frame,
-                                                        a_frame);
-            } else {
-                saved_reason = a_reason;
-                saved_has_frame = a_has_frame;
-                is_up2date = false;
-            }
+        if (should_process_now ()) {
+            finish_handling_debugger_stopped_event (a_reason,
+                                                    a_has_frame,
+                                                    a_frame);
+        } else {
+            saved_reason = a_reason;
+            saved_has_frame = a_has_frame;
+            is_up2date = false;
         }
 
         NEMIVER_CATCH



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