2009-02-06 23:59:01 +01:00
|
|
|
/* Target-dependent code for GNU/Linux, architecture independent.
|
|
|
|
|
2016-01-01 05:33:14 +01:00
|
|
|
Copyright (C) 2009-2016 Free Software Foundation, Inc.
|
2009-02-06 23:59:01 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef LINUX_TDEP_H
|
|
|
|
#define LINUX_TDEP_H
|
|
|
|
|
2012-01-20 10:56:56 +01:00
|
|
|
#include "bfd.h"
|
|
|
|
|
|
|
|
struct regcache;
|
|
|
|
|
2016-02-02 11:46:28 +01:00
|
|
|
/* Enum used to define the extra fields of the siginfo type used by an
|
|
|
|
architecture. */
|
|
|
|
enum linux_siginfo_extra_field_values
|
|
|
|
{
|
|
|
|
/* Add bound fields into the segmentation fault field. */
|
|
|
|
LINUX_SIGINFO_FIELD_ADDR_BND = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Defines a type for the values defined in linux_siginfo_extra_field_values. */
|
|
|
|
DEF_ENUM_FLAGS_TYPE (enum linux_siginfo_extra_field_values,
|
|
|
|
linux_siginfo_extra_fields);
|
|
|
|
|
2016-02-02 11:50:17 +01:00
|
|
|
/* This function is suitable for architectures that
|
|
|
|
extend/override the standard siginfo in a specific way. */
|
|
|
|
struct type *linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
|
|
|
|
linux_siginfo_extra_fields);
|
|
|
|
|
2012-01-20 10:56:56 +01:00
|
|
|
typedef char *(*linux_collect_thread_registers_ftype) (const struct regcache *,
|
|
|
|
ptid_t,
|
|
|
|
bfd *, char *, int *,
|
2012-05-24 18:39:15 +02:00
|
|
|
enum gdb_signal);
|
2012-01-20 10:56:56 +01:00
|
|
|
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 18:54:43 +02:00
|
|
|
extern enum gdb_signal linux_gdb_signal_from_target (struct gdbarch *gdbarch,
|
|
|
|
int signal);
|
|
|
|
|
|
|
|
extern int linux_gdb_signal_to_target (struct gdbarch *gdbarch,
|
|
|
|
enum gdb_signal signal);
|
|
|
|
|
PR13858 - Can't do displaced stepping with no symbols
Running break-interp.exp with the target always in non-stop mode trips
on PR13858, as enabling non-stop also enables displaced stepping.
The problem is that when GDB doesn't know where the entry point is, it
doesn't know where to put the displaced stepping scratch pad. The
test added by this commit exercises this. Without the fix, we get:
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: break *$pc
set displaced-stepping on
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: set displaced-stepping on
stepi
0x00000000004005be in ?? ()
Entry point address is not known.
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: stepi
p /x $pc
$2 = 0x4005be
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=on: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=on: advanced
The fix switches all GNU/Linux ports to get the entry point from
AT_ENTRY in the target auxiliary vector instead of from symbols. This
is currently only done by PPC when Cell debugging is enabled, but I
think all archs should be able to do the same. Note that
ppc_linux_displaced_step_location cached the result, I'm guessing to
avoid constantly re-fetching the auxv out of remote targets, but
that's no longer necessary nowadays, as the auxv blob is itself cached
in the inferior object. The ppc_linux_entry_point_addr global is
obviously bad for multi-process too nowadays.
Tested on x86-64 (-m64/-m32), PPC64 (-m64/-m32) and S/390 GNU/Linux.
Yao tested the new test on ARM as well.
gdb/ChangeLog:
2015-04-10 Pedro Alves <palves@redhat.com>
PR gdb/13858
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Install
linux_displaced_step_location as gdbarch_displaced_step_location
hook.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* linux-tdep.c (linux_displaced_step_location): New function,
based on ppc_linux_displaced_step_location.
* linux-tdep.h (linux_displaced_step_location): New declaration.
* ppc-linux-tdep.c (ppc_linux_entry_point_addr): Delete.
(ppc_linux_inferior_created, ppc_linux_displaced_step_location):
Delete.
(ppc_linux_init_abi): Install linux_displaced_step_location as
gdbarch_displaced_step_location hook, even without Cell/B.E..
(_initialize_ppc_linux_tdep): Don't install
ppc_linux_inferior_created as inferior_created observer.
* s390-linux-tdep.c (s390_gdbarch_init): Install
linux_displaced_step_location as gdbarch_displaced_step_location
hook.
gdb/testsuite/
2015-04-10 Pedro Alves <palves@redhat.com>
PR gdb/13858
* gdb.base/step-over-no-symbols.exp: New file.
2015-04-10 11:07:02 +02:00
|
|
|
/* Default GNU/Linux implementation of `displaced_step_location', as
|
|
|
|
defined in gdbarch.h. Determines the entry point from AT_ENTRY in
|
|
|
|
the target auxiliary vector. */
|
|
|
|
extern CORE_ADDR linux_displaced_step_location (struct gdbarch *gdbarch);
|
|
|
|
|
2010-08-04 17:27:57 +02:00
|
|
|
extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
|
|
|
|
|
2013-09-03 01:09:57 +02:00
|
|
|
extern int linux_is_uclinux (void);
|
|
|
|
|
2009-02-06 23:59:01 +01:00
|
|
|
#endif /* linux-tdep.h */
|