emacs-lsp / dap-mode

Emacs :heart: Debug Adapter Protocol
https://emacs-lsp.github.io/dap-mode
GNU General Public License v3.0
1.29k stars 181 forks source link

error in process sentinel: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil #796

Open vibrys opened 2 months ago

vibrys commented 2 months ago

after M-x dap-debug is called on launch.json file below, I get following error:

error in process sentinel: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil
error in process sentinel: Wrong type argument: markerp, nil
error in process filter: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil
error in process filter: Wrong type argument: markerp, nil

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "sample.py performance",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/bin/sample.py",
            "args": [
                "-p", "performance", "-i", "Mul_0", "-m", "entry.xml", "-w", "entry.bin", "-f", "outsset", "-d", "./", "-o", "/tmp", "--subset_size=1000000", "--log-level", "ERROR"
            ],
            "stopAtEntry": false,
            "cwd": "${env:HOME}/scripts/plugin/",
            "environment": [],
            "externalConsole": false,
        },
    ]
}

then, here's the stacktrace with M-x toggle-debug-on-error:

Debugger entered--Lisp error: (wrong-type-argument markerp nil)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_58>(((:point 11697)))
  dap--buffers-w-breakpoints()
  dap--refresh-breakpoints()
  dap--mark-session-as-terminated(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t))
  #f(compiled-function (process exit-str) #<bytecode -0x1857d8c9325df07e>)(#<process sample.py performance> "killed\n")
  delete-process(#<process sample.py performance>)
  dap--mark-session-as-terminated(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t))
  dap--on-event(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t) #<hash-table equal 4/65 0x15643c12e7f5>)
  #f(compiled-function (m) #<bytecode 0x1639bf1112e79c43>)("{\"seq\": 22, \"type\": \"event\", \"event\": \"exited\", \"b...")
  mapc(#f(compiled-function (m) #<bytecode 0x1639bf1112e79c43>) ("{\"seq\": 22, \"type\": \"event\", \"event\": \"exited\", \"b..." "{\"seq\": 23, \"type\": \"event\", \"event\": \"terminated\"..." "{\"seq\": 24, \"type\": \"event\", \"event\": \"debugpySock..."))
  #f(compiled-function (_ msg) #<bytecode 0x11af92a94cd1f1be>)(#<process sample.py performance> "Content-Length: 72\15\n\15\n{\"seq\": 22, \"type\": \"event\",...")

versions are:

elpa/29.4/develop/dap-mode-20240611.1356
elpa/29.4/develop/lsp-mode-20240701.633

please help

kind regards, Matt

hariseldon78 commented 1 month ago

it happens even without a launch.json, chosing instead a template like this:

(dap-register-debug-template
  "LLDB::Run task"
  (list :type "lldb-vscode"
        :cwd "."
        :request "launch"
        :program "./task"
        :name "LLDB::Run"))
hariseldon78 commented 1 month ago

at first inspection it seems related to this commit: https://github.com/emacs-lsp/dap-mode/commit/ed360fda01c75d7493d48ae750d4786fa78a34e3 . I'll try rolling back dap-mode version before it and see if it works.

hariseldon78 commented 1 month ago

Yes, rolling back to the previous commit actually solve the problem. @sfavazza and @sfavazza-duagon do you guys have any insight on what could be the issue? or how could i help you debug the problem?

sfavazza commented 1 month ago

I am not sure what it could be, I cannot reproduce it. I am sure @vibrys tried the latest package version. I checked it myself and I did not observed changes in the code affecting my contribution. Judging from the code the most probable cause of error I can think of is a change in the object returned by dap--get-breakpoints which might lead to a nil value.

I suggest you step-debug through it and see when exactly the markerp function is provided with a nil value.

hariseldon78 commented 1 month ago

So, I am not sure about what triggered this, but after restoring the old package version (20240611.1356) and running an "Update packages" (i'm running the spacemacs distribution) everything seems to work, it only gives me that error if i don't set a breakpoint in the source code (understandable). Maybe I could just add a clarifying message, if I'm able to debug it better i'll post a little PR.

hariseldon78 commented 1 month ago

if I'm able to debug it better i'll post a little PR.

Sorry, it seems that debugging the debugger is a bit too far from my skill set. Still a better error message would probably be a good idea.