merge pydev_debugger

This commit is contained in:
Elizaveta Shashkova
2014-10-14 19:51:58 +04:00
parent 860f5a0b36
commit 802eea78a6
3 changed files with 40 additions and 3 deletions

View File

@@ -833,7 +833,7 @@ class PyDB:
# the id to be the line.
breakpoint_id = line = int(line)
if condition.startswith('**FUNC**'):
func_name, condition = condition.split('\t', 1)
func_name, condition = condition.split("@_@TAB_CHAR@_@", 1)
# We must restore new lines and tabs as done in
# AbstractDebugTarget.breakpointAdded

View File

@@ -51,6 +51,7 @@ public abstract class AbstractCommand<T> {
public static final int VERSION = 501;
public static final String NEW_LINE_CHAR = "@_@NEW_LINE_CHAR@_@";
public static final String TAB_CHAR = "@_@TAB_CHAR@_@";
public static final String FUNC_IN_CONDITION = "**FUNC**";
@NotNull private final RemoteDebugger myDebugger;

View File

@@ -7,14 +7,16 @@ import org.jetbrains.annotations.Nullable;
public class SetBreakpointCommand extends LineBreakpointCommand {
private @Nullable final String myCondition;
private @Nullable final String myLogExpression;
private @Nullable final String myFuncName;
public SetBreakpointCommand(@NotNull final RemoteDebugger debugger,
@NotNull final String type,
@NotNull final String file,
@NotNull final int line) {
this(debugger, type, file, line, null, null);
this(debugger, type, file, line, null, null, null);
}
public SetBreakpointCommand(@NotNull final RemoteDebugger debugger,
@NotNull final String type,
@NotNull final String file,
@@ -24,12 +26,46 @@ public class SetBreakpointCommand extends LineBreakpointCommand {
super(debugger, type, SET_BREAKPOINT, file, line);
myCondition = condition;
myLogExpression = logExpression;
myFuncName = null;
}
public SetBreakpointCommand(@NotNull final RemoteDebugger debugger,
@NotNull final String type,
@NotNull final String file,
@NotNull final int line,
@Nullable final String condition,
@Nullable final String logExpression,
@Nullable final String funcName) {
super(debugger, type, SET_BREAKPOINT, file, line);
myCondition = condition;
myLogExpression = logExpression;
myFuncName = funcName;
}
@Override
protected void buildPayload(Payload payload) {
super.buildPayload(payload);
payload.add(buildCondition(myCondition)).add(buildCondition(myLogExpression));
payload.add(buildConditionWithFunc(myCondition, myFuncName)).add(buildCondition(myLogExpression));
}
@NotNull
private static String buildConditionWithFunc(String expression, String functionName) {
StringBuilder builder = new StringBuilder();
if (functionName != null) {
builder.append(FUNC_IN_CONDITION);
builder.append(functionName);
builder.append(TAB_CHAR);
}
if (expression != null) {
builder.append(expression.replaceAll("\n", NEW_LINE_CHAR));
} else {
builder.append("None");
}
String condition = builder.toString();
return condition.replaceAll("\t", TAB_CHAR);
}
@NotNull