Home | History | Annotate | Line # | Download | only in gdb.dwarf2
      1 /* This testcase is part of GDB, the GNU debugger.
      2 
      3    Copyright 2024 Free Software Foundation, Inc.
      4 
      5    This program is free software; you can redistribute it and/or modify
      6    it under the terms of the GNU General Public License as published by
      7    the Free Software Foundation; either version 3 of the License, or
      8    (at your option) any later version.
      9 
     10    This program is distributed in the hope that it will be useful,
     11    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13    GNU General Public License for more details.
     14 
     15    You should have received a copy of the GNU General Public License
     16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     17 
     18 volatile int global_var = 0;
     19 
     20 void
     21 func_a (void)	/* func_a decl line */
     22 {
     23   /* This label is used to find the start of 'func_a' when generating the
     24      debug information.  Place nothing before it.  */
     25   asm ("func_a_label: .globl func_a_label");
     26   ++global_var;
     27 
     28   asm ("func_a_0: .globl func_a_0");
     29   ++global_var;
     30 
     31   asm ("func_a_1: .globl func_a_1");
     32   ++global_var;
     33 
     34   asm ("func_a_2: .globl func_a_2");
     35   ++global_var;
     36 
     37   asm ("func_a_3: .globl func_a_3");
     38   ++global_var;
     39 
     40   asm ("func_a_4: .globl func_a_4");
     41   ++global_var;
     42 
     43   asm ("func_a_5: .globl func_a_5");
     44   ++global_var;
     45 
     46   asm ("func_a_6: .globl func_a_6");
     47   ++global_var;
     48 }
     49 
     50 void
     51 func_b (void)	/* func_b decl line */
     52 {
     53   /* This label is used to find the start of 'func_b' when generating the
     54      debug information.  Place nothing before it.  */
     55   asm ("func_b_label: .globl func_b_label");
     56   ++global_var;
     57 
     58   asm ("func_b_0: .globl func_b_0");
     59   ++global_var;		/* inline func_a call line */
     60 
     61   asm ("func_b_1: .globl func_b_1");
     62   ++global_var;
     63 
     64   asm ("func_b_2: .globl func_b_2");
     65   ++global_var;
     66 
     67   asm ("func_b_3: .globl func_b_3");
     68   ++global_var;
     69 
     70   asm ("func_b_4: .globl func_b_4");
     71   ++global_var;
     72 
     73   asm ("func_b_5: .globl func_b_5");
     74   ++global_var;
     75 }
     76 
     77 int
     78 main (void)
     79 {
     80   asm ("main_label: .globl main_label");
     81   func_b ();
     82   func_a ();
     83 }
     84