Re: [PATCH v2 0/8] Remove stabs support from GDB

Simon Marchi
2025-10-23T18:11:37Z

On 10/20/25 11:28 AM, Guinevere Larsen wrote:
> Now that GDB 17 has branched, I think we're ready to remov stabs from
> GDB entirely, and the sooner this is merged, the earlier we'll spot any
> problems and the more time will be there to fix them.
>
> This series does just that.

Hello,

I got another build failure that is likely related to this series. It's
a -Werror=nonnull error, when building with UBSan, but I think it's not
a false positive.

CXX xcoffread.o
/home/smarchi/src/binutils-gdb/gdb/xcoffread.c: In function ‘void enter_line_range(subfile*, unsigned int, unsigned int, CORE_ADDR, CORE_ADDR, unsigned int*)’:
/home/smarchi/src/binutils-gdb/gdb/xcoffread.c:573:44: error: ‘this’ pointer is null [-Werror=nonnull]
573 | addr += objfile->text_section_offset ();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/smarchi/src/binutils-gdb/gdb/xcoffread.c:43:
/home/smarchi/src/binutils-gdb/gdb/objfiles.h:512:13: note: in a call to non-static member function ‘CORE_ADDR objfile::text_section_offset() const’
512 | CORE_ADDR text_section_offset () const
| ^~~~~~~~~~~~~~~~~~~
/home/smarchi/src/binutils-gdb/gdb/xcoffread.c:579:63: error: ‘this’ pointer is null [-Werror=nonnull]
579 | - objfile->text_section_offset ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/smarchi/src/binutils-gdb/gdb/objfiles.h:512:13: note: in a call to non-static member function ‘CORE_ADDR objfile::text_section_offset() const’
512 | CORE_ADDR text_section_offset () const
| ^~~~~~~~~~~~~~~~~~~

The full configure line is:

$ ~/src/binutils-gdb/configure --prefix=/build --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof --disable-gprofng --with-system-readline --with-system-zlib --enable-targets=all --with-expat=yes --with-python=python3 --with-guile --enable-libctf --enable-build-warnings --enable-gdb-building-warnings --enable-unit-tests --enable-ubsan 'CC=ccache gcc' 'CFLAGS=-O2 -g -fsanitize=address ' 'LDFLAGS= -fsanitize=address' 'CXX=ccache g++' 'CXXFLAGS=-O2 -g -fsanitize=address -D_GLIBCXX_DEBUG=1 -Wno-error=array-bounds '

GCC version 15.2.1.

I think it's correctly complaining, because this_symtab_objfile is never
ever set anymore. And neither is this_symtab_psymtab. I realized this
when trying to refactor the code to remove these globals, trying to pass
them as parameters instead.

Simon