[PATCH 3/3] 664463 - cannot debug the same software twice



Hello,

When Nemiver is started on an inferior, it sets a breakpoint to the
symbol "main", and runs.  That makes the inferior to break at the
location of main.  That breakpoint is saved in memory, so that when
you re-run the inferior (by hitting shift-F5 or the restart button)
that breakpoint is set again after the binary is re-loaded, if need
be.

The problem in this bug arises when, for a reason, the breakpoint
fails to be set.  That can happen on binaries from which symbols are
completely stripped, for instance.  In that case, the breakpoint we
tried to set (by name) the first time, wasn't set.  So the breakpoint
doesn't get any valid address.

Thus when the binary is re-run, we try to set the breakpoint at the
same address it was set the first time.  As there was no address
(because the breakpoint couldn't be set that first time) an assertion
is violated because we are trying to set a breakpoint at a void
address.

This patch avoids setting a breakpoint with an empty address.  So we
just do away with trying to re-set the breakpoint in this case.

Tested and applied to master.

	* src/persp/dbgperspective/nmv-dbg-perspective.cc
	(DBGPerspective::set_breakpoint): Don't try to set a breakpoint if
	it has neither and address nor a filename set.
---
 src/persp/dbgperspective/nmv-dbg-perspective.cc |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 87a1ad9..7f00a2d 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -6644,10 +6644,12 @@ DBGPerspective::set_breakpoint (const IDebugger::Breakpoint &a_breakpoint)
                                          a_breakpoint.line (),
                                          a_breakpoint.condition (),
                                          ignore_count, cookie);
-        else
+        else if (!a_breakpoint.address ().empty ())
             debugger ()->set_breakpoint (a_breakpoint.address (),
                                          a_breakpoint.condition (),
                                          ignore_count, cookie);
+        // else we don't set this breakpoint as it has neither an
+        // address or a file name associated.
     } else if (a_breakpoint.type ()
                == IDebugger::Breakpoint::WATCHPOINT_TYPE) {
         debugger ()->set_watchpoint (a_breakpoint.expression (),
-- 
1.7.6.4


-- 
		Dodji


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