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

Is it possible to support gdb #149

Open
elliott10 opened this issue Apr 28, 2022 · 4 comments
Open

Is it possible to support gdb #149

elliott10 opened this issue Apr 28, 2022 · 4 comments

Comments

@elliott10
Copy link

Is it possible to support gdb?
GDB is very useful.
Like: https://github.com/riscv-collab/riscv-binutils-gdb

@elliott10 elliott10 changed the title Is it possible to support gdb, this is very useful Is it possible to support gdb Apr 28, 2022
@jsommr
Copy link

jsommr commented May 16, 2022

I have compiled gdb this way:

git clone https://github.com/richfelker/musl-cross-make.git

cat >musl-cross-make/config.mak <<EOF
TARGET=i686-linux-musl
MUSL_VER=git-v1.2.2
GCC_VER=10.3.0
# Not needed libs
COMMON_CONFIG += --disable-nls
EOF

make --directory musl-cross-make -j$(nproc)
make --directory musl-cross-make install

mkdir gdb
wget https://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz --output-document -  \
| tar -xz --strip-components 1 --directory gdb
(cd gdb &&  \
 PATH=$PATH:$PWD/../musl-cross-make/output/bin   \
 ./configure  \
     --prefix=$PWD/output  \
     --host=i686-linux-musl  \
     --disable-nls  \
     --with-curses)

PATH=$PATH:$PWD/musl-cross-make/output/bin make --directory gdb -j$(nproc)
PATH=$PATH:$PWD/musl-cross-make/output/bin make --directory gdb install

Don't know if this answers your question.

@elliott10
Copy link
Author

elliott10 commented May 22, 2022

I have compiled gdb this way:

git clone https://github.com/richfelker/musl-cross-make.git

cat >musl-cross-make/config.mak <<EOF
TARGET=i686-linux-musl
MUSL_VER=git-v1.2.2
GCC_VER=10.3.0
# Not needed libs
COMMON_CONFIG += --disable-nls
EOF

make --directory musl-cross-make -j$(nproc)
make --directory musl-cross-make install

mkdir gdb
wget https://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz --output-document -  \
| tar -xz --strip-components 1 --directory gdb
(cd gdb &&  \
 PATH=$PATH:$PWD/../musl-cross-make/output/bin   \
 ./configure  \
     --prefix=$PWD/output  \
     --host=i686-linux-musl  \
     --disable-nls  \
     --with-curses)

PATH=$PATH:$PWD/musl-cross-make/output/bin make --directory gdb -j$(nproc)
PATH=$PATH:$PWD/musl-cross-make/output/bin make --directory gdb install

Don't know if this answers your question.

Thank you ! It is very useful.

And I tried like this:

  • Firstly, Building out a specific arch(eg. riscv64) cross-compilation tool chain by richfelker/musl-cross-make
  • Secondly, Download gdb source file, and unzip the ziped file.
  • And then, Configure the gdb and build:
cd gdb-source-code
./configure --target=riscv64-linux-musl --prefix=$PWD/install
make
make install

@jsommr
Copy link

jsommr commented May 22, 2022

The snippet in my answer is from a longer article. If you are still unable to get gdb working, perhaps the section on "Debugging" could be of interest to you: https://ja.nsommer.dk/articles/linux-and-tiny-c-compiler-in-the-browser-part-one.html

@elliott10
Copy link
Author

The snippet in my answer is from a longer article. If you are still unable to get gdb working, perhaps the section on "Debugging" could be of interest to you: https://ja.nsommer.dk/articles/linux-and-tiny-c-compiler-in-the-browser-part-one.html

My homebrew cross-compiled gdb works well.
Thank you for your article, nerfpops! Running Tiny C Compiler in browser is absolutely cool :)

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

2 participants