dap-mode icon indicating copy to clipboard operation
dap-mode copied to clipboard

dap-lldb: Wrong type argument

Open tastytea opened this issue 4 years ago • 8 comments

I'm trying to debug a C++-project with lldb-vscode, but all I get is if: Wrong type argument: stringp, nil in the *Messages* buffer after running dap-debug . When I run dap-debug with my real config (not the minimal init.el from below), I get apply: Wrong type argument: stringp, nil.

Configuration

GNU Emacs 27.2, all packages freshly upgraded to the newest VCS versions. lldb version 12.0.0 (was the same with 11) OS: Gentoo Linux

Minimal init.el

;; Bootstrap straight.
(customize-set-variable 'straight-repository-branch "master")
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el"
                         user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(require 'straight)

(straight-use-package 'dap-mode)
(customize-set-variable 'dap-lldb-debug-program "/usr/bin/lldb-vscode")
(require 'dap-lldb)

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug with lldb",
            "type": "lldb-vscode",
            "request": "launch",
            "program": "${workspaceFolder}/build/src/epubgrep",
            "args": ["test", "tests/test.epub3"],
            "cwd": "${workspaceFolder}",
            "environment": [],
            "stopAtEntry": false,
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ]
}

tastytea avatar Jun 28 '21 22:06 tastytea

Here is a minimal C++-project to reproduce the issue: daptest.tar.gz. Run cmake -S . -B build followed by cmake --build build and then M-x dap-debug.

tastytea avatar Jul 03 '21 23:07 tastytea

Hi guys. I have similar issue with gdb (doom-emacs/Linux)

TypeError: Cannot read property '1' of null
    at Object.parseMI (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/backend/mi_parse.js:262:46)
    at /home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/backend/mi2/mi2.js:327:43
    at Array.forEach (<anonymous>)
    at MI2.onOutput (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/backend/mi2/mi2.js:321:15)
    at MI2.stdout (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/backend/mi2/mi2.js:282:18)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

and dap-debug fails with the default configuration

  Warning (emacs): Initialize request failed: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
     at new NodeError (internal/errors.js:322:7)
     at validateString (internal/validators.js:124:11)
     at Object.isAbsolute (path.js:1133:5)
     at MI2.load (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/backend/mi2/mi2.js:66:25)
     at GDBDebugSession.launchRequest (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js:67:29)
     at GDBDebugSession.dispatchRequest (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/node_modules/vscode-debugadapter/lib/debugSession.js:366:22)
     at GDBDebugSession.handleMessage (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/node_modules/vscode-debugadapter/lib/protocol.js:61:18)
     at GDBDebugSession._handleData (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/node_modules/vscode-debugadapter/lib/protocol.js:155:34)
     at Socket.<anonymous> (/home/user/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/node_modules/vscode-debugadapter/lib/protocol.js:80:44)
     at Socket.emit (events.js:400:28)

Debug session process exited with status: killed

myrgy avatar Nov 06 '21 23:11 myrgy

Most likely delated to the discussion at https://github.com/emacs-lsp/dap-mode/pull/529

yyoncho avatar Nov 07 '21 06:11 yyoncho

Should this be fixed since the PR was reverted?

bbigras avatar Nov 30 '21 22:11 bbigras

I am also having this problem, even though I just recently copied the latest version of the repo into the melpa package location on my machine. Any tips on resolving it?

lucasmyers97 avatar Jan 03 '22 17:01 lucasmyers97

I have the same problem with dlv for golang

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  #<subr make-process>(:name "Launch myproject" :connection-type pipe :coding no-conversion :command "/home/user/go/bin/dlv" :stderr "*Launch myproject stderr*" :noquery t)
  apply(#<subr make-process> (:name "Launch myproject" :connection-type pipe :coding no-conversion :command "/home/user/go/bin/dlv" :stderr "*Launch myproject stderr*" :noquery t))
  make-process--with-editor-process-filter(#<subr make-process> :name "Launch myproject" :connection-type pipe :coding no-conversion :command "/home/user/go/bin/dlv" :stderr "*Launch myproject stderr*" :noquery t)
  apply(make-process--with-editor-process-filter #<subr make-process> (:name "Launch myproject" :connection-type pipe :coding no-conversion :command "/home/user/go/bin/dlv" :stderr "*Launch myproject stderr*" :noquery t))
  make-process(:name "Launch myproject" :connection-type pipe :coding no-conversion :command "/home/user/go/bin/dlv" :stderr "*Launch myproject stderr*" :noquery t)
  dap--create-session((:name "Launch myproject" :type "go" :request "launch" :mode "debug" :program "/home/user/dev/myproject/cmd/server/main.go" :env (:CONF_PATH "/home/user/dev/myproject/configs/local/config.ya...") :args [""] :dap-server-path "/home/user/go/bin/dlv" :dlvToolPath "/home/user/go/bin/dlv" :packagePathToGoModPathMap #<hash-table equal 1/65 0x156be7d299d9>))
  dap-start-debugging-noexpand((:name "Launch myproject" :type "go" :request "launch" :mode "debug" :program "/home/user/dev/myproject/cmd/server/main.go" :env (:CONF_PATH "/home/user/dev/myproject/configs/local/config.ya...") :args [""] :dap-server-path "/home/user/go/bin/dlv" :dlvToolPath "/home/user/go/bin/dlv" :packagePathToGoModPathMap #<hash-table equal 1/65 0x156be7d299d9>))
  #f(compiled-function () #<bytecode -0xaed55c7d844ee12>)()
  dap-debug((:name "Launch myproject" :type "go" :request "launch" :mode "auto" :program "${workspaceFolder}/cmd/server/main.go" :env (:CON_CONF_PATH "${workspaceFolder}/configs/local/config.yaml") :args [""]))
  funcall-interactively(dap-debug (:name "Launch myproject" :type "go" :request "launch" :mode "auto" :program "${workspaceFolder}/cmd/server/main.go" :env (:CONF_PATH "${workspaceFolder}/configs/local/config.yaml") :args [""]))
  call-interactively(dap-debug nil nil)
  command-execute(dap-debug)

UPD: I solved the problem by removing the "+lsp" (debugger +lsp) file init.el of my Doom Emacs

mrOwner avatar May 28 '22 20:05 mrOwner