GDB (xrefs)
Loading...
Searching...
No Matches
xtensa-linux-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for GNU/Linux on Xtensa processors.
2
3 Copyright (C) 2007-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "xtensa-tdep.h"
22#include "osabi.h"
23#include "linux-tdep.h"
24#include "solib-svr4.h"
25#include "symtab.h"
26#include "gdbarch.h"
27
28/* This enum represents the signals' numbers on the Xtensa
29 architecture. It just contains the signal definitions which are
30 different from the generic implementation.
31
32 It is derived from the file <arch/xtensa/include/uapi/asm/signal.h>,
33 from the Linux kernel tree. */
34
35enum
36 {
39 };
40
41/* Implementation of `gdbarch_gdb_signal_from_target', as defined in
42 gdbarch.h. */
43
44static enum gdb_signal
46 int signal)
47{
48 if (signal >= XTENSA_LINUX_SIGRTMIN && signal <= XTENSA_LINUX_SIGRTMAX)
49 {
50 int offset = signal - XTENSA_LINUX_SIGRTMIN;
51
52 if (offset == 0)
53 return GDB_SIGNAL_REALTIME_32;
54 else
55 return (enum gdb_signal) (offset - 1
56 + (int) GDB_SIGNAL_REALTIME_33);
57 }
58 else if (signal > XTENSA_LINUX_SIGRTMAX)
59 return GDB_SIGNAL_UNKNOWN;
60
62}
63
64/* Implementation of `gdbarch_gdb_signal_to_target', as defined in
65 gdbarch.h. */
66
67static int
69 enum gdb_signal signal)
70{
71 switch (signal)
72 {
73 /* GDB_SIGNAL_REALTIME_32 is not continuous in <gdb/signals.def>,
74 therefore we have to handle it here. */
75 case GDB_SIGNAL_REALTIME_32:
77
78 /* GDB_SIGNAL_REALTIME_64 is not valid on Xtensa. */
79 case GDB_SIGNAL_REALTIME_64:
80 return -1;
81 }
82
83 /* GDB_SIGNAL_REALTIME_33 to _63 are continuous.
84
85 Xtensa does not have _64. */
86 if (signal >= GDB_SIGNAL_REALTIME_33
87 && signal <= GDB_SIGNAL_REALTIME_63)
88 {
89 int offset = signal - GDB_SIGNAL_REALTIME_33;
90
91 return XTENSA_LINUX_SIGRTMIN + 1 + offset;
92 }
93
94 return linux_gdb_signal_to_target (gdbarch, signal);
95}
96
97/* OS specific initialization of gdbarch. */
98
99static void
127
129void
131{
132 gdbarch_register_osabi (bfd_arch_xtensa, bfd_mach_xtensa, GDB_OSABI_LINUX,
134}
void set_gdbarch_gdb_signal_from_target(struct gdbarch *gdbarch, gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
Definition gdbarch.c:1958
void set_gdbarch_gdb_signal_to_target(struct gdbarch *gdbarch, gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target)
void set_gdbarch_fetch_tls_load_module_address(struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
Definition gdbarch.c:1941
int linux_gdb_signal_to_target(struct gdbarch *gdbarch, enum gdb_signal signal)
enum gdb_signal linux_gdb_signal_from_target(struct gdbarch *gdbarch, int signal)
link_map_offsets * linux_ilp32_fetch_link_map_offsets()
void linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch, int num_disp_step_buffers)
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
@ GDB_OSABI_LINUX
Definition osabi.h:32
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
unsigned int num_pseudo_regs
unsigned int num_nopriv_regs
unsigned int num_regs
void _initialize_xtensa_linux_tdep()
static void xtensa_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static enum gdb_signal xtensa_linux_gdb_signal_from_target(struct gdbarch *gdbarch, int signal)
@ XTENSA_LINUX_SIGRTMAX
@ XTENSA_LINUX_SIGRTMIN
static int xtensa_linux_gdb_signal_to_target(struct gdbarch *gdbarch, enum gdb_signal signal)