mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 444736 - Importing a subset of exported breakpoints often logs exceptions
This fixes also Bug 413787 - Occasional "Breakpoint does not have an associated marker" in the log
This commit is contained in:
parent
db67b263b9
commit
f3860cc65b
3 changed files with 32 additions and 17 deletions
|
@ -321,22 +321,32 @@ public class CDebugUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getBreakpointText(IBreakpoint breakpoint, boolean qualified) throws CoreException {
|
public static String getBreakpointText(IBreakpoint breakpoint, boolean qualified) throws CoreException {
|
||||||
if (breakpoint instanceof ICAddressBreakpoint) {
|
try {
|
||||||
return getAddressBreakpointText((ICAddressBreakpoint)breakpoint, qualified);
|
if (breakpoint instanceof ICAddressBreakpoint) {
|
||||||
|
return getAddressBreakpointText((ICAddressBreakpoint)breakpoint, qualified);
|
||||||
|
}
|
||||||
|
if (breakpoint instanceof ICFunctionBreakpoint) {
|
||||||
|
return getFunctionBreakpointText((ICFunctionBreakpoint)breakpoint, qualified);
|
||||||
|
}
|
||||||
|
if (breakpoint instanceof ICLineBreakpoint) {
|
||||||
|
return getLineBreakpointText((ICLineBreakpoint)breakpoint, qualified);
|
||||||
|
}
|
||||||
|
if (breakpoint instanceof ICWatchpoint) {
|
||||||
|
return getWatchpointText((ICWatchpoint)breakpoint, qualified);
|
||||||
|
}
|
||||||
|
// This allows to create a new breakpoint without implementing one of the interfaces above and still see a label
|
||||||
|
Object message = breakpoint.getMarker().getAttribute(IMarker.MESSAGE);
|
||||||
|
if (message != null)
|
||||||
|
return message.toString();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// don't log if breakpoint has been deleted
|
||||||
|
IMarker marker = breakpoint.getMarker();
|
||||||
|
if (marker == null || !marker.exists()) {
|
||||||
|
return DebugCoreMessages.getString("CDebugUtils.breakpoint_deleted"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
CDebugCorePlugin.log(e);
|
||||||
|
return DebugCoreMessages.getString("CDebugUtils.exception_occurred"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (breakpoint instanceof ICFunctionBreakpoint) {
|
|
||||||
return getFunctionBreakpointText((ICFunctionBreakpoint)breakpoint, qualified);
|
|
||||||
}
|
|
||||||
if (breakpoint instanceof ICLineBreakpoint) {
|
|
||||||
return getLineBreakpointText((ICLineBreakpoint)breakpoint, qualified);
|
|
||||||
}
|
|
||||||
if (breakpoint instanceof ICWatchpoint) {
|
|
||||||
return getWatchpointText((ICWatchpoint)breakpoint, qualified);
|
|
||||||
}
|
|
||||||
// This allows to create a new breakpoint without implementing one of the interfaces above and still see a label
|
|
||||||
Object message = breakpoint.getMarker().getAttribute(IMarker.MESSAGE);
|
|
||||||
if (message != null)
|
|
||||||
return message.toString();
|
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,5 +32,7 @@ CDebugUtils.Program_file_does_not_exist=The program file specified in the launch
|
||||||
CDebugUtils.Program_file_not_specified=A program file was not specified in the launch configuration.
|
CDebugUtils.Program_file_not_specified=A program file was not specified in the launch configuration.
|
||||||
CDebugUtils.Project_NAME_does_not_exist=Project {0} does not exist. Please check that your launch configuration specifies a valid project in your workspace.
|
CDebugUtils.Project_NAME_does_not_exist=Project {0} does not exist. Please check that your launch configuration specifies a valid project in your workspace.
|
||||||
CDebugUtils.Project_NAME_is_closed=Project {0} is closed
|
CDebugUtils.Project_NAME_is_closed=Project {0} is closed
|
||||||
|
CDebugUtils.exception_occurred=An exception occurred. See log for details.
|
||||||
|
CDebugUtils.breakpoint_deleted=<deleted breakpoint>
|
||||||
|
|
||||||
CDIDebugModel.0=Unable to parser binary information from file
|
CDIDebugModel.0=Unable to parser binary information from file
|
||||||
|
|
|
@ -164,15 +164,18 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
||||||
}
|
}
|
||||||
if ( element instanceof ICBreakpoint ) {
|
if ( element instanceof ICBreakpoint ) {
|
||||||
ICBreakpoint b = (ICBreakpoint)element;
|
ICBreakpoint b = (ICBreakpoint)element;
|
||||||
|
IMarker marker = b.getMarker();
|
||||||
|
if (marker == null || !marker.exists())
|
||||||
|
return null;
|
||||||
// If the BP's marker is on an IFile, job done
|
// If the BP's marker is on an IFile, job done
|
||||||
IFile file = (IFile)b.getMarker().getResource().getAdapter(IFile.class);
|
IFile file = (IFile)marker.getResource().getAdapter(IFile.class);
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
try {
|
try {
|
||||||
// Not backed by an IFile, try its source handle (may be workspace / project based)
|
// Not backed by an IFile, try its source handle (may be workspace / project based)
|
||||||
String handle = b.getSourceHandle();
|
String handle = b.getSourceHandle();
|
||||||
if (handle != null && Path.ROOT.isValidPath(handle)) {
|
if (handle != null && Path.ROOT.isValidPath(handle)) {
|
||||||
Path path = new Path(handle);
|
Path path = new Path(handle);
|
||||||
IProject project = b.getMarker().getResource().getProject();
|
IProject project = marker.getResource().getProject();
|
||||||
// Select the most 'relevant' IFile for an external location
|
// Select the most 'relevant' IFile for an external location
|
||||||
file = ResourceLookup.selectFileForLocation(path, project);
|
file = ResourceLookup.selectFileForLocation(path, project);
|
||||||
if (file == null || !file.isAccessible()) {
|
if (file == null || !file.isAccessible()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue