mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix reslice of array.
This commit is contained in:
@@ -797,8 +797,14 @@ class PyDB:
|
||||
# we received some command to get an array variable
|
||||
# the text is: thread_id\tframe_id\tFRAME|GLOBAL\tname\ttemp\troffs\tcoffs\trows\tcols\tformat
|
||||
try:
|
||||
thread_id, frame_id, scope, name, temp, roffset, coffset, rows, cols, format = text.split('\t')
|
||||
int_cmd = InternalGetArray(seq, thread_id, frame_id, scope, name, temp, roffset, coffset, rows, cols, format)
|
||||
roffset, coffset, rows, cols, format, thread_id, frame_id, scopeattrs = text.split('\t', 7)
|
||||
|
||||
if scopeattrs.find('\t') != -1: # there are attributes beyond scope
|
||||
scope, attrs = scopeattrs.split('\t', 1)
|
||||
else:
|
||||
scope, attrs = (scopeattrs, None)
|
||||
|
||||
int_cmd = InternalGetArray(seq, roffset, coffset, rows, cols, format, thread_id, frame_id, scope, attrs)
|
||||
self.postInternalCommand(int_cmd, thread_id)
|
||||
|
||||
except:
|
||||
|
||||
@@ -971,13 +971,13 @@ from pydevd_vars import getVariable
|
||||
MAXIMUM_ARRAY_SIZE = 300
|
||||
|
||||
class InternalGetArray(InternalThreadCommand):
|
||||
def __init__(self, seq, thread_id, frame_id, scope, name, temp, roffset, coffset, rows, cols, format):
|
||||
def __init__(self, seq, roffset, coffset, rows, cols, format, thread_id, frame_id, scope, attrs):
|
||||
self.sequence = seq
|
||||
self.thread_id = thread_id
|
||||
self.frame_id = frame_id
|
||||
self.scope = scope
|
||||
self.name = name
|
||||
self.temp = temp;
|
||||
self.name = attrs[-1]
|
||||
self.attrs = attrs;
|
||||
self.roffset = int(roffset)
|
||||
self.coffset = int(coffset)
|
||||
self.rows = int(rows)
|
||||
@@ -986,7 +986,7 @@ class InternalGetArray(InternalThreadCommand):
|
||||
|
||||
def doIt(self, dbg):
|
||||
try:
|
||||
var = getVariable(self.thread_id, self.frame_id, self.scope, self.temp)
|
||||
var = getVariable(self.thread_id, self.frame_id, 'EXPRESSION', self.attrs)
|
||||
|
||||
rows = min(self.rows, MAXIMUM_ARRAY_SIZE)
|
||||
cols = min(self.cols, MAXIMUM_ARRAY_SIZE)
|
||||
|
||||
@@ -8,36 +8,45 @@ import com.jetbrains.python.debugger.PyDebuggerException;
|
||||
*/
|
||||
public class GetArrayCommand extends GetFrameCommand {
|
||||
|
||||
private final PyDebugValue myParent;
|
||||
private final String myVariableName;
|
||||
private final int myRowOffset;
|
||||
private final int myColOffset;
|
||||
private final int myRows;
|
||||
private final int myColumns;
|
||||
private final String myFormat;
|
||||
private final String myTempName;
|
||||
private Object[][] myArrayItems;
|
||||
|
||||
public GetArrayCommand(final RemoteDebugger debugger, final String threadId, final String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) {
|
||||
super(debugger, GET_ARRAY, threadId, frameId);
|
||||
myVariableName = var.getName();
|
||||
myTempName = var.getTempName();
|
||||
myVariableName = GetVariableCommand.composeName(var);
|
||||
myRowOffset = rowOffset;
|
||||
myColOffset = colOffset;
|
||||
myRows = rows;
|
||||
myColumns = cols;
|
||||
myFormat = format;
|
||||
myParent = var;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPayload(Payload payload) {
|
||||
super.buildPayload(payload);
|
||||
payload.add(myVariableName);
|
||||
payload.add(myTempName);
|
||||
payload.add(myRowOffset);
|
||||
payload.add(myColOffset);
|
||||
payload.add(myRows);
|
||||
payload.add(myColumns);
|
||||
payload.add(myFormat);
|
||||
|
||||
if (myParent.getVariableLocator() != null) {
|
||||
payload.add(myParent.getVariableLocator().getThreadId()).add(myParent.getVariableLocator().getPyDBLocation());
|
||||
}
|
||||
else if (myVariableName.contains(GetVariableCommand.BY_ID)) {
|
||||
//id instead of frame_id
|
||||
payload.add(getThreadId()).add(myVariableName);
|
||||
}
|
||||
else {
|
||||
super.buildPayload(payload);
|
||||
payload.add(myVariableName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -156,7 +156,6 @@ public class RemoteDebugger implements ProcessDebugger {
|
||||
|
||||
@Override
|
||||
public Object[][] loadArrayItems(String threadId, String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException {
|
||||
setTempVariable(threadId, frameId, var);
|
||||
final GetArrayCommand command = new GetArrayCommand(this, threadId, frameId, var, rowOffset, colOffset, rows, cols, format);
|
||||
command.execute();
|
||||
return command.getArray();
|
||||
|
||||
Reference in New Issue
Block a user