1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Bug 327716 - [disassembly] NPE in BreakpointsAnnotationModel

This commit is contained in:
Anton Leherbauer 2010-10-14 09:37:05 +00:00
parent b99efd0422
commit 918eb1278a

View file

@ -9,7 +9,6 @@
* Anton Leherbauer (Wind River Systems) - initial API and implementation
* Patrick Chuong (Texas Instruments) - bug 300053
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model;
import java.math.BigInteger;
@ -206,10 +205,8 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
}
} else {
String fileName= marker.getAttribute(ICLineBreakpoint.SOURCE_HANDLE, null);
if (fileName != null) {
position= createPositionFromSourceLine(fileName, lineNumber);
}
}
return position;
}
}
@ -218,8 +215,11 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
}
private Position createPositionFromSourceLine(String fileName, int lineNumber) {
if (fileName != null) {
return getDisassemblyDocument().getSourcePosition(fileName, lineNumber);
}
return null;
}
private Position createPositionFromSourceLine(IFile file, int lineNumber) {
return getDisassemblyDocument().getSourcePosition(file, lineNumber);
@ -258,6 +258,7 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
* @return address value as <code>BigInteger</code> or <code>null</code> in case of a <code>NumberFormatException</code>
*/
private static BigInteger decodeAddress(String string) {
if (string != null) {
try {
if (string.startsWith("0x")) { //$NON-NLS-1$
return new BigInteger(string.substring(2), 16);
@ -268,6 +269,7 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
} catch (NumberFormatException nfe) {
// don't propagate
}
}
return null;
}