mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
2004-10-15 Alain Magloire
The way we do breakpoints is changing. gdb does not have -break-thread-id command that would allow to change if a breakpoint is associated with a particular thread(the same way as in -break-condition, and -break-after). So to do thread breakpoint we associate 1 Eclipse breakpoint with n GDB breakpoints: 1:n * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java
This commit is contained in:
parent
109cd6a300
commit
262d89c54a
9 changed files with 414 additions and 250 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
2004-10-15 Alain Magloire
|
||||||
|
|
||||||
|
The way we do breakpoints is changing. gdb does not have
|
||||||
|
-break-thread-id command that would allow to change if a breakpoint
|
||||||
|
is associated with a particular thread(the same way as in
|
||||||
|
-break-condition, and -break-after). So to do thread breakpoint
|
||||||
|
we associate 1 Eclipse breakpoint with n GDB breakpoints:
|
||||||
|
1:n
|
||||||
|
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
|
||||||
|
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java
|
||||||
|
|
||||||
2004-10-04 Alain Magloire
|
2004-10-04 Alain Magloire
|
||||||
|
|
||||||
IllegalMonitorException fix.
|
IllegalMonitorException fix.
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -27,14 +28,13 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.MIFormat;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Exceptionpoint;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Exceptionpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Watchpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakAfter;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakCondition;
|
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakDelete;
|
import org.eclipse.cdt.debug.mi.core.command.MIBreakDelete;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakDisable;
|
import org.eclipse.cdt.debug.mi.core.command.MIBreakDisable;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable;
|
import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable;
|
||||||
|
@ -78,7 +78,7 @@ public class BreakpointManager extends Manager {
|
||||||
return bList;
|
return bList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIBreakpoint[] getMIBreakpoints(MISession miSession) throws CDIException {
|
MIBreakpoint[] getAllMIBreakpoints(MISession miSession) throws CDIException {
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
MIBreakList breakpointList = factory.createMIBreakList();
|
MIBreakList breakpointList = factory.createMIBreakList();
|
||||||
try {
|
try {
|
||||||
|
@ -93,16 +93,16 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasBreakpointChanged(Breakpoint point, MIBreakpoint miBreakpoint) {
|
boolean hasBreakpointChanged(MIBreakpoint miBreak, MIBreakpoint miBreakpoint) {
|
||||||
MIBreakpoint miBreak = point.getMIBreakpoint();
|
|
||||||
return miBreak.isEnabled() != miBreakpoint.isEnabled() ||
|
return miBreak.isEnabled() != miBreakpoint.isEnabled() ||
|
||||||
!miBreak.getCondition().equals(miBreakpoint.getCondition()) ||
|
!miBreak.getCondition().equals(miBreakpoint.getCondition()) ||
|
||||||
miBreak.getIgnoreCount() != miBreakpoint.getIgnoreCount();
|
miBreak.getIgnoreCount() != miBreakpoint.getIgnoreCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Watchpoint getWatchpoint(MISession miSession, int number) {
|
public Watchpoint getWatchpoint(MISession miSession, int number) {
|
||||||
return (Watchpoint)getBreakpoint(miSession, number);
|
return (Watchpoint)getBreakpoint(miSession, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Breakpoint getBreakpoint(MISession miSession, int number) {
|
public Breakpoint getBreakpoint(MISession miSession, int number) {
|
||||||
Session session = (Session)getSession();
|
Session session = (Session)getSession();
|
||||||
Target target = session.getTarget(miSession);
|
Target target = session.getTarget(miSession);
|
||||||
|
@ -111,14 +111,17 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Breakpoint getBreakpoint(Target target, int number) {
|
public Breakpoint getBreakpoint(Target target, int number) {
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
if (bList != null) {
|
if (bList != null) {
|
||||||
Breakpoint[] bkpts = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
Breakpoint[] bkpts = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
||||||
for (int i = 0; i < bkpts.length; i++) {
|
for (int i = 0; i < bkpts.length; i++) {
|
||||||
MIBreakpoint miBreak = bkpts[i].getMIBreakpoint();
|
MIBreakpoint[] miBreakpoints = bkpts[i].getMIBreakpoints();
|
||||||
if (miBreak.getNumber() == number) {
|
for (int j = 0; j < miBreakpoints.length; j++) {
|
||||||
return bkpts[i];
|
if (miBreakpoints[j].getNumber() == number) {
|
||||||
|
return bkpts[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,35 +154,58 @@ public class BreakpointManager extends Manager {
|
||||||
deleteBreakpoint(target, no);
|
deleteBreakpoint(target, no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void deleteBreakpoint (Target target, int no) {
|
|
||||||
|
/**
|
||||||
|
* Use in the event classes, the breakpoint is not remove from the list
|
||||||
|
* It is only done in DestroyedEvent class. Since we need to keep the breakpoint
|
||||||
|
* type around.
|
||||||
|
* @param target
|
||||||
|
* @param no
|
||||||
|
*/
|
||||||
|
void deleteBreakpoint (Target target, int no) {
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
if (bList != null) {
|
if (bList != null) {
|
||||||
Breakpoint[] points = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
Breakpoint[] points = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
||||||
for (int i = 0; i < points.length; i++) {
|
for (int i = 0; i < points.length; i++) {
|
||||||
if (points[i].getMIBreakpoint().getNumber() == no) {
|
MIBreakpoint[] miBreakpoints = points[i].getMIBreakpoints();
|
||||||
bList.remove(points[i]);
|
for (int j = 0; j < miBreakpoints.length; j++) {
|
||||||
break;
|
if (miBreakpoints[j].getNumber() == no) {
|
||||||
|
bList.remove(points[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call through the Breakpoint class Breakpoint.setEnabled(boolean)
|
||||||
|
*
|
||||||
|
* @param breakpoint
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
public void enableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
public void enableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
||||||
Target target = (Target)breakpoint.getTarget();
|
Target target = (Target)breakpoint.getTarget();
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
if (bList == null) {
|
if (bList == null) {
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
int number = 0;
|
if (!bList.contains(breakpoint)) {
|
||||||
if (bList.contains(breakpoint)) {
|
|
||||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
|
||||||
} else {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
MIBreakpoint[] miBreakpoints = ((Breakpoint)breakpoint).getMIBreakpoints();
|
||||||
|
if (miBreakpoints == null || miBreakpoints.length == 0) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] numbers = new int[miBreakpoints.length];
|
||||||
|
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||||
|
numbers[i] = miBreakpoints[i].getNumber();
|
||||||
|
}
|
||||||
boolean state = suspendInferior(target);
|
boolean state = suspendInferior(target);
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
MIBreakEnable breakEnable = factory.createMIBreakEnable(new int[] { number });
|
MIBreakEnable breakEnable = factory.createMIBreakEnable(numbers);
|
||||||
try {
|
try {
|
||||||
miSession.postCommand(breakEnable);
|
miSession.postCommand(breakEnable);
|
||||||
MIInfo info = breakEnable.getMIInfo();
|
MIInfo info = breakEnable.getMIInfo();
|
||||||
|
@ -192,30 +218,43 @@ public class BreakpointManager extends Manager {
|
||||||
// Resume the program and enable events.
|
// Resume the program and enable events.
|
||||||
resumeInferior(target, state);
|
resumeInferior(target, state);
|
||||||
}
|
}
|
||||||
((Breakpoint) breakpoint).getMIBreakpoint().setEnabled(true);
|
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||||
|
miBreakpoints[i].setEnabled(true);
|
||||||
|
}
|
||||||
// Fire a changed Event.
|
// Fire a changed Event.
|
||||||
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, ((Breakpoint)breakpoint).getMIBreakpoint().getNumber()));
|
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call through the Breakpoint class. Breakpoint.disable
|
||||||
|
*
|
||||||
|
* @param breakpoint
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
public void disableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
public void disableBreakpoint(ICDIBreakpoint breakpoint) throws CDIException {
|
||||||
Target target = (Target)breakpoint.getTarget();
|
Target target = (Target)breakpoint.getTarget();
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
if (bList == null) {
|
if (bList == null) {
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
int number = 0;
|
if (!bList.contains(breakpoint)) {
|
||||||
if (bList.contains(breakpoint)) {
|
|
||||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
|
||||||
} else {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MIBreakpoint[] miBreakpoints = ((Breakpoint)breakpoint).getMIBreakpoints();
|
||||||
|
if (miBreakpoints == null || miBreakpoints.length == 0) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
int[] numbers = new int[miBreakpoints.length];
|
||||||
|
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||||
|
numbers[i] = miBreakpoints[i].getNumber();
|
||||||
|
}
|
||||||
|
|
||||||
Session session = (Session)target.getSession();
|
Session session = (Session)target.getSession();
|
||||||
boolean state = suspendInferior(target);
|
boolean state = suspendInferior(target);
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
MIBreakDisable breakDisable =
|
MIBreakDisable breakDisable = factory.createMIBreakDisable(numbers);
|
||||||
factory.createMIBreakDisable(new int[] { number });
|
|
||||||
try {
|
try {
|
||||||
miSession.postCommand(breakDisable);
|
miSession.postCommand(breakDisable);
|
||||||
MIInfo info = breakDisable.getMIInfo();
|
MIInfo info = breakDisable.getMIInfo();
|
||||||
|
@ -227,60 +266,54 @@ public class BreakpointManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
resumeInferior(target, state);
|
resumeInferior(target, state);
|
||||||
}
|
}
|
||||||
((Breakpoint) breakpoint).getMIBreakpoint().setEnabled(false);
|
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||||
|
miBreakpoints[i].setEnabled(false);
|
||||||
|
}
|
||||||
// Fire a changed Event.
|
// Fire a changed Event.
|
||||||
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, ((Breakpoint)breakpoint).getMIBreakpoint().getNumber()));
|
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, numbers[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCondition(ICDIBreakpoint breakpoint, ICDICondition condition) throws CDIException {
|
/**
|
||||||
|
* Use by the Breakpoint class, Breakpoint.setCondition(Condition cond)
|
||||||
|
* In this case we will not try to change the condition with -break-condition.
|
||||||
|
* Since condition may contains new thread-id it is simpler to remove the breakpoints
|
||||||
|
* and make a new breakpoints with the new conditions.
|
||||||
|
* @param breakpoint
|
||||||
|
* @param newCondition
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
|
public void setCondition(ICDIBreakpoint breakpoint, ICDICondition newCondition) throws CDIException {
|
||||||
Target target = (Target)breakpoint.getTarget();
|
Target target = (Target)breakpoint.getTarget();
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
if (bList == null) {
|
if (bList == null) {
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
int number = 0;
|
if (!bList.contains(breakpoint)) {
|
||||||
if (bList.contains(breakpoint)) {
|
|
||||||
number = ((Breakpoint) breakpoint).getMIBreakpoint().getNumber();
|
|
||||||
} else {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
Session session = (Session)target.getSession();
|
Breakpoint bpt = (Breakpoint)breakpoint;
|
||||||
boolean state = suspendInferior(target);
|
MIBreakpoint[] miBreakpoints = bpt.getMIBreakpoints();
|
||||||
MISession miSession = target.getMISession();
|
deleteMIBreakpoints(target, miBreakpoints);
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
ICDICondition oldCondition = bpt.getCondition();
|
||||||
|
boolean success = false;
|
||||||
// reset the values to sane states.
|
|
||||||
String exprCond = condition.getExpression();
|
|
||||||
if (exprCond == null) {
|
|
||||||
exprCond = ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
int ignoreCount = condition.getIgnoreCount();
|
|
||||||
if (ignoreCount < 0) {
|
|
||||||
ignoreCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MIBreakCondition breakCondition = factory.createMIBreakCondition(number, exprCond);
|
bpt.setCondition0(newCondition);
|
||||||
miSession.postCommand(breakCondition);
|
setLocationBreakpoint(bpt);
|
||||||
MIInfo info = breakCondition.getMIInfo();
|
success = true;
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
MIBreakAfter breakAfter =
|
|
||||||
factory.createMIBreakAfter(number, ignoreCount);
|
|
||||||
miSession.postCommand(breakAfter);
|
|
||||||
info = breakAfter.getMIInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
} finally {
|
} finally {
|
||||||
resumeInferior(target, state);
|
if (!success) {
|
||||||
|
bpt.setCondition0(oldCondition);
|
||||||
|
setLocationBreakpoint(bpt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire a changed Event.
|
// Fire a changed Event.
|
||||||
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, ((Breakpoint)breakpoint).getMIBreakpoint().getNumber()));
|
miBreakpoints = bpt.getMIBreakpoints();
|
||||||
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
|
MISession miSession = target.getMISession();
|
||||||
|
miSession.fireEvent(new MIBreakpointChangedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,24 +330,55 @@ public class BreakpointManager extends Manager {
|
||||||
*/
|
*/
|
||||||
public void update(Target target) throws CDIException {
|
public void update(Target target) throws CDIException {
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
MIBreakpoint[] newMIBreakpoints = getMIBreakpoints(miSession);
|
MIBreakpoint[] allMIBreakpoints = getAllMIBreakpoints(miSession);
|
||||||
List bList = getBreakpointsList(target);
|
List bList = getBreakpointsList(target);
|
||||||
List eventList = new ArrayList(newMIBreakpoints.length);
|
List eventList = new ArrayList(allMIBreakpoints.length);
|
||||||
for (int i = 0; i < newMIBreakpoints.length; i++) {
|
for (int i = 0; i < allMIBreakpoints.length; i++) {
|
||||||
int no = newMIBreakpoints[i].getNumber();
|
int no = allMIBreakpoints[i].getNumber();
|
||||||
Breakpoint bp = getBreakpoint(target, no);
|
Breakpoint bp = getBreakpoint(target, no);
|
||||||
if (bp != null) {
|
if (bp != null) {
|
||||||
if (hasBreakpointChanged(bp, newMIBreakpoints[i])) {
|
MIBreakpoint[] miBps = bp.getMIBreakpoints();
|
||||||
// Fire ChangedEvent
|
for (int j = 0; j < miBps.length; j++) {
|
||||||
bp.setMIBreakpoint(newMIBreakpoints[i]);
|
if (miBps[j].getNumber() == no) {
|
||||||
eventList.add(new MIBreakpointChangedEvent(miSession, no));
|
if (hasBreakpointChanged(miBps[j], allMIBreakpoints[i])) {
|
||||||
|
miBps[j] = allMIBreakpoints[i];
|
||||||
|
bp.setEnabled0(allMIBreakpoints[i].isEnabled());
|
||||||
|
// FIXME: do the conditions also.
|
||||||
|
// Fire ChangedEvent
|
||||||
|
eventList.add(new MIBreakpointChangedEvent(miSession, no));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// add the new breakpoint and fire CreatedEvent
|
// add the new breakpoint and fire CreatedEvent
|
||||||
if (newMIBreakpoints[i].isWatchpoint()) {
|
int type = ICDIBreakpoint.REGULAR;
|
||||||
bList.add(new Watchpoint(target, newMIBreakpoints[i]));
|
if (allMIBreakpoints[i].isHardware()) {
|
||||||
|
type = ICDIBreakpoint.HARDWARE;
|
||||||
|
} else if (allMIBreakpoints[i].isTemporary()) {
|
||||||
|
type = ICDIBreakpoint.TEMPORARY;
|
||||||
|
}
|
||||||
|
Condition condition = new Condition(allMIBreakpoints[i].getIgnoreCount(),
|
||||||
|
allMIBreakpoints[i].getCondition(), new String[] {allMIBreakpoints[i].getThreadId()});
|
||||||
|
|
||||||
|
if (allMIBreakpoints[i].isWatchpoint()) {
|
||||||
|
int watchType = 0;
|
||||||
|
if (allMIBreakpoints[i].isAccessWatchpoint() || allMIBreakpoints[i].isReadWatchpoint()) {
|
||||||
|
watchType &= ICDIWatchpoint.READ;
|
||||||
|
}
|
||||||
|
if (allMIBreakpoints[i].isAccessWatchpoint() || allMIBreakpoints[i].isWriteWatchpoint()) {
|
||||||
|
watchType &= ICDIWatchpoint.WRITE;
|
||||||
|
}
|
||||||
|
Watchpoint wpoint = new Watchpoint(target, allMIBreakpoints[i].getWhat(), type, watchType, condition);
|
||||||
|
bList.add(wpoint);
|
||||||
} else {
|
} else {
|
||||||
bList.add(new Breakpoint(target, newMIBreakpoints[i]));
|
Location location = new Location (allMIBreakpoints[i].getFile(),
|
||||||
|
allMIBreakpoints[i].getFunction(),
|
||||||
|
allMIBreakpoints[i].getLine(),
|
||||||
|
MIFormat.getBigInteger(allMIBreakpoints[i].getAddress()));
|
||||||
|
|
||||||
|
Breakpoint newBreakpoint = new Breakpoint(target, type, location, condition);
|
||||||
|
newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
|
||||||
|
bList.add(newBreakpoint);
|
||||||
}
|
}
|
||||||
eventList.add(new MIBreakpointCreatedEvent(miSession, no));
|
eventList.add(new MIBreakpointCreatedEvent(miSession, no));
|
||||||
}
|
}
|
||||||
|
@ -323,16 +387,19 @@ public class BreakpointManager extends Manager {
|
||||||
Breakpoint[] oldBreakpoints = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
Breakpoint[] oldBreakpoints = (Breakpoint[]) bList.toArray(new Breakpoint[0]);
|
||||||
for (int i = 0; i < oldBreakpoints.length; i++) {
|
for (int i = 0; i < oldBreakpoints.length; i++) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
int no = oldBreakpoints[i].getMIBreakpoint().getNumber();
|
MIBreakpoint[] miBreakpoints = oldBreakpoints[i].getMIBreakpoints();
|
||||||
for (int j = 0; j < newMIBreakpoints.length; j++) {
|
for (int j = 0; j < miBreakpoints.length; j++) {
|
||||||
if (no == newMIBreakpoints[j].getNumber()) {
|
int no = miBreakpoints[j].getNumber();
|
||||||
found = true;
|
for (int k = 0; k < allMIBreakpoints.length; k++) {
|
||||||
break;
|
if (no == allMIBreakpoints[k].getNumber()) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
// Fire destroyed Events.
|
||||||
|
eventList.add(new MIBreakpointDeletedEvent(miSession, no));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
// Fire destroyed Events.
|
|
||||||
eventList.add(new MIBreakpointDeletedEvent(miSession, no));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
@ -353,6 +420,10 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use by the EventManager when checking for deferred breapoints.
|
||||||
|
* @param bkpt
|
||||||
|
*/
|
||||||
public void addToBreakpointList(Breakpoint bkpt) {
|
public void addToBreakpointList(Breakpoint bkpt) {
|
||||||
List bList = (List)breakMap.get(bkpt.getTarget());
|
List bList = (List)breakMap.get(bkpt.getTarget());
|
||||||
if (bList != null) {
|
if (bList != null) {
|
||||||
|
@ -376,22 +447,46 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteBreakpoints(Target target, ICDIBreakpoint[] breakpoints) throws CDIException {
|
public void deleteBreakpoints(Target target, ICDIBreakpoint[] breakpoints) throws CDIException {
|
||||||
int[] numbers = new int[breakpoints.length];
|
|
||||||
List bList = (List)breakMap.get(target);
|
List bList = (List)breakMap.get(target);
|
||||||
|
|
||||||
|
// Do the sanity check first, we will accept all or none
|
||||||
if (bList == null) {
|
if (bList == null) {
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
for (int i = 0; i < numbers.length; i++) {
|
for (int i = 0; i < breakpoints.length; i++) {
|
||||||
if (breakpoints[i] instanceof Breakpoint
|
if (!(breakpoints[i] instanceof Breakpoint && bList.contains(breakpoints[i]))) {
|
||||||
&& bList.contains(breakpoints[i])) {
|
|
||||||
numbers[i] =
|
|
||||||
((Breakpoint) breakpoints[i]).getMIBreakpoint().getNumber();
|
|
||||||
} else {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Not_a_CDT_breakpoint")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean state = suspendInferior(target);
|
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
|
List eventList = new ArrayList(breakpoints.length);
|
||||||
|
for (int i = 0; i < breakpoints.length; i++) {
|
||||||
|
MIBreakpoint[] miBreakpoints = ((Breakpoint)breakpoints[i]).getMIBreakpoints();
|
||||||
|
if (miBreakpoints.length > 0) {
|
||||||
|
deleteMIBreakpoints(target, miBreakpoints);
|
||||||
|
eventList.add(new MIBreakpointDeletedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
||||||
|
miSession.fireEvents(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteMIBreakpoints(Target target, MIBreakpoint[] miBreakpoints) throws CDIException {
|
||||||
|
MISession miSession = target.getMISession();
|
||||||
|
int[] numbers = new int[miBreakpoints.length];
|
||||||
|
for (int i = 0; i < miBreakpoints.length; ++i) {
|
||||||
|
numbers[i] = miBreakpoints[i].getNumber();
|
||||||
|
}
|
||||||
|
boolean state = suspendInferior(target);
|
||||||
|
try {
|
||||||
|
deleteMIBreakpoints(miSession, numbers);
|
||||||
|
} finally {
|
||||||
|
resumeInferior(target, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteMIBreakpoints(MISession miSession, int[] numbers) throws CDIException {
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
MIBreakDelete breakDelete = factory.createMIBreakDelete(numbers);
|
MIBreakDelete breakDelete = factory.createMIBreakDelete(numbers);
|
||||||
try {
|
try {
|
||||||
|
@ -402,16 +497,7 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
|
||||||
resumeInferior(target, state);
|
|
||||||
}
|
}
|
||||||
List eventList = new ArrayList(breakpoints.length);
|
|
||||||
for (int i = 0; i < breakpoints.length; i++) {
|
|
||||||
int no = ((Breakpoint)breakpoints[i]).getMIBreakpoint().getNumber();
|
|
||||||
eventList.add(new MIBreakpointDeletedEvent(miSession, no));
|
|
||||||
}
|
|
||||||
MIEvent[] events = (MIEvent[])eventList.toArray(new MIEvent[0]);
|
|
||||||
miSession.fireEvents(events);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -438,17 +524,19 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDILocationBreakpoint setLocationBreakpoint(Target target, int type, ICDILocation location,
|
public ICDILocationBreakpoint setLocationBreakpoint(Target target, int type, ICDILocation location,
|
||||||
ICDICondition condition, String threadId, boolean deferred) throws CDIException {
|
ICDICondition condition, boolean deferred) throws CDIException {
|
||||||
|
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
Breakpoint bkpt = new Breakpoint(target, type, location, condition, threadId);
|
Breakpoint bkpt = new Breakpoint(target, type, location, condition);
|
||||||
try {
|
try {
|
||||||
setLocationBreakpoint(bkpt);
|
setLocationBreakpoint(bkpt);
|
||||||
List blist = getBreakpointsList(target);
|
List blist = getBreakpointsList(target);
|
||||||
blist.add(bkpt);
|
blist.add(bkpt);
|
||||||
|
|
||||||
// Fire a created Event.
|
// Fire a created Event.
|
||||||
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, bkpt.getMIBreakpoint().getNumber()));
|
MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints();
|
||||||
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
|
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
if (!deferred) {
|
if (!deferred) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -472,18 +560,19 @@ public class BreakpointManager extends Manager {
|
||||||
return bkpt;
|
return bkpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIBreakInsert createMIBreakInsert(Breakpoint bkpt) throws CDIException {
|
MIBreakInsert[] createMIBreakInsert(Breakpoint bkpt) throws CDIException {
|
||||||
boolean hardware = bkpt.isHardware();
|
boolean hardware = bkpt.isHardware();
|
||||||
boolean temporary = bkpt.isTemporary();
|
boolean temporary = bkpt.isTemporary();
|
||||||
String exprCond = null;
|
String exprCond = null;
|
||||||
int ignoreCount = 0;
|
int ignoreCount = 0;
|
||||||
String threadId = bkpt.getThreadId();
|
String[] threadIds = null;
|
||||||
StringBuffer line = new StringBuffer();
|
StringBuffer line = new StringBuffer();
|
||||||
|
|
||||||
if (bkpt.getCondition() != null) {
|
if (bkpt.getCondition() != null) {
|
||||||
ICDICondition condition = bkpt.getCondition();
|
ICDICondition condition = bkpt.getCondition();
|
||||||
exprCond = condition.getExpression();
|
exprCond = condition.getExpression();
|
||||||
ignoreCount = condition.getIgnoreCount();
|
ignoreCount = condition.getIgnoreCount();
|
||||||
|
threadIds = condition.getThreadIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bkpt.getLocation() != null) {
|
if (bkpt.getLocation() != null) {
|
||||||
|
@ -506,41 +595,63 @@ public class BreakpointManager extends Manager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int tid = 0;
|
MIBreakInsert[] miBreakInserts;
|
||||||
if (threadId != null && threadId.length() > 0) {
|
|
||||||
try {
|
|
||||||
tid = Integer.parseInt(threadId);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MISession miSession = ((Target)bkpt.getTarget()).getMISession();
|
MISession miSession = ((Target)bkpt.getTarget()).getMISession();
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
return factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString(), tid);
|
if (threadIds == null || threadIds.length == 0) {
|
||||||
|
MIBreakInsert bi = factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString(), 0);
|
||||||
|
miBreakInserts = new MIBreakInsert[] { bi } ;
|
||||||
|
} else {
|
||||||
|
List list = new ArrayList(threadIds.length);
|
||||||
|
for (int i = 0; i < threadIds.length; i++) {
|
||||||
|
String threadId = threadIds[i];
|
||||||
|
int tid = 0;
|
||||||
|
if (threadId != null && threadId.length() > 0) {
|
||||||
|
try {
|
||||||
|
tid = Integer.parseInt(threadId);
|
||||||
|
list.add(factory.createMIBreakInsert(temporary, hardware, exprCond, ignoreCount, line.toString(), tid));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
miBreakInserts = (MIBreakInsert[]) list.toArray(new MIBreakInsert[list.size()]);
|
||||||
|
}
|
||||||
|
return miBreakInserts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocationBreakpoint (Breakpoint bkpt) throws CDIException {
|
public void setLocationBreakpoint (Breakpoint bkpt) throws CDIException {
|
||||||
Target target = (Target)bkpt.getTarget();
|
Target target = (Target)bkpt.getTarget();
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
boolean state = suspendInferior(target);
|
boolean state = suspendInferior(target);
|
||||||
MIBreakInsert breakInsert = createMIBreakInsert(bkpt);
|
MIBreakInsert[] breakInserts = createMIBreakInsert(bkpt);
|
||||||
MIBreakpoint[] points = null;
|
List pointList = new ArrayList();
|
||||||
try {
|
try {
|
||||||
miSession.postCommand(breakInsert);
|
for (int i = 0; i < breakInserts.length; i++) {
|
||||||
MIBreakInsertInfo info = breakInsert.getMIBreakInsertInfo();
|
miSession.postCommand(breakInserts[i]);
|
||||||
if (info == null) {
|
MIBreakInsertInfo info = breakInserts[i].getMIBreakInsertInfo();
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
if (info == null) {
|
||||||
}
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
points = info.getMIBreakpoints();
|
}
|
||||||
if (points == null || points.length == 0) {
|
MIBreakpoint[] points = info.getMIBreakpoints();
|
||||||
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Parsing_Error")); //$NON-NLS-1$
|
if (points == null || points.length == 0) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.BreakpointManager.Parsing_Error")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
pointList.addAll(Arrays.asList(points));
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
|
// Things did not go well remove all the breakpoints we've set before.
|
||||||
|
MIBreakpoint[] allPoints = (MIBreakpoint[]) pointList.toArray(new MIBreakpoint[pointList.size()]);
|
||||||
|
try {
|
||||||
|
deleteMIBreakpoints(target, allPoints);
|
||||||
|
} catch (CDIException cdie) {
|
||||||
|
// ignore this one;
|
||||||
|
}
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
resumeInferior(target, state);
|
resumeInferior(target, state);
|
||||||
}
|
}
|
||||||
|
MIBreakpoint[] allPoints = (MIBreakpoint[]) pointList.toArray(new MIBreakpoint[pointList.size()]);
|
||||||
bkpt.setMIBreakpoint(points[0]);
|
bkpt.setMIBreakpoints(allPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDIWatchpoint setWatchpoint(Target target, int type, int watchType, String expression,
|
public ICDIWatchpoint setWatchpoint(Target target, int type, int watchType, String expression,
|
||||||
|
@ -572,12 +683,15 @@ public class BreakpointManager extends Manager {
|
||||||
} finally {
|
} finally {
|
||||||
resumeInferior(target, state);
|
resumeInferior(target, state);
|
||||||
}
|
}
|
||||||
Watchpoint bkpt = new Watchpoint(target, points[0]);
|
Watchpoint bkpt = new Watchpoint(target, expression, type, watchType, condition);
|
||||||
|
bkpt.setMIBreakpoints(points);
|
||||||
List bList = getBreakpointsList(target);
|
List bList = getBreakpointsList(target);
|
||||||
bList.add(bkpt);
|
bList.add(bkpt);
|
||||||
|
|
||||||
// Fire a created Event.
|
// Fire a created Event.
|
||||||
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, bkpt.getMIBreakpoint().getNumber()));
|
MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints();
|
||||||
|
if (miBreakpoints != null && miBreakpoints.length > 0)
|
||||||
|
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
return bkpt;
|
return bkpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,17 +708,17 @@ public class BreakpointManager extends Manager {
|
||||||
throw new CDIException("Must suspend on throw or catch"); //$NON-NLS-1$
|
throw new CDIException("Must suspend on throw or catch"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
MIBreakpoint miBreakpoint = null;
|
MIBreakpoint[] miBreakpoints = null;
|
||||||
|
|
||||||
if (stopOnThrow) {
|
if (stopOnThrow) {
|
||||||
synchronized(exceptionBps) {
|
synchronized(exceptionBps) {
|
||||||
int id = EXCEPTION_THROW_IDX;
|
int id = EXCEPTION_THROW_IDX;
|
||||||
if (exceptionBps[EXCEPTION_THROW_IDX] == null) {
|
if (exceptionBps[EXCEPTION_THROW_IDX] == null) {
|
||||||
Location location = new Location(null, EXCEPTION_FUNCS[id], 0);
|
Location location = new Location(null, EXCEPTION_FUNCS[id], 0);
|
||||||
Breakpoint bp = new Breakpoint(target, ICDIBreakpoint.REGULAR, location, null, null);
|
Breakpoint bp = new Breakpoint(target, ICDIBreakpoint.REGULAR, location, null);
|
||||||
setLocationBreakpoint(bp);
|
setLocationBreakpoint(bp);
|
||||||
exceptionBps[id] = bp;
|
exceptionBps[id] = bp;
|
||||||
miBreakpoint = bp.getMIBreakpoint();
|
miBreakpoints = bp.getMIBreakpoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,44 +727,43 @@ public class BreakpointManager extends Manager {
|
||||||
int id = EXCEPTION_THROW_IDX;
|
int id = EXCEPTION_THROW_IDX;
|
||||||
if (exceptionBps[id] == null) {
|
if (exceptionBps[id] == null) {
|
||||||
Location location = new Location(null, EXCEPTION_FUNCS[id], 0);
|
Location location = new Location(null, EXCEPTION_FUNCS[id], 0);
|
||||||
Breakpoint bp = new Breakpoint(target, ICDIBreakpoint.REGULAR, location, null, null);
|
Breakpoint bp = new Breakpoint(target, ICDIBreakpoint.REGULAR, location, null);
|
||||||
setLocationBreakpoint(bp);
|
setLocationBreakpoint(bp);
|
||||||
exceptionBps[id] = bp;
|
exceptionBps[id] = bp;
|
||||||
miBreakpoint = bp.getMIBreakpoint();
|
if (miBreakpoints != null) {
|
||||||
|
MIBreakpoint[] mibp = bp.getMIBreakpoints();
|
||||||
|
MIBreakpoint[] temp = new MIBreakpoint[miBreakpoints.length + mibp.length];
|
||||||
|
System.arraycopy(miBreakpoints, 0, temp, 0, miBreakpoints.length);
|
||||||
|
System.arraycopy(mibp, 0, temp, miBreakpoints.length, mibp.length);
|
||||||
|
} else {
|
||||||
|
miBreakpoints = bp.getMIBreakpoints();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Exceptionpoint excp = new Exceptionpoint(target, clazz, stopOnThrow, stopOnCatch);
|
Exceptionpoint excp = new Exceptionpoint(target, clazz, stopOnThrow, stopOnCatch);
|
||||||
excp.setMIBreakpoint(miBreakpoint);
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
List blist = getBreakpointsList(target);
|
excp.setMIBreakpoints(miBreakpoints);
|
||||||
blist.add(excp);
|
List blist = getBreakpointsList(target);
|
||||||
|
blist.add(excp);
|
||||||
// Fire a created Event.
|
|
||||||
MISession miSession = target.getMISession();
|
|
||||||
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, excp.getMIBreakpoint().getNumber()));
|
|
||||||
|
|
||||||
|
// Fire a created Event.
|
||||||
|
MISession miSession = target.getMISession();
|
||||||
|
miSession.fireEvent(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
return excp;
|
return excp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Condition createCondition(int ignoreCount, String expression, String[] tids) {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createCondition(int, String)
|
return new Condition(ignoreCount, expression, tids);
|
||||||
*/
|
|
||||||
public ICDICondition createCondition(int ignoreCount, String expression) {
|
|
||||||
return new Condition(ignoreCount, expression);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Location createLocation(String file, String function, int line) {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(String, String, int)
|
|
||||||
*/
|
|
||||||
public ICDILocation createLocation(String file, String function, int line) {
|
|
||||||
return new Location(file, function, line);
|
return new Location(file, function, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Location createLocation(BigInteger address) {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long)
|
|
||||||
*/
|
|
||||||
public ICDILocation createLocation(BigInteger address) {
|
|
||||||
return new Location(address);
|
return new Location(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,12 @@ public class Condition implements ICDICondition {
|
||||||
|
|
||||||
int ignoreCount;
|
int ignoreCount;
|
||||||
String expression;
|
String expression;
|
||||||
|
String[] tids;
|
||||||
|
|
||||||
public Condition(int ignore, String exp) {
|
public Condition(int ignore, String exp, String[] ids) {
|
||||||
ignoreCount = ignore;
|
ignoreCount = ignore;
|
||||||
expression = (exp == null) ? new String() : exp;
|
expression = (exp == null) ? new String() : exp;
|
||||||
|
tids = (ids == null) ? new String[0] : ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,4 +39,11 @@ public class Condition implements ICDICondition {
|
||||||
public String getExpression() {
|
public String getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.ICDICondition#getThreadId()
|
||||||
|
*/
|
||||||
|
public String[] getThreadIds() {
|
||||||
|
return tids;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIVarChangedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarCreatedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIVarCreatedEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIVarDeletedEvent;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
import org.eclipse.cdt.debug.mi.core.output.MIStackInfoDepthInfo;
|
||||||
|
|
||||||
|
@ -386,7 +387,10 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
bpMgr.disableBreakpoint(bkpt);
|
bpMgr.disableBreakpoint(bkpt);
|
||||||
}
|
}
|
||||||
eventList.add(new MIBreakpointCreatedEvent(miSession, bkpt.getMIBreakpoint().getNumber()));
|
MIBreakpoint[] miBreakpoints = bkpt.getMIBreakpoints();
|
||||||
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
|
eventList.add(new MIBreakpointCreatedEvent(miSession, miBreakpoints[0].getNumber()));
|
||||||
|
}
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
|
@ -30,41 +33,28 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
|
|
||||||
ICDILocation fLocation;
|
ICDILocation fLocation;
|
||||||
ICDICondition condition;
|
ICDICondition condition;
|
||||||
MIBreakpoint miBreakpoint;
|
MIBreakpoint[] miBreakpoints;
|
||||||
//BreakpointManager mgr;
|
|
||||||
int type;
|
int type;
|
||||||
String tid;
|
|
||||||
boolean enable;
|
boolean enable;
|
||||||
|
|
||||||
public Breakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond, String threadId) {
|
public Breakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond) {
|
||||||
super(target);
|
super(target);
|
||||||
//mgr = m;
|
|
||||||
type = kind;
|
type = kind;
|
||||||
fLocation = loc;
|
fLocation = loc;
|
||||||
condition = cond;
|
condition = cond;
|
||||||
tid = threadId;
|
|
||||||
enable = true;
|
enable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Breakpoint(Target target, MIBreakpoint miBreak) {
|
public MIBreakpoint[] getMIBreakpoints() {
|
||||||
super(target);
|
return miBreakpoints;
|
||||||
miBreakpoint = miBreak;
|
|
||||||
//mgr = m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MIBreakpoint getMIBreakpoint() {
|
public void setMIBreakpoints(MIBreakpoint[] newMIBreakpoints) {
|
||||||
return miBreakpoint;
|
miBreakpoints = newMIBreakpoints;
|
||||||
}
|
|
||||||
|
|
||||||
public void setMIBreakpoint(MIBreakpoint newMIBreakpoint) {
|
|
||||||
miBreakpoint = newMIBreakpoint;
|
|
||||||
// Force the reset to use GDB's values.
|
|
||||||
condition = null;
|
|
||||||
fLocation = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeferred() {
|
public boolean isDeferred() {
|
||||||
return (miBreakpoint == null);
|
return (miBreakpoints == null || miBreakpoints.length == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,30 +62,26 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
*/
|
*/
|
||||||
public ICDICondition getCondition() throws CDIException {
|
public ICDICondition getCondition() throws CDIException {
|
||||||
if (condition == null) {
|
if (condition == null) {
|
||||||
if (miBreakpoint != null) {
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
condition = new Condition(miBreakpoint.getIgnoreCount(), miBreakpoint.getCondition());
|
List list = new ArrayList(miBreakpoints.length);
|
||||||
|
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||||
|
list.add(miBreakpoints[i].getThreadId());
|
||||||
|
}
|
||||||
|
String[] tids = (String[]) list.toArray(new String[list.size()]);
|
||||||
|
int icount = miBreakpoints[0].getIgnoreCount();
|
||||||
|
String exp = miBreakpoints[0].getCondition();
|
||||||
|
condition = new Condition(icount, exp, tids);
|
||||||
|
} else {
|
||||||
|
condition = new Condition(0, "", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
|
|
||||||
*/
|
|
||||||
public String getThreadId() throws CDIException {
|
|
||||||
if (miBreakpoint != null) {
|
|
||||||
return miBreakpoint.getThreadId();
|
|
||||||
}
|
|
||||||
return tid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
|
||||||
*/
|
*/
|
||||||
public boolean isEnabled() throws CDIException {
|
public boolean isEnabled() throws CDIException {
|
||||||
if (miBreakpoint != null) {
|
|
||||||
return miBreakpoint.isEnabled();
|
|
||||||
}
|
|
||||||
return enable;
|
return enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +89,6 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
|
||||||
*/
|
*/
|
||||||
public boolean isHardware() {
|
public boolean isHardware() {
|
||||||
if (miBreakpoint != null) {
|
|
||||||
return miBreakpoint.isHardware();
|
|
||||||
}
|
|
||||||
return (type == ICDIBreakpoint.HARDWARE);
|
return (type == ICDIBreakpoint.HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,22 +96,23 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
|
||||||
*/
|
*/
|
||||||
public boolean isTemporary() {
|
public boolean isTemporary() {
|
||||||
if (miBreakpoint != null) {
|
|
||||||
return miBreakpoint.isTemporary();
|
|
||||||
}
|
|
||||||
return (type == ICDIBreakpoint.TEMPORARY);
|
return (type == ICDIBreakpoint.TEMPORARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setCondition(ICDICondition)
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setCondition(ICDICondition)
|
||||||
*/
|
*/
|
||||||
public void setCondition(ICDICondition condition) throws CDIException {
|
public void setCondition(ICDICondition newCondition) throws CDIException {
|
||||||
Session session = (Session)getTarget().getSession();
|
Session session = (Session)getTarget().getSession();
|
||||||
BreakpointManager mgr = session.getBreakpointManager();
|
BreakpointManager mgr = session.getBreakpointManager();
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
mgr.setCondition(this, condition);
|
mgr.setCondition(this, newCondition);
|
||||||
}
|
}
|
||||||
this.condition = condition;
|
setCondition0(newCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCondition0(ICDICondition newCondition) {
|
||||||
|
condition = newCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,13 +121,15 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
public void setEnabled(boolean on) throws CDIException {
|
public void setEnabled(boolean on) throws CDIException {
|
||||||
Session session = (Session)getTarget().getSession();
|
Session session = (Session)getTarget().getSession();
|
||||||
BreakpointManager mgr = session.getBreakpointManager();
|
BreakpointManager mgr = session.getBreakpointManager();
|
||||||
if (miBreakpoint != null) {
|
if (on == false && isEnabled() == true) {
|
||||||
if (on == false && isEnabled() == true) {
|
mgr.disableBreakpoint(this);
|
||||||
mgr.disableBreakpoint(this);
|
} else if (on == true && isEnabled() == false) {
|
||||||
} else if (on == true && isEnabled() == false) {
|
mgr.enableBreakpoint(this);
|
||||||
mgr.enableBreakpoint(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
setEnabled0(on);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled0(boolean on) {
|
||||||
enable = on;
|
enable = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,11 +138,16 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
||||||
*/
|
*/
|
||||||
public ICDILocation getLocation() throws CDIException {
|
public ICDILocation getLocation() throws CDIException {
|
||||||
if (fLocation == null) {
|
if (fLocation == null) {
|
||||||
if (miBreakpoint != null) {
|
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||||
fLocation = new Location (miBreakpoint.getFile(),
|
BigInteger addr = BigInteger.ZERO;
|
||||||
miBreakpoint.getFunction(),
|
String a = miBreakpoints[0].getAddress();
|
||||||
miBreakpoint.getLine(),
|
if (a != null) {
|
||||||
MIFormat.getBigInteger(miBreakpoint.getAddress()));
|
addr = MIFormat.getBigInteger(a);
|
||||||
|
}
|
||||||
|
fLocation = new Location (miBreakpoints[0].getFile(),
|
||||||
|
miBreakpoints[0].getFunction(),
|
||||||
|
miBreakpoints[0].getLine(),
|
||||||
|
addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fLocation;
|
return fLocation;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint {
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch) {
|
public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch) {
|
||||||
super(target, ICDIBreakpoint.REGULAR, null, null, null);
|
super(target, ICDIBreakpoint.REGULAR, null, null);
|
||||||
fClazz = clazz;
|
fClazz = clazz;
|
||||||
fStopOnThrow = stopOnThrow;
|
fStopOnThrow = stopOnThrow;
|
||||||
fStopOnCatch = stopOnCatch;
|
fStopOnCatch = stopOnCatch;
|
||||||
|
@ -41,9 +41,9 @@ public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint {
|
||||||
* @param target
|
* @param target
|
||||||
* @param miBreak
|
* @param miBreak
|
||||||
*/
|
*/
|
||||||
public Exceptionpoint(Target target, MIBreakpoint miBreak) {
|
// public Exceptionpoint(Target target, MIBreakpoint miBreak) {
|
||||||
super(target, miBreak);
|
// super(target, miBreak);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnThrow()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint#isStopOnThrow()
|
||||||
|
|
|
@ -698,9 +698,9 @@ public class Target implements ICDITarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
||||||
ICDICondition condition, String threadId, boolean deferred) throws CDIException {
|
ICDICondition condition, boolean deferred) throws CDIException {
|
||||||
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
||||||
return bMgr.setLocationBreakpoint(this, type, location, condition, threadId, deferred);
|
return bMgr.setLocationBreakpoint(this, type, location, condition, deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression,
|
public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression,
|
||||||
|
@ -724,12 +724,19 @@ public class Target implements ICDITarget {
|
||||||
// throw new CDIException("Not Implemented"); //$NON-NLS-1$
|
// throw new CDIException("Not Implemented"); //$NON-NLS-1$
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String)
|
||||||
*/
|
*/
|
||||||
public ICDICondition createCondition(int ignoreCount, String expression) {
|
public ICDICondition createCondition(int ignoreCount, String expression) {
|
||||||
|
return createCondition(ignoreCount, expression, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createCondition(int, java.lang.String, String)
|
||||||
|
*/
|
||||||
|
public ICDICondition createCondition(int ignoreCount, String expression, String[] tids) {
|
||||||
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
|
||||||
return bMgr.createCondition(ignoreCount, expression);
|
return bMgr.createCondition(ignoreCount, expression, tids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
|
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
|
||||||
|
@ -477,15 +478,21 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
ICDIBreakpoint[] bps = target.getBreakpoints();
|
ICDIBreakpoint[] bps = target.getBreakpoints();
|
||||||
ArrayList list = new ArrayList(bps.length);
|
ArrayList list = new ArrayList(bps.length);
|
||||||
for (int i = 0; i < bps.length; i++) {
|
for (int i = 0; i < bps.length; i++) {
|
||||||
String threadId = bps[i].getThreadId();
|
ICDICondition condition = bps[i].getCondition();
|
||||||
int tid = 0;
|
if (condition == null) {
|
||||||
try {
|
continue;
|
||||||
tid = Integer.parseInt(threadId);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
if (tid == getId()) {
|
String[] threadIds = condition.getThreadIds();
|
||||||
list.add(bps[i]);
|
for (int j = 0; j < threadIds.length; j++) {
|
||||||
|
int tid = 0;
|
||||||
|
try {
|
||||||
|
tid = Integer.parseInt(threadIds[j]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
if (tid == getId()) {
|
||||||
|
list.add(bps[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ICDIBreakpoint[]) list.toArray(new ICDIBreakpoint[list.size()]);
|
return (ICDIBreakpoint[]) list.toArray(new ICDIBreakpoint[list.size()]);
|
||||||
|
@ -494,8 +501,23 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
public ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location,
|
||||||
ICDICondition condition, boolean deferred) throws CDIException {
|
ICDICondition condition, boolean deferred) throws CDIException {
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
String threadId = Integer.toString(getId());
|
String[] threadIds = new String[] { Integer.toString(getId()) };
|
||||||
return target.setLocationBreakpoint(type, location, condition, threadId, deferred);
|
int icount = 0;
|
||||||
|
String exp = new String();
|
||||||
|
if (condition != null) {
|
||||||
|
icount = condition.getIgnoreCount();
|
||||||
|
exp = condition.getExpression();
|
||||||
|
String[] tids = condition.getThreadIds();
|
||||||
|
if (tids != null && tids.length > 0) {
|
||||||
|
String[] temp = new String[threadIds.length + tids.length];
|
||||||
|
System.arraycopy(threadIds, 0, temp, 0, threadIds.length);
|
||||||
|
System.arraycopy(tids, 0, temp, threadIds.length, tids.length);
|
||||||
|
threadIds = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BreakpointManager bMgr = ((Session)target.getSession()).getBreakpointManager();
|
||||||
|
ICDICondition newCondition = bMgr.createCondition(icount, exp, threadIds);
|
||||||
|
return target.setLocationBreakpoint(type, location, newCondition, deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,21 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||||
String what;
|
String what;
|
||||||
|
|
||||||
public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond) {
|
public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond) {
|
||||||
super(target, type, null, cond, ""); //$NON-NLS-1$
|
super(target, type, null, cond); //$NON-NLS-1$
|
||||||
watchType = wType;
|
watchType = wType;
|
||||||
what = expression;
|
what = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Watchpoint(Target target, MIBreakpoint miBreak) {
|
|
||||||
super(target, miBreak);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#getWatchExpression()
|
||||||
*/
|
*/
|
||||||
public String getWatchExpression() throws CDIException {
|
public String getWatchExpression() throws CDIException {
|
||||||
MIBreakpoint miPoint = getMIBreakpoint();
|
if (what == null) {
|
||||||
if (miPoint != null)
|
MIBreakpoint[] miPoints = getMIBreakpoints();
|
||||||
return getMIBreakpoint().getWhat();
|
if (miPoints != null && miPoints.length > 0) {
|
||||||
|
return miPoints[0].getWhat();
|
||||||
|
}
|
||||||
|
}
|
||||||
return what;
|
return what;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,20 +45,22 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isReadType()
|
||||||
*/
|
*/
|
||||||
public boolean isReadType() {
|
public boolean isReadType() {
|
||||||
MIBreakpoint miPoint = getMIBreakpoint();
|
|
||||||
if (miPoint != null)
|
|
||||||
return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint();
|
|
||||||
return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ);
|
return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ);
|
||||||
|
// MIBreakpoint miPoint = getMIBreakpoint();
|
||||||
|
// if (miPoint != null)
|
||||||
|
// return getMIBreakpoint().isReadWatchpoint() || getMIBreakpoint().isAccessWatchpoint();
|
||||||
|
// return ((watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
* @see org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint#isWriteType()
|
||||||
*/
|
*/
|
||||||
public boolean isWriteType() {
|
public boolean isWriteType() {
|
||||||
MIBreakpoint miPoint = getMIBreakpoint();
|
|
||||||
if (miPoint != null)
|
|
||||||
return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint();
|
|
||||||
return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE);
|
return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE);
|
||||||
|
// MIBreakpoint miPoint = getMIBreakpoint();
|
||||||
|
// if (miPoint != null)
|
||||||
|
// return getMIBreakpoint().isAccessWatchpoint() || getMIBreakpoint().isWriteWatchpoint();
|
||||||
|
// return ((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue