diff --git a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/NativeDebuggerImpl.java b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/NativeDebuggerImpl.java --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/NativeDebuggerImpl.java +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/NativeDebuggerImpl.java @@ -129,6 +129,7 @@ import org.openide.cookies.EditorCookie; import org.openide.util.Lookup; import org.openide.util.Pair; +import org.openide.util.RequestProcessor; import org.openide.util.actions.SystemAction; /** @@ -981,9 +982,12 @@ * Else, if user has requested disassembly or no source information is * available, bring up the disassembler. */ + + private static final RequestProcessor RP = new RequestProcessor("Debugger location updater", 1); + private void updateLocation(final boolean andShow, final ShowMode showModeOverride, final boolean focus) { - NativeDebuggerManager.getRequestProcessor().post(new Runnable() { + RP.post(new Runnable() { @Override public void run() { final Location loc = getVisitedLocation(); diff --git a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/assembly/Disassembly.java b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/assembly/Disassembly.java --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/assembly/Disassembly.java +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/assembly/Disassembly.java @@ -219,12 +219,19 @@ if (dis != null) { dis.debugger.registerDisassembly(dis); dis.reload(); + } else { + opening = false; + opened = false; } } catch (Exception e) { Exceptions.printStackTrace(e); } } - + + protected final void reloadFailed() { + opening = false; + } + protected abstract void reload(); public static void close() { diff --git a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java --- a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java +++ b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDebuggerImpl.java @@ -149,7 +149,7 @@ static final Logger LOG = Logger.getLogger(GdbDebuggerImpl.class.toString()); private final GdbHandlerExpert handlerExpert; - private MILocation homeLoc; + private volatile MILocation homeLoc; private boolean dynamicType; private DisModel disModel = new DisModel(); @@ -2554,7 +2554,6 @@ } stackUpdater.treeChanged(); // causes a pull - disassembly.stateUpdated(); } /* @@ -3749,7 +3748,6 @@ MIValue frameValue = (results != null) ? results.valueOf(MI_FRAME) : null; MITList frameTuple; MITList stack; - boolean visited = false; // Mac 10.4 gdb provides no "frame" attribute // For the scenario that stack view is closed and local view @@ -3761,19 +3759,10 @@ } if (srcResults != null) { + boolean visited = false; stack = srcResults.valueOf("stack").asList(); // NOI18N - if (false) { - // We have information about what src location we're - // stopped in. - if (frameValue != null) - frameTuple = frameValue.asTuple(); - homeLoc = MILocation.make(this, frameTuple, srcResults, false, stack.size(), breakpoint); - - } else { - frameValue = ((MIResult)stack.asList().get(0)).value(); - frameTuple = frameValue.asTuple(); - homeLoc = MILocation.make(this, frameTuple, null, false, stack.size(), breakpoint); - } + frameValue = ((MIResult) stack.asList().get(0)).value(); + frameTuple = frameValue.asTuple(); // find the first frame with source info if dis was not requested for (MITListItem stf : stack.asList()) { @@ -3783,16 +3772,17 @@ } visited = true; } - + homeLoc = MILocation.make(this, frameTuple, srcResults, visited, stack.size(), breakpoint); state().isUpAllowed = !homeLoc.bottomframe(); state().isDownAllowed = !homeLoc.topframe(); setStack(srcRecord); } else { frameTuple = ( frameValue == null ? null : frameValue.asTuple() ); stack = null; + homeLoc = MILocation.make(this, frameTuple, null, false, 0, breakpoint); } - - setVisitedLocation(MILocation.make(this, frameTuple, null, visited, (stack == null ? 0 :stack.size()), breakpoint)); + + setVisitedLocation(homeLoc); // if (get_frames || get_locals) { // showStackFrames(); diff --git a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDisassembly.java b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDisassembly.java --- a/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDisassembly.java +++ b/cnd.debugger.gdb2/src/org/netbeans/modules/cnd/debugger/gdb2/GdbDisassembly.java @@ -306,20 +306,24 @@ private void reloadDis(boolean withSource, boolean force) { this.withSource = withSource; if (!opened) { + reloadFailed(); return; } Frame frame = getDebugger().getCurrentFrame(); if (frame == null) { + reloadFailed(); return; } String curAddress = frame.getCurrentPC(); if (curAddress == null || curAddress.length() == 0) { + reloadFailed(); return; } if (!curAddress.equals(address)) { requestMode = withSource ? RequestMode.FILE_SRC : RequestMode.FILE_NO_SRC; } else if (requestMode == RequestMode.NONE) { + reloadFailed(); return; }