Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.linespec / line-breakpoint-outside-function.c
blob93c4383831251efa2443dc1637dac1be9c2434ed
1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2022-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
18 /* The section where THE_LIB_PATH is not defined is compiled as a shared
19 library. The rest is compiled as the main executable (which loads the
20 shared library. */
22 #if !defined(THE_LIB_PATH)
24 void
25 the_lib_func (void)
27 static int x;
28 /* break here */
29 x++;
32 #else
33 #include <dlfcn.h>
34 #include <assert.h>
35 #include <stdlib.h>
37 int
38 main (void)
40 void *lib = dlopen (THE_LIB_PATH, RTLD_NOW);
41 assert (lib != NULL);
43 void (*the_lib_func) (void) = dlsym (lib, "the_lib_func");
44 assert (the_lib_func != NULL);
46 the_lib_func ();
48 return 0;
51 #endif