add breakpoint's function whith changing api

This commit is contained in:
Elizaveta Shashkova
2014-10-16 16:37:50 +04:00
parent 1102650b66
commit 74f4621bc9
3 changed files with 6 additions and 32 deletions

View File

@@ -828,21 +828,16 @@ class PyDB:
else:
#Note: this else should be removed after PyCharm migrates to setting
#breakpoints by id (and ideally also provides func_name).
type, file, line, condition, expression = text.split('\t', 4)
type, file, line, func_name, condition, expression = text.split('\t', 5)
# If we don't have an id given for each breakpoint, consider
# the id to be the line.
breakpoint_id = line = int(line)
if condition.startswith('**FUNC**'):
func_name, condition = condition.split("@_@TAB_CHAR@_@", 1)
# We must restore new lines and tabs as done in
# AbstractDebugTarget.breakpointAdded
condition = condition.replace("@_@NEW_LINE_CHAR@_@", '\n').\
replace("@_@TAB_CHAR@_@", '\t').strip()
condition = condition.replace("@_@NEW_LINE_CHAR@_@", '\n'). \
replace("@_@TAB_CHAR@_@", '\t').strip()
func_name = func_name[8:]
else:
func_name = 'None' # Match anything if not specified.
expression = expression.replace("@_@NEW_LINE_CHAR@_@", '\n'). \
replace("@_@TAB_CHAR@_@", '\t').strip()
if not IS_PY3K: # In Python 3, the frame object will have unicode for the file, whereas on python 2 it has a byte-array encoded with the filesystem encoding.
file = file.encode(file_system_encoding)

View File

@@ -51,7 +51,6 @@ 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

@@ -45,27 +45,7 @@ public class SetBreakpointCommand extends LineBreakpointCommand {
@Override
protected void buildPayload(Payload payload) {
super.buildPayload(payload);
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);
payload.add(buildCondition(myFuncName)).add(buildCondition(myCondition)).add(buildCondition(myLogExpression));
}
@NotNull