diff options
author | Guinevere Larsen <blarsen@redhat.com> | 2024-05-02 13:57:47 -0300 |
---|---|---|
committer | Guinevere Larsen <guinevere@redhat.com> | 2024-10-23 14:16:37 -0300 |
commit | 05eba57965ef17979e3378e7463293fa070ace39 (patch) | |
tree | eb61c5ca1544742bf42454850109e3f0afcc547b | |
parent | 538271a1e0b39d3e39f304413dfd2d6436c95d5c (diff) | |
download | gdb-05eba57965ef17979e3378e7463293fa070ace39.zip gdb-05eba57965ef17979e3378e7463293fa070ace39.tar.gz gdb-05eba57965ef17979e3378e7463293fa070ace39.tar.bz2 |
gdb/testsuite: introduce dwarf5 option to gdb_compile
A few tests on the testsuite require dwarf5 to work. Up until now, the
way to do this was to explicitly add the command line flag -gdwarf-5.
This isn't very portable, in case a compiler requires a different flag
to emit dwarf5.
This commit adds a new option to gdb_compile that would be able to add
the correct flag (if known) or error out in case we are unable to tell
which flag to use. It also changes the existing tests to use this
general option instead of hard coding -gdwarf-5.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/assumedrank.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 8 |
5 files changed, 12 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp index 344c4ab..5078d0c 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp @@ -19,7 +19,7 @@ set opts {} if [info exists COMPILE] { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1" standard_testfile .c .c - lappend opts optimize=-O2 additional_flags=-gdwarf-5 + lappend opts optimize=-O2 dwarf5 } else { require is_x86_64_m64_target } diff --git a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp index a6a99e8..a7ca334 100644 --- a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp +++ b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp @@ -24,8 +24,7 @@ standard_testfile .cc # we let that be the test of whether the target supports it. if { [prepare_for_testing "failed to prepare" "${testfile}" \ - $srcfile {debug c++ additional_flags=-gdwarf-5 \ - additional_flags=-O0}] } { + $srcfile {debug c++ dwarf5 additional_flags=-O0}] } { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp index 540e770..b97b554 100644 --- a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp +++ b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp @@ -17,7 +17,7 @@ standard_testfile set flags {} lappend flags {additional_flags=-fdebug-types-section} -lappend flags {additional_flags=-gdwarf-5} +lappend flags {dwarf5} if { [prepare_for_testing "failed to prepare" ${testfile} \ $srcfile $flags] } { diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp index 957dfef..32fd9d2 100644 --- a/gdb/testsuite/gdb.fortran/assumedrank.exp +++ b/gdb/testsuite/gdb.fortran/assumedrank.exp @@ -28,7 +28,7 @@ if { [test_compiler_info {gfortran-*} f90] && } if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - {debug f90 additional_flags=-gdwarf-5}]} { + {debug f90 dwarf5}]} { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f0a8939..a3aaa5c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5633,6 +5633,7 @@ proc quote_for_host { args } { # - no-build-id: Ensure the final binary does not include a build-id. # - column-info/no-column-info: Enable/Disable generation of column table # information. +# - dwarf5: Force compilation with dwarf-5 debug information. # # And here are some of the not too obscure options understood by DejaGnu that # influence the compilation: @@ -5893,6 +5894,13 @@ proc gdb_compile {source dest type options} { error "Option gno-column-info not supported by compiler." } + } elseif { $opt == "dwarf5" } { + if {[test_compiler_info {gcc-*}] \ + || [test_compiler_info {clang-*}]} { + lappend new_options "additional_flags=-gdwarf-5" + } else { + error "No idea how to force DWARF-5 in this compiler" + } } else { lappend new_options $opt } |