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,6 +321,7 @@ public class CDebugUtils {
|
|||
}
|
||||
|
||||
public static String getBreakpointText(IBreakpoint breakpoint, boolean qualified) throws CoreException {
|
||||
try {
|
||||
if (breakpoint instanceof ICAddressBreakpoint) {
|
||||
return getAddressBreakpointText((ICAddressBreakpoint)breakpoint, qualified);
|
||||
}
|
||||
|
@ -337,6 +338,15 @@ public class CDebugUtils {
|
|||
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$
|
||||
}
|
||||
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.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.exception_occurred=An exception occurred. See log for details.
|
||||
CDebugUtils.breakpoint_deleted=<deleted breakpoint>
|
||||
|
||||
CDIDebugModel.0=Unable to parser binary information from file
|
||||
|
|
|
@ -164,15 +164,18 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
|||
}
|
||||
if ( element instanceof ICBreakpoint ) {
|
||||
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
|
||||
IFile file = (IFile)b.getMarker().getResource().getAdapter(IFile.class);
|
||||
IFile file = (IFile)marker.getResource().getAdapter(IFile.class);
|
||||
if (file == null) {
|
||||
try {
|
||||
// Not backed by an IFile, try its source handle (may be workspace / project based)
|
||||
String handle = b.getSourceHandle();
|
||||
if (handle != null && Path.ROOT.isValidPath(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
|
||||
file = ResourceLookup.selectFileForLocation(path, project);
|
||||
if (file == null || !file.isAccessible()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue