Home | History | Annotate | Line # | Download | only in gdb.base
      1  1.1  christos # Copyright 2024 Free Software Foundation, Inc.
      2  1.1  christos 
      3  1.1  christos # This program is free software; you can redistribute it and/or modify
      4  1.1  christos # it under the terms of the GNU General Public License as published by
      5  1.1  christos # the Free Software Foundation; either version 3 of the License, or
      6  1.1  christos # (at your option) any later version.
      7  1.1  christos #
      8  1.1  christos # This program is distributed in the hope that it will be useful,
      9  1.1  christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  1.1  christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  1.1  christos # GNU General Public License for more details.
     12  1.1  christos #
     13  1.1  christos # You should have received a copy of the GNU General Public License
     14  1.1  christos # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     15  1.1  christos 
     16  1.1  christos # Gcc 14 is the first release containing the fix for PR debug/111409.
     17  1.1  christos require {expr [gcc_major_version] >= 14}
     18  1.1  christos 
     19  1.1  christos standard_testfile .c -2.c
     20  1.1  christos 
     21  1.1  christos proc do_tests { dwarf_version dwarf_bits strict_dwarf } {
     22  1.1  christos     set opts {}
     23  1.1  christos     lappend opts debug
     24  1.1  christos     lappend opts quiet
     25  1.1  christos     lappend opts additional_flags=-gsplit-dwarf
     26  1.1  christos     lappend opts macros
     27  1.1  christos 
     28  1.1  christos     if { $dwarf_bits == 64 } {
     29  1.1  christos 	lappend opts additional_flags=-gdwarf64
     30  1.1  christos     }
     31  1.1  christos 
     32  1.1  christos     if { $strict_dwarf } {
     33  1.1  christos 	lappend opts additional_flags=-gstrict-dwarf
     34  1.1  christos     }
     35  1.1  christos 
     36  1.1  christos     lappend opts additional_flags=-gdwarf-$dwarf_version
     37  1.1  christos 
     38  1.1  christos     set id v$dwarf_version-b$dwarf_bits-s$strict_dwarf
     39  1.1  christos 
     40  1.1  christos     set srcfiles [list $::srcfile $::srcfile2]
     41  1.1  christos     if { [build_executable "failed to prepare" $::testfile-$id $srcfiles $opts] } {
     42  1.1  christos 	return -1
     43  1.1  christos     }
     44  1.1  christos 
     45  1.1  christos     clean_restart
     46  1.1  christos 
     47  1.1  christos     gdb_load_no_complaints $::binfile-$id
     48  1.1  christos 
     49  1.1  christos     if {![runto_main]} {
     50  1.1  christos 	return 0
     51  1.1  christos     }
     52  1.1  christos 
     53  1.1  christos     gdb_test "p FIRST" " = 1"
     54  1.1  christos     gdb_test "p SECOND" " = 2"
     55  1.1  christos 
     56  1.1  christos     gdb_test "info macro FIRST" "#define FIRST 1"
     57  1.1  christos     gdb_test "info macro SECOND" "#define SECOND 2"
     58  1.1  christos 
     59  1.1  christos     gdb_breakpoint foo
     60  1.1  christos     gdb_continue_to_breakpoint "foo"
     61  1.1  christos 
     62  1.1  christos     gdb_test "p THIRD" " = 3"
     63  1.1  christos     gdb_test "p FOURTH" " = 4"
     64  1.1  christos 
     65  1.1  christos     gdb_test "info macro THIRD" "#define THIRD 3"
     66  1.1  christos     gdb_test "info macro FOURTH" "#define FOURTH 4"
     67  1.1  christos }
     68  1.1  christos 
     69  1.1  christos foreach_with_prefix dwarf_version {5} {
     70  1.1  christos     foreach_with_prefix dwarf_bits {32} {
     71  1.1  christos 	foreach_with_prefix strict_dwarf {0 1} {
     72  1.1  christos 	    do_tests $dwarf_version $dwarf_bits $strict_dwarf
     73  1.1  christos 	}
     74  1.1  christos     }
     75  1.1  christos }
     76