From 112b975c2d9db87c43b42437bd5c2eaf20f2257e Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Fri, 11 Mar 2011 18:35:03 +0000 Subject: [PATCH] Bug 327061 - [Mac] Run To Line throws exceptions, breaks debugging --- .../cdt/dsf/gdb/service/GDBRunControl.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java index 98f974db453..85689adcdc2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Wind River Systems and others. + * Copyright (c) 2006, 2011 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadExitEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIFrame; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; import org.eclipse.cdt.dsf.service.DsfSession; @@ -360,8 +361,7 @@ public class GDBRunControl extends MIRunControl { if (e instanceof MIBreakpointHitEvent) { bpId = ((MIBreakpointHitEvent)e).getNumber(); } - String fileLocation = e.getFrame().getFile() + ":" + e.getFrame().getLine(); //$NON-NLS-1$ - String addrLocation = e.getFrame().getAddress(); + // Here we check three different things to see if we are stopped at the right place // 1- The actual location in the file. But this does not work for breakpoints that // were set on non-executable lines @@ -373,9 +373,18 @@ public class GDBRunControl extends MIRunControl { // So this works for the large majority of cases. The case that won't work is when the user // does a runToLine to a line that is non-executable AND has another breakpoint AND // has multiple addresses for the breakpoint. I'm mean, come on! - if (fileLocation.equals(fRunToLineActiveOperation.getFileLocation()) || - addrLocation.equals(fRunToLineActiveOperation.getAddrLocation()) || - bpId == fRunToLineActiveOperation.getBreakointId()) { + boolean equalFileLocation = false; + boolean equalAddrLocation = false; + boolean equalBpId = bpId == fRunToLineActiveOperation.getBreakointId(); + MIFrame frame = e.getFrame(); + if(frame != null) { + String fileLocation = frame.getFile() + ":" + frame.getLine(); //$NON-NLS-1$ + String addrLocation = frame.getAddress(); + equalFileLocation = fileLocation.equals(fRunToLineActiveOperation.getFileLocation()); + equalAddrLocation = addrLocation.equals(fRunToLineActiveOperation.getAddrLocation()); + } + + if (equalFileLocation || equalAddrLocation || equalBpId) { // We stopped at the right place. All is well. fRunToLineActiveOperation = null; } else {