Skip to content

Commit

Permalink
Default GCC debug format to DWARF 4
Browse files Browse the repository at this point in the history
Even the latest GDB release does not correctly support DWARF 5 from GCC,
most notably preprocessor macros. This is a bug in either GCC or GDB and
is present across every platform tested. DWARF 4 works fine, so stick to
it for now.
  • Loading branch information
skeeto committed Sep 8, 2022
1 parent 2557f8c commit 6fff86f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ WORKDIR /bootstrap
RUN ln -s $ARCH mingw

WORKDIR /x-gcc
RUN /gcc-$GCC_VERSION/configure \
COPY src/gcc-*.patch $PREFIX/src/
RUN cat $PREFIX/src/gcc-*.patch | patch -d/gcc-$GCC_VERSION -p1 \
&& /gcc-$GCC_VERSION/configure \
--prefix=/bootstrap \
--with-sysroot=/bootstrap \
--target=$ARCH \
Expand Down
7 changes: 7 additions & 0 deletions src/gcc-000-dwarf4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3290,3 +3290,3 @@
gdwarf-
-Common Driver Joined UInteger Var(dwarf_version) Init(5) Negative(gstabs)
+Common Driver Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs)
Generate debug information in DWARF v2 (or later) format.

0 comments on commit 6fff86f

Please sign in to comment.