gdb: Remove stabs support from XCOFF inferiors

This commit is the second to last in the series fully removing support
for stabs in GDB, removing it from XCOFF inferiors.  According to IBM's
AIX documentation[1], xcoff binaries can only have stabs or DWARF debug
info, meaning removing stabs seems pretty trivial, as anything that
isn't related to setting base information on the objfile or reading
dwarf can be removed.

The unfortunate part of this removal is that XCOFF minimal symbols are
encoded in stabs, so if an inferior has not been compiled with dwarf
debuginfo, GDB will only be able to do assembly-level debugging.  Due to
this, the xcoff reader now emits a warning if no dwarf is read, saying:
"No usable debug information found".  This change would also add a lot of
regressions to to AIX, so the gdb_compile proc has been changed to not
work when a test tries to compile a test with nodebug.

As a sidenote, gdb-stabs.h can just be removed from rs6000-aix-nat, as
none of the structs or macros defined in the header are used in the nat
file, so that is an unnecessary include.

This commit introduces some known regressions when testing GDB in AIX
systems.  The main ones are:
* inferior function calls now crash with a corrupted stack.  This seems
  to be some fault of dwarf in explaining how to correctly set the frame
  for a function.
* fortran tests can't runto_main: the fortran compiler does not add any
  symbol for MAIN__ in the dwarf information, only in stabs, so the
  fortran_runto_main proc can't set the breakpoint correctly.
* When dealing with c++ class methods, there are cases when we fail to
  properly recognize a method call as a new function.
* When dealing with c++ virtual inheritance, GDB has issues finding a
  derived class's members when it has been downcast to a base class.

[1] https://www.ibm.com/docs/en/aix/7.3?topic=formats-xcoff-object-file-format

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Guinevere Larsen
2025-01-29 09:31:03 -03:00
parent 3ae51cfeb7
commit 1dfd89c739
3 changed files with 14 additions and 2007 deletions

View File

@@ -23,7 +23,6 @@
#include "symfile.h"
#include "objfiles.h"
#include "bfd.h"
#include "gdb-stabs.h"
#include "regcache.h"
#include "arch-utils.h"
#include "inf-child.h"

View File

@@ -6132,6 +6132,12 @@ proc gdb_compile {source dest type options} {
set outdir [file dirname $dest]
# GDB doesn't support minimal symbols in AIX, so fail the compilation
# if nodebug is requested for an AIX target.
if { [istarget *-*-aix*] && [lsearch -exact $options nodebug] != -1} {
return "minsyms not supported in AIX"
}
# If this is set, calling test_compiler_info will cause recursion.
if { [lsearch -exact $options getting_compiler_info] == -1 } {
set getting_compiler_info false

File diff suppressed because it is too large Load Diff