mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +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>
|
||||
{
|
||||
// In this particular case, because of a GDB peculiarity, setParameters() is
|
||||
// not used and the whole command is formatted on the parent's constructor.
|
||||
// See bug 213076 for more information.
|
||||
/*
|
||||
* MICommand wraps a parameter with double quotes if it contains a space.
|
||||
* 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) {
|
||||
super(ctx, "-break-condition " + Integer.toString(breakpoint) + " " + condition); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// super(ctx, "-break-condition"); //$NON-NLS-1$
|
||||
// setParameters(new String[] { Integer.toString(breakpoint), condition });
|
||||
super(ctx, "-break-condition"); //$NON-NLS-1$
|
||||
|
||||
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