Home | History | Annotate | Line # | Download | only in gdb.dwarf2
dw2-line-number-zero.exp revision 1.1.1.4
      1  1.1.1.3  christos # Copyright 2020-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 load_lib dwarf.exp
     16      1.1  christos 
     17      1.1  christos # This test can only be run on targets which support DWARF-2 and use gas.
     18  1.1.1.3  christos require dwarf2_support
     19      1.1  christos 
     20      1.1  christos # The .c files use __attribute__.
     21  1.1.1.3  christos require is_c_compiler_gcc
     22      1.1  christos 
     23  1.1.1.2  christos standard_testfile .c -dw.S
     24      1.1  christos 
     25      1.1  christos set asm_file [standard_output_file $srcfile2]
     26      1.1  christos Dwarf::assemble $asm_file {
     27      1.1  christos     declare_labels Llines
     28      1.1  christos     global srcdir subdir srcfile
     29      1.1  christos 
     30  1.1.1.3  christos     get_func_info bar1
     31  1.1.1.3  christos     get_func_info bar2
     32  1.1.1.3  christos 
     33      1.1  christos     cu {} {
     34      1.1  christos 	compile_unit {
     35      1.1  christos 	    {language @DW_LANG_C}
     36      1.1  christos 	    {name dw2-line-number-zero.c}
     37      1.1  christos 	    {stmt_list $Llines DW_FORM_sec_offset}
     38      1.1  christos 	} {
     39      1.1  christos 	    subprogram {
     40      1.1  christos 		{external 1 flag}
     41      1.1  christos 		{MACRO_AT_func {main}}
     42      1.1  christos 	    }
     43      1.1  christos 	    subprogram {
     44      1.1  christos 		{external 1 flag}
     45      1.1  christos 		{MACRO_AT_func {bar1}}
     46      1.1  christos 	    }
     47      1.1  christos 	    subprogram {
     48      1.1  christos 		{external 1 flag}
     49      1.1  christos 		{MACRO_AT_func {bar2}}
     50      1.1  christos 	    }
     51      1.1  christos 	}
     52      1.1  christos     }
     53      1.1  christos 
     54      1.1  christos     lines {version 2} Llines {
     55      1.1  christos 	include_dir "${srcdir}/${subdir}"
     56      1.1  christos 	file_name "$srcfile" 1
     57      1.1  christos 
     58      1.1  christos 	program {
     59  1.1.1.4  christos 	    DW_LNE_set_address $bar1_start
     60  1.1.1.4  christos 	    line 25
     61  1.1.1.4  christos 	    DW_LNS_copy
     62  1.1.1.4  christos 
     63  1.1.1.2  christos 	    DW_LNE_set_address bar1_label
     64  1.1.1.2  christos 	    line 27
     65  1.1.1.2  christos 	    DW_LNS_copy
     66  1.1.1.2  christos 
     67  1.1.1.2  christos 	    DW_LNE_set_address bar1_label_2
     68  1.1.1.2  christos 	    line 29
     69  1.1.1.2  christos 	    DW_LNS_copy
     70  1.1.1.2  christos 
     71  1.1.1.2  christos 	    DW_LNE_set_address bar1_label_3
     72  1.1.1.2  christos 	    line 0
     73  1.1.1.2  christos 	    DW_LNS_copy
     74  1.1.1.2  christos 
     75  1.1.1.2  christos 	    DW_LNE_set_address bar1_label_4
     76  1.1.1.2  christos 	    line 33
     77  1.1.1.2  christos 	    DW_LNS_copy
     78  1.1.1.2  christos 
     79  1.1.1.3  christos 	    DW_LNE_set_address $bar1_end
     80  1.1.1.2  christos 	    DW_LNE_end_sequence
     81  1.1.1.2  christos 
     82  1.1.1.2  christos 
     83  1.1.1.4  christos 	    DW_LNE_set_address $bar2_start
     84  1.1.1.4  christos 	    line 39
     85  1.1.1.4  christos 	    DW_LNS_copy
     86  1.1.1.4  christos 
     87  1.1.1.2  christos 	    DW_LNE_set_address bar2_label
     88  1.1.1.2  christos 	    line 41
     89  1.1.1.2  christos 	    DW_LNS_copy
     90  1.1.1.2  christos 
     91  1.1.1.2  christos 	    DW_LNE_set_address bar2_label_2
     92  1.1.1.2  christos 	    line 43
     93  1.1.1.2  christos 	    DW_LNS_copy
     94  1.1.1.2  christos 
     95  1.1.1.2  christos 	    DW_LNE_set_address bar2_label_3
     96  1.1.1.2  christos 	    line 0
     97  1.1.1.2  christos 	    DW_LNS_negate_stmt
     98  1.1.1.2  christos 	    DW_LNS_copy
     99  1.1.1.2  christos 	    DW_LNS_negate_stmt
    100  1.1.1.2  christos 
    101  1.1.1.2  christos 	    DW_LNE_set_address bar2_label_4
    102  1.1.1.2  christos 	    line 47
    103  1.1.1.2  christos 	    DW_LNS_copy
    104      1.1  christos 
    105  1.1.1.3  christos 	    DW_LNE_set_address $bar2_end
    106  1.1.1.2  christos 	    DW_LNE_end_sequence
    107      1.1  christos 	}
    108      1.1  christos     }
    109      1.1  christos }
    110      1.1  christos 
    111      1.1  christos if { [prepare_for_testing "failed to prepare" ${testfile} \
    112      1.1  christos 	  [list $srcfile $asm_file] {nodebug}] } {
    113      1.1  christos     return -1
    114      1.1  christos }
    115      1.1  christos 
    116      1.1  christos if ![runto_main] {
    117      1.1  christos     return -1
    118      1.1  christos }
    119      1.1  christos 
    120      1.1  christos gdb_breakpoint "$srcfile:27"
    121      1.1  christos gdb_continue_to_breakpoint "bar1" "\[^\r\n\]*:27\r\n.*"
    122      1.1  christos 
    123      1.1  christos gdb_test "n" "foo \\(2\\);" "bar1, 1st next"
    124      1.1  christos gdb_test "n" "foo \\(4\\);" "bar1, 2nd next"
    125      1.1  christos 
    126      1.1  christos gdb_breakpoint "$srcfile:41"
    127      1.1  christos gdb_continue_to_breakpoint "bar2" "\[^\r\n\]*:41\r\n.*"
    128      1.1  christos 
    129      1.1  christos gdb_test "n" "foo \\(2\\);" "bar2, 1st next"
    130      1.1  christos gdb_test "n" "foo \\(4\\);" "bar2, 2nd next"
    131      1.1  christos 
    132      1.1  christos if ![runto_main] {
    133      1.1  christos     return -1
    134      1.1  christos }
    135      1.1  christos 
    136      1.1  christos gdb_breakpoint "bar1_label_3"
    137      1.1  christos setup_kfail "gdb/nnnnn" *-*-*
    138      1.1  christos gdb_continue_to_breakpoint "bar1_label_3" "bar1 \\(\\)"
    139      1.1  christos 
    140      1.1  christos gdb_breakpoint "bar2_label_3"
    141      1.1  christos setup_kfail "gdb/nnnnn" *-*-*
    142      1.1  christos gdb_continue_to_breakpoint "bar2_label_3" "bar2 \\(\\)"
    143