From: Guinevere Larsen Date: Mon, 17 Feb 2025 19:43:04 +0000 (-0300) Subject: GDB: add stabs deprecation warning X-Git-Tag: binutils-2_45~1525 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67c2a95af353239e5771000c08126914349043f4;p=thirdparty%2Fbinutils-gdb.git GDB: add stabs deprecation warning Now that stabs is deprecated, we should probably warn our users of it before removing support, so that they have time to react and either make themselves heard, or fix things on their end so that they can still debug their applications. This commit adds a new function that emits a warning whenever GDB does stabs reading. Since there are several places where stabs is re-invented, this warning had to be added to many places, but I think I managed to warn everywhere relevant without duplicating warnings. Also, the test gdb.stabs/weird.exp explicitly checks for GDB warnings when reading stabs, so it had to be updated to account for the deprecation warning. It is done generically, since it will be removed in the next release anyway. Approved-By: Tom Tromey --- diff --git a/gdb/coffread.c b/gdb/coffread.c index abe150de609..c470668f6f6 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -234,6 +234,7 @@ coffstab_build_psymtabs (struct objfile *objfile, const char *name = bfd_get_filename (sym_bfd); unsigned int stabsize; + stabs_deprecated_warning (); /* Allocate struct to keep track of stab reading. */ dbx_objfile_data_key.emplace (objfile); dbx_symfile_info *key = dbx_objfile_data_key.get (objfile); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 4cd721057bc..86e59abaed6 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -110,6 +110,7 @@ dbx_new_init (struct objfile *ignore) { stabsread_new_init (); init_header_files (); + warning (_("The a.out file format is deprecated and will be removed soon.")); } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index fbfe3a70e30..d5a07406ecb 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -2671,7 +2671,10 @@ parse_partial_symbols (minimal_symbol_reader &reader, &sh); if (strcmp (debug_info->ss + fh->issBase + sh.iss, stabs_symbol) == 0) - processing_gcc_compilation = 2; + { + processing_gcc_compilation = 2; + stabs_deprecated_warning (); + } } if (processing_gcc_compilation != 0) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index e4798203fbb..fcc226ebd1f 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2226,6 +2226,8 @@ read_stabs_symtab (struct objfile *objfile, symfile_add_flags symfile_flags) sym_bfd = objfile->obfd.get (); + stabs_deprecated_warning (); + /* .o and .nlm files are relocatables with text, data and bss segs based at 0. This flag disables special (Solaris stabs-in-elf only) fixups for symbols with a value of 0. */ diff --git a/gdb/stabsread.h b/gdb/stabsread.h index a88b593b443..273ceaa7531 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -305,4 +305,10 @@ struct symloc int file_string_offset; enum language pst_language; }; + +static inline void +stabs_deprecated_warning () +{ + warning (_("Stabs support is deprecated and will be removed soon.")); +} #endif /* GDB_STABSREAD_H */ diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp index 70fffb2e862..4d1cd427fd0 100644 --- a/gdb/testsuite/gdb.stabs/weird.exp +++ b/gdb/testsuite/gdb.stabs/weird.exp @@ -293,7 +293,7 @@ gdb_expect 60 { send_gdb "y\n" exp_continue } - -re "^Reading symbols from .*$binfile_re\\.\\.\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" { + -re "^Reading symbols from .*$binfile_re\\.\\.\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n(\[^\\n\]*\n)?$gdb_prompt $" { pass "weirdx.o read without error" } -re ".*$gdb_prompt $" { diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 639dd5b8adc..2ff9d4a1775 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2807,6 +2807,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) if (num_symbols > 0) { + stabs_deprecated_warning (); /* Read the string table. */ init_stringtab (abfd, stringtab_offset, objfile);