mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-09 11:33:20 +02:00
Bug 396081 - Revert commit 5ee1a4a174
:
Duplicate target breakpoints created when setting a GDB console breakpoint with relative path. We keep the new API though. Change-Id: I0dd473fff033e9adbdbb5d79a51915e607043c66 Reviewed-on: https://git.eclipse.org/r/13528 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
b1052736a1
commit
1ae2226284
1 changed files with 27 additions and 129 deletions
|
@ -37,7 +37,6 @@ import org.eclipse.cdt.debug.core.model.ICTracepoint;
|
|||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
|
@ -743,115 +742,80 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
|||
}
|
||||
String type = (String)attributes.get(MIBreakpoints.BREAKPOINT_TYPE);
|
||||
if (MIBreakpoints.BREAKPOINT.equals(type)) {
|
||||
getTargetLineBreakpoint(
|
||||
context,
|
||||
rm.done(getTargetLineBreakpoint(
|
||||
map.values(),
|
||||
(String)attributes.get(MIBreakpoints.FILE_NAME),
|
||||
(Integer)attributes.get(MIBreakpoints.LINE_NUMBER),
|
||||
(String)attributes.get(MIBreakpoints.FUNCTION),
|
||||
(String)attributes.get(MIBreakpoints.ADDRESS),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY),
|
||||
rm);
|
||||
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
|
||||
}
|
||||
else if (MIBreakpoints.TRACEPOINT.equals(type)) {
|
||||
getTargetTracepoint(
|
||||
context,
|
||||
rm.done(getTargetTracepoint(
|
||||
map.values(),
|
||||
(String)attributes.get(MIBreakpoints.FILE_NAME),
|
||||
(Integer)attributes.get(MIBreakpoints.LINE_NUMBER),
|
||||
(String)attributes.get(MIBreakpoints.FUNCTION),
|
||||
(String)attributes.get(MIBreakpoints.ADDRESS),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY),
|
||||
rm);
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
|
||||
}
|
||||
else if (MIBreakpoints.WATCHPOINT.equals(type)) {
|
||||
getTargetWatchpoint(
|
||||
context,
|
||||
rm.done(getTargetWatchpoint(
|
||||
map.values(),
|
||||
(String)attributes.get(MIBreakpoints.EXPRESSION),
|
||||
(Boolean)attributes.get(MIBreakpoints.READ),
|
||||
(Boolean)attributes.get(MIBreakpoints.WRITE),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_HARDWARE),
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY),
|
||||
rm);
|
||||
(Boolean)attributes.get(MIBreakpointDMData.IS_TEMPORARY)));
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
private void getTargetLineBreakpoint(
|
||||
IBreakpointsTargetDMContext bpTargetDMC,
|
||||
private MIBreakpoint getTargetLineBreakpoint(
|
||||
Collection<MIBreakpoint> targetBreakpoints,
|
||||
String fileName,
|
||||
Integer lineNumber,
|
||||
String function,
|
||||
String address,
|
||||
Boolean isHardware,
|
||||
Boolean isTemporary,
|
||||
DataRequestMonitor<MIBreakpoint> drm) {
|
||||
List<MIBreakpoint> candidates = new ArrayList<MIBreakpoint>(targetBreakpoints.size());
|
||||
Boolean isTemporary) {
|
||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||
if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint()) {
|
||||
// Filter out target breakpoints with different file names and line numbers
|
||||
if (fileName == null
|
||||
|| (new File(fileName).getName().equals(new File(getFileName(miBpt)).getName())
|
||||
&& getLineNumber(miBpt) == lineNumber)) {
|
||||
candidates.add(miBpt);
|
||||
}
|
||||
}
|
||||
if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint()
|
||||
&& compareBreakpointAttributes(
|
||||
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary))
|
||||
return miBpt;
|
||||
}
|
||||
if (candidates.size() == 0) {
|
||||
drm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
findTargetLineBreakpoint(bpTargetDMC, candidates,
|
||||
fileName, lineNumber, function, address, isHardware, isTemporary, drm);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void getTargetTracepoint(
|
||||
IBreakpointsTargetDMContext bpTargetDMC,
|
||||
private MIBreakpoint getTargetTracepoint(
|
||||
Collection<MIBreakpoint> targetBreakpoints,
|
||||
String fileName,
|
||||
Integer lineNumber,
|
||||
String function,
|
||||
String address,
|
||||
Boolean isHardware,
|
||||
Boolean isTemporary,
|
||||
DataRequestMonitor<MIBreakpoint> rm) {
|
||||
List<MIBreakpoint> candidates = new ArrayList<MIBreakpoint>(targetBreakpoints.size());
|
||||
Boolean isTemporary) {
|
||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||
if (miBpt.isTracepoint()) {
|
||||
// Filter out target breakpoints with different file names and line numbers
|
||||
if (new File(fileName).getName().equals(new File(getFileName(miBpt)).getName())
|
||||
&& miBpt.getLine() == lineNumber) {
|
||||
candidates.add(miBpt);
|
||||
}
|
||||
}
|
||||
if (miBpt.isTracepoint()
|
||||
&& compareBreakpointAttributes(
|
||||
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary))
|
||||
return miBpt;
|
||||
}
|
||||
if (candidates.size() == 0) {
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
findTargetLineBreakpoint(bpTargetDMC, candidates,
|
||||
fileName, lineNumber, function, address, isHardware, isTemporary, rm);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void getTargetWatchpoint(
|
||||
IBreakpointsTargetDMContext bpTargetDMC,
|
||||
private MIBreakpoint getTargetWatchpoint(
|
||||
Collection<MIBreakpoint> targetBreakpoints,
|
||||
String expression,
|
||||
boolean readAccess,
|
||||
boolean writeAccess,
|
||||
Boolean isHardware,
|
||||
Boolean isTemporary,
|
||||
DataRequestMonitor<MIBreakpoint> rm) {
|
||||
Boolean isTemporary) {
|
||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||
if (!miBpt.isWatchpoint())
|
||||
continue;
|
||||
|
@ -865,92 +829,25 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
|||
continue;
|
||||
if (!compareBreakpointTypeAttributes(miBpt, isHardware, isTemporary))
|
||||
continue;
|
||||
rm.setData(miBpt);
|
||||
break;
|
||||
return miBpt;
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
|
||||
private void findTargetLineBreakpoint(
|
||||
final IBreakpointsTargetDMContext bpTargetDMC,
|
||||
final List<MIBreakpoint> candidates,
|
||||
final String fileName,
|
||||
final Integer lineNumber,
|
||||
final String function,
|
||||
final String address,
|
||||
final Boolean isHardware,
|
||||
final Boolean isTemporary,
|
||||
final DataRequestMonitor<MIBreakpoint> drm) {
|
||||
// We need to convert the debugger paths of the candidate target breakpoints
|
||||
// before comparing them with the platform breakpoint's file name.
|
||||
final List<MIBreakpoint> bpts = new ArrayList<MIBreakpoint>(candidates);
|
||||
|
||||
class FindBreakpointRM extends ImmediateDataRequestMonitor<MIBreakpoint> {
|
||||
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
if (bpts.isEmpty()) {
|
||||
drm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
final MIBreakpoint bpt = bpts.remove(0);
|
||||
final String debuggerPath = getFileName(bpt);
|
||||
getSource(
|
||||
bpTargetDMC,
|
||||
debuggerPath,
|
||||
new DataRequestMonitor<String>(getExecutor(), drm) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor( "fExecutor" )
|
||||
protected void handleCompleted() {
|
||||
// If an error occur performing source lookup
|
||||
// log it and use the debugger path.
|
||||
if (!isSuccess()) {
|
||||
GdbPlugin.log(getStatus());
|
||||
}
|
||||
if (compareBreakpointAttributes(
|
||||
bpt,
|
||||
isSuccess() ? getData() : debuggerPath,
|
||||
fileName,
|
||||
lineNumber,
|
||||
function,
|
||||
address,
|
||||
isHardware,
|
||||
isTemporary)) {
|
||||
// The target breakpoint is found, we're done.
|
||||
drm.setData(bpt);
|
||||
drm.done();
|
||||
}
|
||||
else {
|
||||
// Try the next candidate
|
||||
new FindBreakpointRM().done();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Start the search.
|
||||
new FindBreakpointRM().done();
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean compareBreakpointAttributes(
|
||||
MIBreakpoint miBpt,
|
||||
String miBptFileName,
|
||||
String fileName,
|
||||
Integer lineNumber,
|
||||
String function,
|
||||
String address,
|
||||
Boolean isHardware,
|
||||
Boolean isTemporary) {
|
||||
return compareBreakpointLocationAttributes(miBpt, miBptFileName, fileName, lineNumber, function, address)
|
||||
return compareBreakpointLocationAttributes(miBpt, fileName, lineNumber, function, address)
|
||||
&& compareBreakpointTypeAttributes(miBpt, isHardware, isTemporary);
|
||||
}
|
||||
|
||||
private boolean compareBreakpointLocationAttributes(
|
||||
MIBreakpoint miBpt,
|
||||
String miBptFileName,
|
||||
String fileName,
|
||||
Integer lineNumber,
|
||||
String function,
|
||||
|
@ -961,6 +858,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
|||
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString())))
|
||||
return false;
|
||||
if (isLineBreakpoint(miBpt)) {
|
||||
String miBptFileName = getFileName(miBpt);
|
||||
if (fileName == null || miBptFileName == null || !new File(fileName).equals(new File(miBptFileName)))
|
||||
return false;
|
||||
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt))
|
||||
|
|
Loading…
Add table
Reference in a new issue