[PATCH 7/7] gdb/testsuite: Handle "symtab" option on windows-msvc

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On windows-msvc, lld-link does not emit a COFF symbol table by
default, even with -debug or -debug:pdb (but does with -debug:dwarf),
so most no-debug-info testcases fail, as they can't run to main, etc.

Handle a "symtab" option request by passing -Wl,-debug:symtab to
lld-link.

Change-Id: Idfd81e80c24dc27f4878a572b8efbea4c4fe9269
---
 gdb/testsuite/lib/gdb.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 084f6ff8358..772f69d9633 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6838,6 +6838,18 @@ proc gdb_compile {source dest type options} {
 	    } else {
 		error "No idea how to force DWARF-5 in this compiler"
 	    }
+	} elseif { $opt == "symtab" } {
+	    if { [istarget "*-*-windows-msvc*"] } {
+		# lld-link does not emit a COFF symbol table by
+		# default, even with -debug or -debug:pdb.  Note
+		# -debug:dwarf implies -debug:symtab, and order does
+		# not matter.  Order matters only when settings
+		# conflict -- e.g., /debug:symtab /debug:nosymtab
+		# leaves symtab off (nosymtab wins, last-applied).
+		lappend new_options "ldflags=-Wl,-debug:symtab"
+	    } else {
+		# All other systems emit a symbol table by default.
+	    }
 	} else {
 	    lappend new_options $opt
 	}
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.