svaante / dape

Debug Adapter Protocol for Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configuration for debugging inside container accessed with TRAMP

nasseralkmim opened this issue · comments

Hi,

I would like to run the debugger inside a container (apptainer) after accessing the container with TRAMP.

I saw the other thread regarding rdbg, but I could not figure out the configuration for a simple c++ file.

How to reproduce

Inside a container sandbox (directory of the container) I create a cpp file:

include <iostream>

int main (int argc, char* argv[])
{
  int i = 1;
  std::cout << "hello" << i;
}

I installed the debugger adapter inside the container as in the readme.
Then I run dape while accessing the source code with TRAMP with the config:

cpptools command-cwd "/apptainer:ubuntu:/script/" :program "script/build/app"

And I get a timed-out error:

* Command initialize timed out after 10 seconds, the timeout period is configurable with `dape-request-timeout' *
Initialize failed due to: Request timeout
* Command disconnect timed out after 10 seconds, the timeout period is configurable with `dape-request-timeout' *
Adapter connection shutdown without successfully initializing
Configuration:
  modes (c-mode c-ts-mode c++-mode c++-ts-mode)
  ensure dape-ensure-command
  command-cwd "/apptainer:ubuntu:/script/"
  command "~/.emacs.d/debug-adapters/cpptools/extension/debugAdapters/bin/OpenDebugAD7"
  :type "cppdbg"
  :request "launch"
  :cwd "."
  :program "script/build/app"
  :MIMode "gdb"
  prefix-local "/apptainer:ubuntu:"

From the container I can access the OpenDebugAD7 with the specified path.

Am I missing something?

I can give a recipe to create the container if needed.

I managed to make it work, by using pipeTransport option. Without the need for accessing the file with TRAMP.

((c++-mode . ((dape-command . (cpptools
                               :program "/script/build/app"
                               :pipeTransport (:pipeProgram "apptainer" :pipeArgs ["exec" "instance://ubuntu" "sh" "-c"]))))))