I have a situation in which a breakpoint cannot be put on certain address on hardware (i.e. hardware breakpoint) and I wish to put error markers on such locations as soon as a debug session is launched.
If not this, then I wish that as soon as user attempts to put a breakpoint on an address in disassembly view, then based on error(...) returned from backend gdb (integrated using CDT-DSF-GDB framework) should be marked using error marker in disassembly windows, like it is done for line breakpoints in source editor. But it is not happening.
When I debug this, I found a bug in CDT code. It is about function addBreakpointProblemMarker in MIBreakpointsManager class.
The issue is that the address breakpoint user puts in disassembly window is instance of CAddressBreakpoint which in turn is instance of ICLineBreakpoint so the if condition:
if (breakpoint instanceof ICLineBreakpoint)) {...}
becomes true for address breakpoint as well.
But the code inside the if condition will not create a correct error marker in disassembly window because it uses line number for position. I tried using address from the breakpoint object for position attribute but that did not help either.
Can you please guide on HOW TO CREATE ERROR MARKER IN DISASSEMBLY WINDOW ?
Code I tried just above the above mentioned if condition is as following:
if (breakpoint instanceof ICAddressBreakpoint) {
IMarker marker = fBreakpointMarkerProblems.remove(breakpoint);
if (marker != null) {
try {
marker.delete();
} catch (CoreException e) { }
}
CAddressBreakpoint addressBreakpoint = (CAddressBreakpoint) breakpoint;
try {
IMarker breakpointMarker = addressBreakpoint.getMarker();
breakpointMarker.setAttribute(IMarker.MESSAGE, description);
breakpointMarker.setAttribute(IMarker.SEVERITY, severity);
addressBreakpoint.setMarker(breakpointMarker);
addressBreakpoint.setEnabled(false);
} catch (CoreException e) { }
} else if (breakpoint instanceof ICLineBreakpoint)) {...}
This does not add a new error marker BUT edits the message in the breakpoint marker itself.
Please guide!
[Updated on: Tue, 04 May 2021 08:31] by Moderator