Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dap-ui-debug-window: Symbol’s function definition is void: debug-window-mode #8

Closed
skybert opened this issue Sep 12, 2018 · 2 comments

Comments

@skybert
Copy link

skybert commented Sep 12, 2018

Have a remote debug session against Tomcat going, dap stops at my break point and I can see the locals with dap-ui-locals. So far so good.

However, I'd like to see the threads so that I can step back in the call stack, I therefore tried out the different dap-ui-* methods in the hope that one of these would give me the thread view I'm familiar with from other IDEs, however:

M-x dap-ui-debug-window

yielded only:

dap-ui-debug-window: Symbol’s function definition is void: debug-window-mode

On a related question: I would expect dap-mode to open default/configure dap-ui windows either when you first call dap-debug or at the latest, when the code hits a breakpoint. Right now, I'm fumbling a bit in the dark.

Versions:

GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-04-25
dap-mode-20180911.1835 
lsp-mode-20180911.1829 
lsp-ui-20180910.328
@skybert
Copy link
Author

skybert commented Sep 12, 2018

Regarding the dap-ui-session window: it does give me threads, but the current one, the one that's being suspended/debugged isn't highlighted. Also, when I hit RET on any of these, I get this error in *Messages*:

Error running timer ‘dap-ui-sessions--refresh’: (error "Marker points into wrong buffer" #<marker in no buffer>)

@yyoncho
Copy link
Member

yyoncho commented Sep 12, 2018

I have pushed a fix for the sessions, you may eval the function bellow or wait for the melpa. The handling for missing sources was broken after python integration.

dap-ui-debug-window was leftoever function, it was renamed to dap-ui-repl and moved to dap-ui-repl .

(defun dap-ui--stack-frames (thread-tree)
  "Method for expanding stackframe content.

THREAD-TREE will be widget element holding thread info."
  (let* ((session (widget-get thread-tree :session))
         (thread (widget-get thread-tree :thread))
         (thread-id (gethash "id" thread))
         (stack-frames (gethash thread-id (dap--debug-session-thread-stack-frames session))))
    (if stack-frames
        ;; aldready loaded
        (mapcar (-lambda ((stack-frame &as &hash "name" "line" "source"))
                  (let ((tag (if source
                                 (format "%s (%s:%s)"
                                         name
                                         (or (gethash "name" source)
                                             (gethash "path" source))
                                         line)
                               (format "%s (Unknown source)" name))))
                    `(tree-widget :tag ,tag
                                  :format "%[%t%]\n"
                                  :stack-frame ,stack-frame
                                  :session ,session
                                  :element-type :stack-frame
                                  :thread ,thread
                                  :dynargs dap-ui--stack-frames
                                  :open nil)))
                stack-frames)
      (when (and (string= (gethash thread-id (dap--debug-session-thread-states session)) "stopped")
                 (widget-get thread-tree :loading))
        (widget-put thread-tree :loading t)
        (dap--send-message
         (dap--make-request "stackTrace"
                            (list :threadId thread-id))
         (dap--resp-handler
          (lambda (stack-frames-resp)
            (with-current-buffer dap-ui--sessions-buffer
              (let ((stack-frames (or (-some->> stack-frames-resp
                                                (gethash "body")
                                                (gethash "stackFrames"))
                                      (vector))))
                (puthash thread-id
                         stack-frames
                         (dap--debug-session-thread-stack-frames session))

                (tree-mode-reflesh-tree thread-tree)
                (run-hook-with-args 'dap-ui-stack-frames-loaded session stack-frames)))))
         session)))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants