GDB (xrefs)
Loading...
Searching...
No Matches
arc-newlib-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for Newlib ARC.
2
3 Copyright (C) 2016-2023 Free Software Foundation, Inc.
4 Contributed by Synopsys Inc.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21#include "defs.h"
22
23#include "gdbarch.h"
24#include "arc-tdep.h"
25#include "osabi.h"
26
27/* Print an "arc-newlib" debug statement. */
28
29#define arc_newlib_debug_printf(fmt, ...) \
30 debug_prefixed_printf_cond (arc_debug, "arc-newlib", fmt, ##__VA_ARGS__)
31
32/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
33
34static void
36{
37 arc_newlib_debug_printf ("Initialization.");
38
39 arc_gdbarch_tdep *tdep = gdbarch_tdep<arc_gdbarch_tdep> (gdbarch);
40
41 /* Offset of original PC in longjmp jump buffer (in registers). Value of PC
42 offset can be found in newlib/libc/machine/arc/setjmp.S. */
43 tdep->jb_pc = 18;
44}
45
46/* Recognize ARC Newlib object files. */
47
48static enum gdb_osabi
50{
51 arc_newlib_debug_printf ("OS/ABI sniffer.");
52
53 /* crt0.S in libgloss for ARC defines .ivt section for interrupt handlers.
54 If this section is not present then this is likely not a newlib - could be
55 a Linux application or some non-newlib baremetal application. */
56 if (bfd_get_section_by_name (abfd, ".ivt") != NULL)
57 return GDB_OSABI_NEWLIB;
58 else
59 return GDB_OSABI_UNKNOWN;
60}
61
63void
static enum gdb_osabi arc_newlib_osabi_sniffer(bfd *abfd)
static void arc_newlib_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
void _initialize_arc_newlib_tdep()
#define arc_newlib_debug_printf(fmt,...)
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition osabi.c:146
void gdbarch_register_osabi_sniffer(enum bfd_architecture arch, enum bfd_flavour flavour, enum gdb_osabi(*sniffer_fn)(bfd *))
Definition osabi.c:220
gdb_osabi
Definition osabi.h:25
@ GDB_OSABI_NEWLIB
Definition osabi.h:46
@ GDB_OSABI_UNKNOWN
Definition osabi.h:26