Anyone with experience implementing a debugger that may have run into this issue?

I have been working on a debugger for my custom language, well I have it working more or less except that the watches that the user sets do not get updated unless I click on the "Go to source position" or click on another stack frame.

Here is a screencast showing exactly how it is behaving.

http://www.screencast.com/t/D0n6HW6KL

9 comments
Comment actions Permalink

Are you sure that you always call XEvaluationCallback#evaluated method from your implementation of XDebuggerEvaluator#evaluate?

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Yes. I have double checked to be sure. The only thing I can think of is that its some sort of race condition, since I fetch the data on a background thread.

0
Comment actions Permalink

You can try to debug the problem yourself. The sources of xdebugger-impl module is available in the community edition of IDEA. Method 'evaluate' for
watches is called from WatchesRootNode#updateWatches. When you call XEvaluationCallback#evaluated it invokes WatchesRootNode#replaceNode to replace 'a
= ...' text by the evaluated value of the watched expression.

Yes. I have double checked to be sure. The only thing I can think of is that its some sort of race condition, since the data is fetched on a background thread.

>

---
Original message URL: http://devnet.jetbrains.net/message/5304030#5304030



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

It appears that the 2 events  FRAME_CHANGED and PAUSED both fire for every step + breakpoint hit. Both events cause the watches to be updated. The second update erases the object reference that is needed to know which watch is being updated. Each time the watch list is updated all the tree nodes are thrown out.

I only respond to the first update, and by the time i reply to it, another update has occured. This sounds like enough info to work around the issue. I can just queue up the watch refreshes, however ill be evaluating the watches 2x for each step/breakpoint.

0
Comment actions Permalink

Normally only PAUSED event should be fired on suspend. FRAME_CHANGED event is fired only if current frame is actually changed (see
XDebugSessionImpl#setCurrentStackFrame). myCurrentStackFrame field is initialized in XDebugSessionImpl#positionReached.
May be you return different instances from XExecutionStack#getTopFrame method so IDEA thinks that stack frame is changed.

It appears that the 2 events  FRAME_CHANGED and PAUSED both fire for every step + breakpoint hit. Both events cause the watches to be updated. The second update erases the object reference that is needed to know which watch is being updated. Each time the watch list is updated all the tree nodes are thrown out.

>

I only respond to the first update, and by the time i reply to it, another update has occured. This sounds like enough info to work around the issue. I can just queue up the watch refreshes, however ill be evaluating the watches 2x for each step/breakpoint.

>

---
Original message URL: http://devnet.jetbrains.net/message/5304373#5304373



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

I do. I create the stack frames every time as new objects. I didn't realize that would have other ramifications. That must be the problem!

0
Comment actions Permalink

I'll still have this problem when I step into a function though, right. My top frame will change so I'll get 2 events in that case.

It seems like you shouldn't fire FRAME_CHANGED when they are set during processing of a PAUSED event.

0
Comment actions Permalink

I didn't mean that getTopFrame() method should return the same instance after step action. I only mean that subsequent calls to getTopFrame() method
of the same XExecutionStack object should return the same instance.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Hrm. Ok. I know that I only create the stack frames once (at the breakpoint hit). I'll look into it some more. It just seems wierd that both events fire at what seems to be the same time. It's like clearing the stack frame causes the event, then the paused follows, or that the paused event actually causes the frame changed event. I'm not sure - it could very well be something I am doing too.

I'll double check everything again.

0

Please sign in to leave a comment.