mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 213076: [breakpoints] Condition string not properly formatted when adding to an existing breakpoint/watchpoint
This commit is contained in:
parent
e3505af7c7
commit
088ab87031
1 changed files with 30 additions and 6 deletions
|
@ -25,13 +25,37 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
|
|
||||||
public class MIBreakCondition extends MICommand<MIInfo>
|
public class MIBreakCondition extends MICommand<MIInfo>
|
||||||
{
|
{
|
||||||
// In this particular case, because of a GDB peculiarity, setParameters() is
|
/*
|
||||||
// not used and the whole command is formatted on the parent's constructor.
|
* MICommand wraps a parameter with double quotes if it contains a space.
|
||||||
// See bug 213076 for more information.
|
* However, GDB does not want quotes around a condition.
|
||||||
|
* To avoid the double quotes, we create our own adjustable parameter.
|
||||||
|
* It is important to send the breakpoint and condition as parameters because
|
||||||
|
* MI can insert flags such as --thread-group between the command and the
|
||||||
|
* parameters. If we make the entire output be the command, then the
|
||||||
|
* --thread-group flag will end up at the end, and the syntax will not be valid.
|
||||||
|
*
|
||||||
|
* See bug 213076 for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
public MIBreakCondition(IBreakpointsTargetDMContext ctx, int breakpoint, String condition) {
|
public MIBreakCondition(IBreakpointsTargetDMContext ctx, int breakpoint, String condition) {
|
||||||
super(ctx, "-break-condition " + Integer.toString(breakpoint) + " " + condition); //$NON-NLS-1$ //$NON-NLS-2$
|
super(ctx, "-break-condition"); //$NON-NLS-1$
|
||||||
// super(ctx, "-break-condition"); //$NON-NLS-1$
|
|
||||||
// setParameters(new String[] { Integer.toString(breakpoint), condition });
|
setParameters(new Adjustable[]{ new MIStandardParameterAdjustable(Integer.toString(breakpoint)),
|
||||||
|
new NoChangeAdjustable(condition) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This adjustable makes sure that the condition parameter will not get surrounded
|
||||||
|
* by double quotes. We simply send the condition exactly as specified
|
||||||
|
*/
|
||||||
|
private class NoChangeAdjustable extends MICommandAdjustable {
|
||||||
|
|
||||||
|
public NoChangeAdjustable(String param) {
|
||||||
|
super(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdjustedValue() {
|
||||||
|
return getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue