mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Simple changes for Sonar warnings
Change-Id: I6f99d9fa808a52e3b6d925e695ff74424120c4ce
This commit is contained in:
parent
22fb739c9b
commit
20702b3045
1 changed files with 147 additions and 80 deletions
|
@ -203,17 +203,20 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
|
|
||||||
public void targetBreakpointCreated(final MIBreakpoint miBpt) {
|
public void targetBreakpointCreated(final MIBreakpoint miBpt) {
|
||||||
if (isCatchpoint(miBpt))
|
if (isCatchpoint(miBpt)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
ICommandControlService commandControl = getCommandControl();
|
ICommandControlService commandControl = getCommandControl();
|
||||||
MIBreakpoints breakpointsService = getBreakpointsService();
|
MIBreakpoints breakpointsService = getBreakpointsService();
|
||||||
final MIBreakpointsManager bm = getBreakpointsManager();
|
final MIBreakpointsManager bm = getBreakpointsManager();
|
||||||
if (commandControl == null || breakpointsService == null || bm == null)
|
if (commandControl == null || breakpointsService == null || bm == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final IBreakpointsTargetDMContext bpTargetDMC = getBreakpointsTargetContext(commandControl, miBpt);
|
final IBreakpointsTargetDMContext bpTargetDMC = getBreakpointsTargetContext(commandControl, miBpt);
|
||||||
if (bpTargetDMC == null)
|
if (bpTargetDMC == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Store the target breakpoint data
|
// Store the target breakpoint data
|
||||||
Map<Integer, MIBreakpointDMData> contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC);
|
Map<Integer, MIBreakpointDMData> contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC);
|
||||||
|
@ -241,8 +244,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
@ConfinedToDsfExecutor( "fExecutor" )
|
@ConfinedToDsfExecutor( "fExecutor" )
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
String fileName = getData();
|
String fileName = getData();
|
||||||
if (fileName == null)
|
if (fileName == null) {
|
||||||
fileName = getFileName(miBpt);
|
fileName = getFileName(miBpt);
|
||||||
|
}
|
||||||
// Try to find matching platform breakpoint
|
// Try to find matching platform breakpoint
|
||||||
ICBreakpoint plBpt = getPlatformBreakpoint(miBpt, fileName);
|
ICBreakpoint plBpt = getPlatformBreakpoint(miBpt, fileName);
|
||||||
String threadId = miBpt.getThreadId();
|
String threadId = miBpt.getThreadId();
|
||||||
|
@ -253,7 +257,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
plBpt = createPlatformBreakpoint(fileName, miBpt);
|
plBpt = createPlatformBreakpoint(fileName, miBpt);
|
||||||
// If the target breakpoint is thread specific, update thread filters
|
// If the target breakpoint is thread specific, update thread filters
|
||||||
if (isThreadSpecific) {
|
if (isThreadSpecific) {
|
||||||
setThreadSpecificBreakpoint(bpTargetDMC, plBpt, miBpt);
|
setThreadSpecificBreakpoint(plBpt, miBpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -266,7 +270,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
if (isBreakpointTargetTracked(bpTargetDMC)) {
|
if (isBreakpointTargetTracked(bpTargetDMC)) {
|
||||||
// If the target breakpoint is thread specific, update thread filters
|
// If the target breakpoint is thread specific, update thread filters
|
||||||
if (isThreadSpecific) {
|
if (isThreadSpecific) {
|
||||||
setThreadSpecificBreakpoint(bpTargetDMC, plBpt, miBpt);
|
setThreadSpecificBreakpoint(plBpt, miBpt);
|
||||||
}
|
}
|
||||||
bm.breakpointAdded(plBpt);
|
bm.breakpointAdded(plBpt);
|
||||||
}
|
}
|
||||||
|
@ -295,8 +299,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
public void targetBreakpointDeleted(final int id) {
|
public void targetBreakpointDeleted(final int id) {
|
||||||
MIBreakpoints breakpointsService = getBreakpointsService();
|
MIBreakpoints breakpointsService = getBreakpointsService();
|
||||||
final MIBreakpointsManager bm = getBreakpointsManager();
|
final MIBreakpointsManager bm = getBreakpointsManager();
|
||||||
if (breakpointsService == null || bm == null)
|
if (breakpointsService == null || bm == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
final IBreakpointsTargetDMContext bpTargetDMC = breakpointsService.getBreakpointTargetContext(id);
|
final IBreakpointsTargetDMContext bpTargetDMC = breakpointsService.getBreakpointTargetContext(id);
|
||||||
if (bpTargetDMC != null){
|
if (bpTargetDMC != null){
|
||||||
final MIBreakpointDMContext bpDMC =
|
final MIBreakpointDMContext bpDMC =
|
||||||
|
@ -307,11 +312,13 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor( "fExecutor" )
|
@ConfinedToDsfExecutor( "fExecutor" )
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
if (!(getData() instanceof MIBreakpointDMData))
|
if (!(getData() instanceof MIBreakpointDMData)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
MIBreakpointDMData data = (MIBreakpointDMData)getData();
|
MIBreakpointDMData data = (MIBreakpointDMData)getData();
|
||||||
if (MIBreakpoints.CATCHPOINT.equals(data.getBreakpointType()))
|
if (MIBreakpoints.CATCHPOINT.equals(data.getBreakpointType())) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IBreakpoint plBpt = bm.findPlatformBreakpoint(bpDMC);
|
IBreakpoint plBpt = bm.findPlatformBreakpoint(bpDMC);
|
||||||
if (plBpt instanceof ICBreakpoint) {
|
if (plBpt instanceof ICBreakpoint) {
|
||||||
|
@ -343,8 +350,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
|
List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
|
||||||
for (IExecutionDMContext c : execDMCs) {
|
for (IExecutionDMContext c : execDMCs) {
|
||||||
if (c instanceof IMIExecutionDMContext
|
if (c instanceof IMIExecutionDMContext
|
||||||
&& ((IMIExecutionDMContext)c).getThreadId() != threadId)
|
&& ((IMIExecutionDMContext)c).getThreadId() != threadId) {
|
||||||
list.add(c);
|
list.add(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()]));
|
bpExtension.setThreadFilters(list.toArray(new IExecutionDMContext[list.size()]));
|
||||||
|
@ -371,18 +379,21 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
|
|
||||||
public void targetBreakpointModified(final MIBreakpoint miBpt) {
|
public void targetBreakpointModified(final MIBreakpoint miBpt) {
|
||||||
if (isCatchpoint(miBpt))
|
if (isCatchpoint(miBpt)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
ICommandControlService commandControl = getCommandControl();
|
ICommandControlService commandControl = getCommandControl();
|
||||||
MIBreakpoints breakpointsService = getBreakpointsService();
|
MIBreakpoints breakpointsService = getBreakpointsService();
|
||||||
final MIBreakpointsManager bm = getBreakpointsManager();
|
final MIBreakpointsManager bm = getBreakpointsManager();
|
||||||
if (commandControl != null && breakpointsService != null && bm != null) {
|
if (commandControl != null && breakpointsService != null && bm != null) {
|
||||||
final IBreakpointsTargetDMContext bpTargetDMC = getBreakpointsTargetContext(commandControl, miBpt);
|
final IBreakpointsTargetDMContext bpTargetDMC = getBreakpointsTargetContext(commandControl, miBpt);
|
||||||
if (bpTargetDMC == null)
|
if (bpTargetDMC == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
final Map<Integer, MIBreakpointDMData> contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC);
|
final Map<Integer, MIBreakpointDMData> contextBreakpoints = breakpointsService.getBreakpointMap(bpTargetDMC);
|
||||||
if (contextBreakpoints == null)
|
if (contextBreakpoints == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
IBreakpoint b = bm.findPlatformBreakpoint(
|
IBreakpoint b = bm.findPlatformBreakpoint(
|
||||||
new MIBreakpointDMContext(breakpointsService, new IDMContext[] { bpTargetDMC }, miBpt.getNumber()));
|
new MIBreakpointDMContext(breakpointsService, new IDMContext[] { bpTargetDMC }, miBpt.getNumber()));
|
||||||
if (!(b instanceof ICBreakpoint)) {
|
if (!(b instanceof ICBreakpoint)) {
|
||||||
|
@ -420,10 +431,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
plBpt.setIgnoreCount(miBpt.getIgnoreCount());
|
plBpt.setIgnoreCount(miBpt.getIgnoreCount());
|
||||||
}
|
}
|
||||||
if (oldData.isPending() != miBpt.isPending()) {
|
if (oldData.isPending() != miBpt.isPending()) {
|
||||||
if (miBpt.isPending())
|
if (miBpt.isPending()) {
|
||||||
plBpt.decrementInstallCount();
|
plBpt.decrementInstallCount();
|
||||||
else
|
} else {
|
||||||
plBpt.incrementInstallCount();
|
plBpt.incrementInstallCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (plBpt instanceof ICTracepoint && miBpt.isTracepoint()) {
|
if (plBpt instanceof ICTracepoint && miBpt.isTracepoint()) {
|
||||||
ICTracepoint plTpt = (ICTracepoint)plBpt;
|
ICTracepoint plTpt = (ICTracepoint)plBpt;
|
||||||
|
@ -437,10 +449,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
String[] commands = miBpt.getCommands().split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
|
String[] commands = miBpt.getCommands().split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
|
||||||
for (ITracepointAction action : getActionsFromCommands(commands)) {
|
for (ITracepointAction action : getActionsFromCommands(commands)) {
|
||||||
if (first)
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
else
|
} else {
|
||||||
sb.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
|
sb.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER);
|
||||||
|
}
|
||||||
sb.append(action.getName());
|
sb.append(action.getName());
|
||||||
}
|
}
|
||||||
// Target breakpoints and platform breakpoints use the same format
|
// Target breakpoints and platform breakpoints use the same format
|
||||||
|
@ -475,7 +488,6 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setThreadSpecificBreakpoint(
|
private void setThreadSpecificBreakpoint(
|
||||||
IBreakpointsTargetDMContext bpTargetDMC,
|
|
||||||
final ICBreakpoint plBpt,
|
final ICBreakpoint plBpt,
|
||||||
MIBreakpoint miBpt) {
|
MIBreakpoint miBpt) {
|
||||||
|
|
||||||
|
@ -584,10 +596,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return CDIDebugModel.createAddressBreakpoint(
|
return CDIDebugModel.createAddressBreakpoint(
|
||||||
|
@ -611,10 +625,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createFunctionTracepoint(
|
return CDIDebugModel.createFunctionTracepoint(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -634,10 +650,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createLineTracepoint(
|
return CDIDebugModel.createLineTracepoint(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -666,10 +684,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return CDIDebugModel.createAddressTracepoint(
|
return CDIDebugModel.createAddressTracepoint(
|
||||||
|
@ -694,10 +714,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createFunctionBreakpoint(
|
return CDIDebugModel.createFunctionBreakpoint(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -717,10 +739,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createLineBreakpoint(
|
return CDIDebugModel.createLineBreakpoint(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -752,10 +776,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return CDIDebugModel.createAddressDynamicPrintf(
|
return CDIDebugModel.createAddressDynamicPrintf(
|
||||||
|
@ -783,10 +809,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createFunctionDynamicPrintf(
|
return CDIDebugModel.createFunctionDynamicPrintf(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -807,10 +835,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createLineDynamicPrintf(
|
return CDIDebugModel.createLineDynamicPrintf(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -828,10 +858,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (miBpt.isTemporary())
|
if (miBpt.isTemporary()) {
|
||||||
type |= ICBreakpointType.TEMPORARY;
|
type |= ICBreakpointType.TEMPORARY;
|
||||||
if (miBpt.isHardware())
|
}
|
||||||
|
if (miBpt.isHardware()) {
|
||||||
type |= ICBreakpointType.HARDWARE;
|
type |= ICBreakpointType.HARDWARE;
|
||||||
|
}
|
||||||
|
|
||||||
return CDIDebugModel.createWatchpoint(
|
return CDIDebugModel.createWatchpoint(
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -927,8 +959,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||||
if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint() && !miBpt.isDynamicPrintf()
|
if (!miBpt.isWatchpoint() && !isCatchpoint(miBpt) && !miBpt.isTracepoint() && !miBpt.isDynamicPrintf()
|
||||||
&& compareBreakpointAttributes(
|
&& compareBreakpointAttributes(
|
||||||
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary))
|
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
|
||||||
return miBpt;
|
return miBpt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -944,8 +977,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||||
if (miBpt.isTracepoint()
|
if (miBpt.isTracepoint()
|
||||||
&& compareBreakpointAttributes(
|
&& compareBreakpointAttributes(
|
||||||
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary))
|
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
|
||||||
return miBpt;
|
return miBpt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -961,8 +995,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||||
if (miBpt.isDynamicPrintf()
|
if (miBpt.isDynamicPrintf()
|
||||||
&& compareBreakpointAttributes(
|
&& compareBreakpointAttributes(
|
||||||
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary))
|
miBpt, fileName, lineNumber, function, address, isHardware, isTemporary)) {
|
||||||
return miBpt;
|
return miBpt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -975,18 +1010,24 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
Boolean isHardware,
|
Boolean isHardware,
|
||||||
Boolean isTemporary) {
|
Boolean isTemporary) {
|
||||||
for (MIBreakpoint miBpt : targetBreakpoints) {
|
for (MIBreakpoint miBpt : targetBreakpoints) {
|
||||||
if (!miBpt.isWatchpoint())
|
if (!miBpt.isWatchpoint()) {
|
||||||
continue;
|
continue;
|
||||||
if (expression == null || !expression.equals(miBpt.getExpression()))
|
}
|
||||||
|
if (expression == null || !expression.equals(miBpt.getExpression())) {
|
||||||
continue;
|
continue;
|
||||||
if (readAccess && writeAccess && !miBpt.isAccessWatchpoint())
|
}
|
||||||
|
if (readAccess && writeAccess && !miBpt.isAccessWatchpoint()) {
|
||||||
continue;
|
continue;
|
||||||
if (readAccess && !writeAccess && !miBpt.isReadWatchpoint())
|
}
|
||||||
|
if (readAccess && !writeAccess && !miBpt.isReadWatchpoint()) {
|
||||||
continue;
|
continue;
|
||||||
if (!readAccess && writeAccess && !miBpt.isWriteWatchpoint())
|
}
|
||||||
|
if (!readAccess && writeAccess && !miBpt.isWriteWatchpoint()) {
|
||||||
continue;
|
continue;
|
||||||
if (!compareBreakpointTypeAttributes(miBpt, isHardware, isTemporary))
|
}
|
||||||
|
if (!compareBreakpointTypeAttributes(miBpt, isHardware, isTemporary)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
return miBpt;
|
return miBpt;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -1010,28 +1051,34 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
Integer lineNumber,
|
Integer lineNumber,
|
||||||
String function,
|
String function,
|
||||||
String address) {
|
String address) {
|
||||||
if (isFunctionBreakpoint(miBpt) && (function == null || !function.equals(getFunctionName(miBpt))))
|
if (isFunctionBreakpoint(miBpt) && (function == null || !function.equals(getFunctionName(miBpt)))) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (isAddressBreakpoint(miBpt)
|
if (isAddressBreakpoint(miBpt)
|
||||||
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString())))
|
&& (address == null || !address.equals(getPlatformAddress(miBpt.getAddress()).toHexAddressString()))) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (isLineBreakpoint(miBpt)) {
|
if (isLineBreakpoint(miBpt)) {
|
||||||
String miBptFileName = getFileName(miBpt);
|
String miBptFileName = getFileName(miBpt);
|
||||||
if (fileName == null || miBptFileName == null || !new File(fileName).equals(new File(miBptFileName)))
|
if (fileName == null || miBptFileName == null || !new File(fileName).equals(new File(miBptFileName))) {
|
||||||
return false;
|
return false;
|
||||||
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt))
|
}
|
||||||
|
if (lineNumber == null || lineNumber.intValue() != getLineNumber(miBpt)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareBreakpointTypeAttributes(MIBreakpoint miBpt, Boolean isHardware, Boolean isTemporary) {
|
private boolean compareBreakpointTypeAttributes(MIBreakpoint miBpt, Boolean isHardware, Boolean isTemporary) {
|
||||||
if ((isHardware == null && miBpt.isHardware())
|
if ((isHardware == null && miBpt.isHardware())
|
||||||
|| (isHardware != null && isHardware.booleanValue() != miBpt.isHardware()))
|
|| (isHardware != null && isHardware.booleanValue() != miBpt.isHardware())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if ((isTemporary == null && miBpt.isTemporary())
|
if ((isTemporary == null && miBpt.isTemporary())
|
||||||
|| (isTemporary != null && isTemporary.booleanValue() != miBpt.isTemporary()))
|
|| (isTemporary != null && isTemporary.booleanValue() != miBpt.isTemporary())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,10 +1100,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (fileName == null || plBpt.getSourceHandle() == null
|
if (fileName == null || plBpt.getSourceHandle() == null
|
||||||
|| !new File(fileName).equals(new File(plBpt.getSourceHandle())))
|
|| !new File(fileName).equals(new File(plBpt.getSourceHandle()))) {
|
||||||
return false;
|
return false;
|
||||||
if (plBpt.getLineNumber() != getLineNumber(miBpt))
|
}
|
||||||
|
if (plBpt.getLineNumber() != getLineNumber(miBpt)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(CoreException e) {
|
catch(CoreException e) {
|
||||||
|
@ -1089,12 +1138,15 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
private boolean isPlatformWatchpoint(ICWatchpoint plBpt, MIBreakpoint miBpt) {
|
private boolean isPlatformWatchpoint(ICWatchpoint plBpt, MIBreakpoint miBpt) {
|
||||||
try {
|
try {
|
||||||
if (plBpt.getExpression() != null && plBpt.getExpression().equals(miBpt.getExpression()) ) {
|
if (plBpt.getExpression() != null && plBpt.getExpression().equals(miBpt.getExpression()) ) {
|
||||||
if (miBpt.isAccessWatchpoint())
|
if (miBpt.isAccessWatchpoint()) {
|
||||||
return plBpt.isWriteType() && plBpt.isReadType();
|
return plBpt.isWriteType() && plBpt.isReadType();
|
||||||
else if (miBpt.isReadWatchpoint())
|
}
|
||||||
|
else if (miBpt.isReadWatchpoint()) {
|
||||||
return !plBpt.isWriteType() && plBpt.isReadType();
|
return !plBpt.isWriteType() && plBpt.isReadType();
|
||||||
else if (miBpt.isWriteWatchpoint())
|
}
|
||||||
|
else if (miBpt.isWriteWatchpoint()) {
|
||||||
return plBpt.isWriteType() && !plBpt.isReadType();
|
return plBpt.isWriteType() && !plBpt.isReadType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(CoreException e) {
|
catch(CoreException e) {
|
||||||
|
@ -1113,8 +1165,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
|
|
||||||
public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, int bpId, boolean remove) {
|
public boolean isTargetBreakpointDeleted(IBreakpointsTargetDMContext context, int bpId, boolean remove) {
|
||||||
Set<Integer> set = fDeletedTargetBreakpoints.get(context);
|
Set<Integer> set = fDeletedTargetBreakpoints.get(context);
|
||||||
if (set != null )
|
if (set != null) {
|
||||||
return (remove) ? set.remove(Integer.valueOf(bpId)) : set.contains(Integer.valueOf(bpId));
|
return (remove) ? set.remove(Integer.valueOf(bpId)) : set.contains(Integer.valueOf(bpId));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1135,10 +1188,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (ITracepointAction action :tam.getActions()) {
|
for (ITracepointAction action :tam.getActions()) {
|
||||||
if (command.equals(action.getSummary())) {
|
if (command.equals(action.getSummary())) {
|
||||||
if (whileStepping == null || subActions == null)
|
if (whileStepping == null || subActions == null) {
|
||||||
list.add(action);
|
list.add(action);
|
||||||
else
|
} else {
|
||||||
subActions.add(action);
|
subActions.add(action);
|
||||||
|
}
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1146,25 +1200,28 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// Create a new action if an action for this command doesn't exists
|
// Create a new action if an action for this command doesn't exists
|
||||||
ITracepointAction action = null;
|
ITracepointAction action = null;
|
||||||
if (command.startsWith(TC_COLLECT))
|
if (command.startsWith(TC_COLLECT)) {
|
||||||
action = createCollectAction(command.substring(TC_COLLECT.length()));
|
action = createCollectAction(command.substring(TC_COLLECT.length()));
|
||||||
else if (command.startsWith(TC_TEVAL))
|
} else if (command.startsWith(TC_TEVAL)) {
|
||||||
action = createEvaluateAction(command.substring(TC_TEVAL.length()));
|
action = createEvaluateAction(command.substring(TC_TEVAL.length()));
|
||||||
else if (command.startsWith(TC_WHILE_STEPPING)) {
|
} else if (command.startsWith(TC_WHILE_STEPPING)) {
|
||||||
whileStepping = createWhileSteppingAction(command.substring(TC_WHILE_STEPPING.length()));
|
whileStepping = createWhileSteppingAction(command.substring(TC_WHILE_STEPPING.length()));
|
||||||
if (whileStepping != null)
|
if (whileStepping != null) {
|
||||||
subActions = new ArrayList<ITracepointAction>();
|
subActions = new ArrayList<ITracepointAction>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (command.equals(TC_END)) {
|
else if (command.equals(TC_END)) {
|
||||||
if (whileStepping == null || subActions == null)
|
if (whileStepping == null || subActions == null) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (ITracepointAction a : subActions) {
|
for (ITracepointAction a : subActions) {
|
||||||
if (first)
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
else
|
} else {
|
||||||
sb.append(',');
|
sb.append(',');
|
||||||
|
}
|
||||||
sb.append(a.getName());
|
sb.append(a.getName());
|
||||||
}
|
}
|
||||||
whileStepping.setSubActionsNames(sb.toString());
|
whileStepping.setSubActionsNames(sb.toString());
|
||||||
|
@ -1183,8 +1240,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
subActions = null;
|
subActions = null;
|
||||||
}
|
}
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
if (!found)
|
if (!found) {
|
||||||
TracepointActionManager.getInstance().addAction(action);
|
TracepointActionManager.getInstance().addAction(action);
|
||||||
|
}
|
||||||
if (whileStepping == null || subActions == null) {
|
if (whileStepping == null || subActions == null) {
|
||||||
list.add(action);
|
list.add(action);
|
||||||
}
|
}
|
||||||
|
@ -1265,8 +1323,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
else if (getData() instanceof ITranslationUnit) {
|
else if (getData() instanceof ITranslationUnit) {
|
||||||
IPath location = ((ITranslationUnit)getData()).getLocation();
|
IPath location = ((ITranslationUnit)getData()).getLocation();
|
||||||
if (location != null)
|
if (location != null) {
|
||||||
fileName = location.toOSString();
|
fileName = location.toOSString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (getData() instanceof LocalFileStorage) {
|
else if (getData() instanceof LocalFileStorage) {
|
||||||
fileName = ((LocalFileStorage)getData()).getFile().getAbsolutePath();
|
fileName = ((LocalFileStorage)getData()).getFile().getAbsolutePath();
|
||||||
|
@ -1318,8 +1377,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
private String getFileName(MIBreakpoint miBpt) {
|
private String getFileName(MIBreakpoint miBpt) {
|
||||||
String fileName = (miBpt.getFullName() != null && !miBpt.getFullName().isEmpty()) ?
|
String fileName = (miBpt.getFullName() != null && !miBpt.getFullName().isEmpty()) ?
|
||||||
miBpt.getFullName() : miBpt.getFile();
|
miBpt.getFullName() : miBpt.getFile();
|
||||||
if (fileName != null && !fileName.isEmpty())
|
if (fileName != null && !fileName.isEmpty()) {
|
||||||
return fileName;
|
return fileName;
|
||||||
|
}
|
||||||
// When a breakpoint is set from the console on an invalid file both
|
// When a breakpoint is set from the console on an invalid file both
|
||||||
// 'file' and 'fullname' attributes are not available, we need to parse
|
// 'file' and 'fullname' attributes are not available, we need to parse
|
||||||
// the 'original-location' attribute to retrieve the file name.
|
// the 'original-location' attribute to retrieve the file name.
|
||||||
|
@ -1329,17 +1389,19 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (origLocation.startsWith("*")) //$NON-NLS-1$
|
if (origLocation.startsWith("*")) { //$NON-NLS-1$
|
||||||
// Address breakpoint
|
// Address breakpoint
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
int index = origLocation.lastIndexOf(':');
|
int index = origLocation.lastIndexOf(':');
|
||||||
return (index > 0) ? origLocation.substring(0, index) : ""; //$NON-NLS-1$
|
return (index > 0) ? origLocation.substring(0, index) : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLineNumber(MIBreakpoint miBpt) {
|
private int getLineNumber(MIBreakpoint miBpt) {
|
||||||
int lineNumber = miBpt.getLine();
|
int lineNumber = miBpt.getLine();
|
||||||
if (lineNumber != -1)
|
if (lineNumber != -1) {
|
||||||
return lineNumber;
|
return lineNumber;
|
||||||
|
}
|
||||||
// When a breakpoint is set from the console on an invalid file
|
// When a breakpoint is set from the console on an invalid file
|
||||||
// the 'line' attributes is not available, we need to parse
|
// the 'line' attributes is not available, we need to parse
|
||||||
// the 'original-location' attribute to retrieve the line number.
|
// the 'original-location' attribute to retrieve the line number.
|
||||||
|
@ -1349,9 +1411,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (origLocation.startsWith("*")) //$NON-NLS-1$
|
if (origLocation.startsWith("*")) { //$NON-NLS-1$
|
||||||
// Address breakpoint
|
// Address breakpoint
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
int index = origLocation.lastIndexOf(':');
|
int index = origLocation.lastIndexOf(':');
|
||||||
if (index > 0 && origLocation.length() > index + 1) {
|
if (index > 0 && origLocation.length() > index + 1) {
|
||||||
try {
|
try {
|
||||||
|
@ -1376,9 +1439,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
|
|
||||||
private IResource getResource(String fileName) {
|
private IResource getResource(String fileName) {
|
||||||
IResource resource = null;
|
IResource resource = null;
|
||||||
if (fileName == null || fileName.isEmpty())
|
if (fileName == null || fileName.isEmpty()) {
|
||||||
resource = ResourcesPlugin.getWorkspace().getRoot();
|
resource = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
else {
|
} else {
|
||||||
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(
|
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(
|
||||||
new File(fileName).toURI());
|
new File(fileName).toURI());
|
||||||
if (files.length > 0) {
|
if (files.length > 0) {
|
||||||
|
@ -1399,14 +1462,17 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
// For GDB >= 7.4, GDB is the breakpoint target and will not be removed.
|
// For GDB >= 7.4, GDB is the breakpoint target and will not be removed.
|
||||||
IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext)e.getDMContext();
|
IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext)e.getDMContext();
|
||||||
Map<Integer, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
|
Map<Integer, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
|
||||||
if (createdBreakpoints != null)
|
if (createdBreakpoints != null) {
|
||||||
createdBreakpoints.clear();
|
createdBreakpoints.clear();
|
||||||
|
}
|
||||||
Map<Integer, MIBreakpoint> modifications = fPendingModifications.remove(bpTargetDMContext);
|
Map<Integer, MIBreakpoint> modifications = fPendingModifications.remove(bpTargetDMContext);
|
||||||
if (modifications != null)
|
if (modifications != null) {
|
||||||
modifications.clear();
|
modifications.clear();
|
||||||
|
}
|
||||||
Set<Integer> deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext);
|
Set<Integer> deletedBreakpoints = fDeletedTargetBreakpoints.remove(bpTargetDMContext);
|
||||||
if (deletedBreakpoints != null)
|
if (deletedBreakpoints != null) {
|
||||||
deletedBreakpoints.clear();
|
deletedBreakpoints.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1416,9 +1482,10 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invalid 'original-location' attribute")); //$NON-NLS-1$
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (origLocation.startsWith("*")) //$NON-NLS-1$
|
if (origLocation.startsWith("*")) { //$NON-NLS-1$
|
||||||
// Address breakpoint
|
// Address breakpoint
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
int index = origLocation.lastIndexOf(':');
|
int index = origLocation.lastIndexOf(':');
|
||||||
String function = (index >= 0) ? origLocation.substring(index + 1) : origLocation;
|
String function = (index >= 0) ? origLocation.substring(index + 1) : origLocation;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue