[nemiver/follow-fork-mode] Allow pumping just one asm instruction.



commit 206cd7f7e891a64432b040b9c1ebb905a00a123a
Author: Dodji Seketeli <dodji redhat com>
Date:   Sat Jul 17 18:12:33 2010 +0200

    Allow pumping just one asm instruction.
    
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::disassemble_and_do): Add a new parm to pump addresses
    	tight. I.e. to pump just one instruction.
    	(DBGPerspective::load_file): Likewise. Adjust when calling disassemble_and_do.

 src/persp/dbgperspective/nmv-dbg-perspective.cc |   31 +++++++++++++++-------
 1 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index fd63d2c..a125ffc 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -596,7 +596,8 @@ public:
                         SourceEditor *a_editor);
 
     void pump_asm_including_address (SourceEditor *a_editor,
-                                     const Address a_address);
+                                     const Address a_address,
+                                     bool a_tight = false);
 
     void switch_to_source_code ();
 
@@ -697,7 +698,8 @@ public:
                                               Range &) const;
     void refresh_locals ();
     void disassemble (bool a_show_asm_in_new_tab);
-    void disassemble_and_do (IDebugger::DisassSlot &a_what_to_do);
+    void disassemble_and_do (IDebugger::DisassSlot &a_what_to_do,
+                             bool a_tight = false);
     void disassemble_around_address_and_do (const Address &adress,
                                             IDebugger::DisassSlot &what_to_do);
 
@@ -6109,15 +6111,20 @@ DBGPerspective::switch_to_asm (const IDebugger::DisassembleInfo &a_info,
 
 void
 DBGPerspective::pump_asm_including_address (SourceEditor *a_editor,
-                                            const Address a_address)
+                                            const Address a_address,
+                                            bool a_tight)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
     Range r;
 
-    if (!a_editor
-        || !a_editor->get_assembly_address_range (r)
-        || r.contains (a_address))
+    if (!a_editor) {
+        LOG_ERROR ("Got nil editor");
+        return;
+    }
+    a_editor->get_assembly_address_range (r);
+    
+    if (r.contains (a_address))
         return;
 
     r.extend (a_address);
@@ -6126,7 +6133,7 @@ DBGPerspective::pump_asm_including_address (SourceEditor *a_editor,
                                    &DBGPerspective::on_debugger_asm_signal2),
                     a_editor);
 
-    disassemble_and_do (slot);
+    disassemble_and_do (slot, a_tight);
 }
 
 // Get the source editor of the source file being currently debugged,
@@ -7613,7 +7620,8 @@ DBGPerspective::disassemble (bool a_show_asm_in_new_tab)
 }
 
 void
-DBGPerspective::disassemble_and_do (IDebugger::DisassSlot &a_what_to_do)
+DBGPerspective::disassemble_and_do (IDebugger::DisassSlot &a_what_to_do,
+                                    bool a_tight)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
@@ -7635,8 +7643,11 @@ DBGPerspective::disassemble_and_do (IDebugger::DisassSlot &a_what_to_do)
     // archictecture. So let's say N instructions on IA is at
     // maximum N x 17.
     // FIXME: find a way to make this more cross arch.
-    addr_range.max (addr_range.max ()
-                    + m_priv->num_instr_to_disassemble * 17);
+    size_t max = (a_tight)
+        ? addr_range.max () + 17
+        : addr_range.max () + m_priv->num_instr_to_disassemble * 17;
+
+    addr_range.max (max);
 
     THROW_IF_FAIL (addr_range.min () != 0
                    && addr_range.max () != 0);



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