Skip to content

Commit 9f099db

Browse files
committed
add debug process to dlv x value
1 parent 989d5f2 commit 9f099db

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

src/com/goide/dlv/DlvDebugProcess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void consume(@NotNull final DebuggerState o) {
9292
.done(new Consumer<List<DlvApi.Location>>() {
9393
@Override
9494
public void consume(@NotNull List<DlvApi.Location> locations) {
95-
DlvSuspendContext context = new DlvSuspendContext(o.currentThread.id, locations, getProcessor());
95+
DlvSuspendContext context = new DlvSuspendContext(DlvDebugProcess.this, o.currentThread.id, locations, getProcessor());
9696
XDebugSession session = getSession();
9797
if (find == null) {
9898
session.positionReached(context);

src/com/goide/dlv/DlvStackFrame.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@
5050
import java.util.List;
5151

5252
class DlvStackFrame extends XStackFrame {
53+
private final DlvDebugProcess myProcess;
5354
private final DlvApi.Location myLocation;
5455
private final DlvCommandProcessor myProcessor;
5556
private final int myId;
5657

57-
public DlvStackFrame(DlvApi.Location location, DlvCommandProcessor processor, int id) {
58+
public DlvStackFrame(@NotNull DlvDebugProcess process,
59+
@NotNull DlvApi.Location location,
60+
@NotNull DlvCommandProcessor processor,
61+
int id) {
62+
myProcess = process;
5863
myLocation = location;
5964
myProcessor = processor;
6065
myId = id;
@@ -116,7 +121,7 @@ public void run() {
116121

117122
@NotNull
118123
private XValue createXValue(@NotNull DlvApi.Variable variable, @Nullable Icon icon) {
119-
return new DlvXValue(variable, icon, myProcessor, myId);
124+
return new DlvXValue(myProcess, variable, myProcessor, myId, icon);
120125
}
121126

122127
@Nullable

src/com/goide/dlv/DlvSuspendContext.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
class DlvSuspendContext extends XSuspendContext {
3030
@NotNull private final DlvExecutionStack myStack;
3131

32-
public DlvSuspendContext(int threadId, @NotNull List<DlvApi.Location> locations, @NotNull DlvCommandProcessor processor) {
33-
myStack = new DlvExecutionStack(threadId, locations, processor);
32+
public DlvSuspendContext(@NotNull DlvDebugProcess process,
33+
int threadId,
34+
@NotNull List<DlvApi.Location> locations,
35+
@NotNull DlvCommandProcessor processor) {
36+
myStack = new DlvExecutionStack(process, threadId, locations, processor);
3437
}
3538

3639
@Nullable
@@ -46,17 +49,22 @@ public XExecutionStack[] getExecutionStacks() {
4649
}
4750

4851
private static class DlvExecutionStack extends XExecutionStack {
52+
@NotNull private final DlvDebugProcess myProcess;
4953
@NotNull private final List<DlvApi.Location> myLocations;
50-
private final DlvCommandProcessor myProcessor;
54+
@NotNull private final DlvCommandProcessor myProcessor;
5155
@NotNull private final List<DlvStackFrame> myStack;
5256

53-
public DlvExecutionStack(int threadId, @NotNull List<DlvApi.Location> locations, DlvCommandProcessor processor) {
57+
public DlvExecutionStack(@NotNull DlvDebugProcess process,
58+
int threadId,
59+
@NotNull List<DlvApi.Location> locations,
60+
@NotNull DlvCommandProcessor processor) {
5461
super("Thread #" + threadId);
62+
myProcess = process;
5563
myLocations = locations;
5664
myProcessor = processor;
5765
myStack = ContainerUtil.newArrayListWithCapacity(locations.size());
5866
for (int i = 0; i < myLocations.size(); i++) {
59-
myStack.add(new DlvStackFrame(myLocations.get(i), myProcessor, i));
67+
myStack.add(new DlvStackFrame(myProcess, myLocations.get(i), myProcessor, i));
6068
}
6169
}
6270

src/com/goide/dlv/DlvXValue.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ class DlvXValue extends XNamedValue {
3636
@NotNull
3737
private final DlvApi.Variable myVariable;
3838
private final Icon myIcon;
39+
private final DlvDebugProcess myProcess;
3940
private final DlvCommandProcessor myProcessor;
4041
private final int myFrameId;
4142

42-
public DlvXValue(@NotNull DlvApi.Variable variable, Icon icon, DlvCommandProcessor processor, int frameId) {
43+
public DlvXValue(@NotNull DlvDebugProcess process,
44+
@NotNull DlvApi.Variable variable,
45+
@NotNull DlvCommandProcessor processor,
46+
int frameId,
47+
@Nullable Icon icon) {
4348
super(variable.name);
49+
myProcess = process;
4450
myVariable = variable;
4551
myIcon = icon;
4652
myProcessor = processor;
@@ -63,7 +69,7 @@ public void computeChildren(@NotNull XCompositeNode node) {
6369
else {
6470
XValueChildrenList list = new XValueChildrenList();
6571
for (DlvApi.Variable child : children) {
66-
list.add(child.name, new DlvXValue(child, AllIcons.Nodes.Field, myProcessor, myFrameId));
72+
list.add(child.name, new DlvXValue(myProcess, child, myProcessor, myFrameId, AllIcons.Nodes.Field));
6773
}
6874
node.addChildren(list, true);
6975
}

0 commit comments

Comments
 (0)