Home | History | Annotate | Line # | Download | only in gdb.dwarf2
dw2-dir-file-name.c revision 1.9
      1 /* This testcase is part of GDB, the GNU debugger.
      2 
      3    Copyright 2012-2020 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 v;
     19 
     20 static void
     21 marker (void)
     22 {
     23   v++;
     24 }
     25 
     26 /* *R* marks possibly invalid compiler output as the first path component is
     27    not absolute.  Still DWARF-4 does not forbid such DWARF; GCC does not
     28    produce it.  */
     29 
     30 #define FUNCBLOCK						\
     31 FUNC (compdir_missing__ldir_missing__file_basename)	   /*R*/\
     32 FUNC (compdir_missing__ldir_missing__file_relative)	   /*R*/\
     33 FUNC (compdir_missing__ldir_missing__file_absolute)		\
     34 FUNC (compdir_missing__ldir_relative_file_basename)	   /*R*/\
     35 FUNC (compdir_missing__ldir_relative_file_relative)	   /*R*/\
     36 FUNC (compdir_missing__ldir_relative_file_absolute)	   /*R*/\
     37 FUNC (compdir_missing__ldir_absolute_file_basename)		\
     38 FUNC (compdir_missing__ldir_absolute_file_relative)		\
     39 FUNC (compdir_missing__ldir_absolute_file_absolute_same)	\
     40 FUNC (compdir_missing__ldir_absolute_file_absolute_different)	\
     41 FUNC (compdir_relative_ldir_missing__file_basename)	   /*R*/\
     42 FUNC (compdir_relative_ldir_missing__file_relative)	   /*R*/\
     43 FUNC (compdir_relative_ldir_missing__file_absolute)	   /*R*/\
     44 FUNC (compdir_relative_ldir_relative_file_basename)	   /*R*/\
     45 FUNC (compdir_relative_ldir_relative_file_relative)	   /*R*/\
     46 FUNC (compdir_relative_ldir_relative_file_absolute)	   /*R*/\
     47 FUNC (compdir_relative_ldir_absolute_file_basename)	   /*R*/\
     48 FUNC (compdir_relative_ldir_absolute_file_relative)	   /*R*/\
     49 FUNC (compdir_relative_ldir_absolute_file_absolute_same)   /*R*/\
     50 FUNC (compdir_relative_ldir_absolute_file_absolute_different) /*R*/\
     51 FUNC (compdir_absolute_ldir_missing__file_basename)		\
     52 FUNC (compdir_absolute_ldir_missing__file_relative)		\
     53 FUNC (compdir_absolute_ldir_missing__file_absolute_same)	\
     54 FUNC (compdir_absolute_ldir_missing__file_absolute_different)	\
     55 FUNC (compdir_absolute_ldir_relative_file_basename)		\
     56 FUNC (compdir_absolute_ldir_relative_file_relative)		\
     57 FUNC (compdir_absolute_ldir_relative_file_absolute_same)	\
     58 FUNC (compdir_absolute_ldir_relative_file_absolute_different)	\
     59 FUNC (compdir_absolute_ldir_absolute_file_basename_same)	\
     60 FUNC (compdir_absolute_ldir_absolute_file_basename_different)	\
     61 FUNC (compdir_absolute_ldir_absolute_file_relative_same)	\
     62 FUNC (compdir_absolute_ldir_absolute_file_relative_different)	\
     63 FUNC (compdir_absolute_ldir_absolute_file_absolute_same)	\
     64 FUNC (compdir_absolute_ldir_absolute_file_absolute_different)
     65 
     66 #ifdef __mips__
     67 #define START_INSNS asm (".insn\n");
     68 #else
     69 #define START_INSNS
     70 #endif
     71 
     72 /* Notes: (1) The '*_start' label below is needed because 'name' may
     73    point to a function descriptor instead of to the actual code.  (2)
     74    The '.balign' should specify the highest possible function
     75    alignment across all supported architectures, such that the label
     76    never points into the alignment gap.  */
     77 
     78 #define FUNC(name)					\
     79   asm (".balign 8");					\
     80   asm (#name "_start: .globl " #name "_start\n");	\
     81   START_INSNS						\
     82   static void						\
     83   name (void)						\
     84   {							\
     85     v++;						\
     86   }							\
     87   asm (#name "_end: .globl " #name "_end\n");
     88 FUNCBLOCK
     89 #undef FUNC
     90 
     91 int
     92 main (void)
     93 {
     94 
     95 #define FUNC(name)					\
     96   name ();
     97 FUNCBLOCK
     98 #undef FUNC
     99 
    100   return 0;
    101 }
    102