ghdl / docker

Scripts to build and use docker images including GHDL
40 stars 10 forks source link

Add image to debug GHDL and/or binaries generate with GHDL #25

Closed eine closed 3 years ago

eine commented 4 years ago

Add a docker image which includes GHDL ready for debug (i.e., compiled with -g and including gdb in the image).

seanybaggins commented 4 years ago

I managed to get the gtk gui running on a Linux environment by using this blog post.

Note: I did not have to make any changes to the docker image ghdl/ext:latest

eine commented 4 years ago

Hi @seanybaggins! I suggest to use mviereck/x11docker if you want to run GUI apps in docker/podman containers. It works on GNU/Linux and Windows 10 (Cygwin, WSL or MSYS2). See https://github.com/ghdl/docker/blob/master/USE_CASES.md#environments-with-guis Note that it is the same you did manually, but with an script that handles it for you.

BTW, if you use VSCode, image ghdl/ext:latest includes the Language Server extension from ghdl/ghdl-language-server.

seanybaggins commented 4 years ago

Hi @eine . Thanks for the tips. I originally tried using x11docker but had issues getting x11docker to use the working directory I wanted and/or having it block on startup.

I also have VSCode installed with the docker extention. Perhaps my understanding of the ghdl-language-server is incorrect but how would the ghdl-language-server help with running gui applications?

eine commented 4 years ago

Hi @eine . Thanks for the tips. I originally tried using x11docker but had issues getting x11docker to use the working directory I wanted and/or having it block on startup.

Note that x11docker supports passing raw arguments to docker. For example:

x11docker -i --user=0 -- -v $(pwd):/src -- ghdl/ext bash

In this case -i --user=0 are arguments processed by x11docker, but -v $(pwd):/src is interpreted by docker. Hence, regardless of x11docker's custom options, you can use -v, -p, etc. as usual.

I also have VSCode installed with the docker extention. Perhaps my understanding of the ghdl-language-server is incorrect but how would the ghdl-language-server help with running gui applications?

Your understading is correct, ghdl-language-server has nothing to do with running GUI applications. The point is that ghdl-language-server depends on GHDL. Therefore, you cannot use the language server extension on the host, without installing GHDL there. At first, you might think that you cannot use the language server because of this. However, a motivation to use the docker image in first place, is precisely to avoid installing the tools on the host. I just wanted to let you know that you can follow this same approach to use the language server inside the container.

If you start image ghdl/ext:latest, execute /opt/ghdl/install_vsix.sh inside the container and then "attach" from VSCode, you will find that in the attached VSCode window you have VHDL syntax highlighting and other language server features. However, the extension won't be available in the VSCode windows that are being executed on the host.

eine commented 3 years ago

Images ghdl/debug:base and ghdl/debug are provided now. See the updated README.