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

GDB support broken in minimal docker container #1113

Open
Baltoli opened this issue Jul 22, 2024 · 4 comments
Open

GDB support broken in minimal docker container #1113

Baltoli opened this issue Jul 22, 2024 · 4 comments

Comments

@Baltoli
Copy link
Contributor

Baltoli commented Jul 22, 2024

Reported on Discord

Hi, I'm also having some trouble with the debugger. I am trying to get the debugger working in a clean Docker environment with only gdb installed.

FROM runtimeverificationinc/kframework-k:ubuntu-jammy-7.1.70

RUN apt-get update && \
    apt-get install -y gdb && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
RUN echo "set auto-load safe-path /" >> /root/.gdbinit

RUN mkdir -p /workspace
WORKDIR /workspace

I compile and run the program as follows:

$ kompile --backend llvm --enable-llvm-debug test.k
$ krun testfile --debugger

However, I couldn't start or step through the program in gdb:

(gdb) k start
Temporary breakpoint 1 at 0x7be20
Starting program: /workspace/test-kompiled/interpreter /tmp/.krun-2024-07-21-18-01-21-7HhvVMBifn/tmp.in.9ow8yaJKOg -1 /tmp/.krun-2024-07-21-18-01-21-7HhvVMBifn/result.kore
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, 0x00005632fa85ae20 in main ()
Python Exception <class 'gdb.error'>: No source file named definition.kore.
Error occurred in Python: No source file named definition.kore.
@pxhdev
Copy link

pxhdev commented Jul 22, 2024

Actually, it is not broken only in the minimal Docker container. I tried it on my local host first (Ubuntu 22.04) and encountered the same error. I thought it might be incompatible dependencies, so I tried this minimal container, but it didn't work either. I hope this extra information is helpful.

@Baltoli
Copy link
Contributor Author

Baltoli commented Jul 22, 2024

Thanks for the additional info; we'll take a look at this for you!

@Robertorosmaninho
Copy link
Collaborator

This is an error related to the -g flag. We're not passing it appropriately to clang. I saw this same error here: #858
If you execute kompile --verbose ..., copy and paste the llvm-kompile command and append -g after the --, you'll be able to open the debugger as expected.

@pxhdev
Copy link

pxhdev commented Jul 22, 2024

This is an error related to the -g flag. We're not passing it appropriately to clang. I saw this same error here: #858 If you execute kompile --verbose ..., copy and paste the llvm-kompile command and append -g after the --, you'll be able to open the debugger as expected.

It worked! Really appreciate the help!

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

3 participants