* Makefile.in (ALLDEPFILES): Add alpha-osf1-tdep.c.

(alpha-osf1-tdep.o): New dependency list.
* alpha-tdep.h (gdbarch_tdep): Add dynamic_sigtramp_offset
and skip_sigtramp_frame members.
* alpha-linux-tdep.c: Include gdbcore.h.
(alpha_linux_sigtramp_offset): Change return type to LONGEST.
(alpha_linux_init_abi): Initialize tdep->dynamic_sigtramp_offset.
* alpha-osf1-tdep.c: New file.
* alpha-tdep.c (alpha_osf_skip_sigtramp_frame): Moved to
alpha-osf1-dep.c.
(alpha_frame_past_sigtramp_frame): New function.
(alpha_dynamic_sigtramp_offset): Ditto.
(alpha_proc_desc_is_dyn_sigtramp): Ditto.
(alpha_set_proc_desc_is_dyn_sigtramp): Ditto.
(ALPHA_PROC_SIGTRAMP_MAGIC): Define.
(push_sigtramp_desc): Use alpha_set_proc_desc_is_dyn_sigtramp.
(after_prologue): Use alpha_proc_desc_is_dyn_sigtramp.
(find_proc_desc): Use alpha_dynamic_sigtramp_offset.
(alpha_frame_chain): Use alpha_frame_past_sigtramp_frame.
(alpha_init_extra_frame_info): Use alpha_proc_desc_is_dyn_sigtramp.
(alpha_pop_frame): Use alpha_proc_desc_is_dyn_sigtramp.
(alpha_gdbarch_init): Initialize tdep->dynamic_sigtramp_offset
and tdep->skip_sigtramp_frame.  Set gdbarch_skip_trampoline_code
to find_solib_trampoline_target.
* config/alpha/alpha-osf1.mt (TDEPFILES): Add alpha-osf1-tdep.o.
* config/alpha/tm-alpha.h: Remove inclusion of regcache.h.
(SKIP_TRAMPOLINE_CODE): Remove.
(PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(DYNAMIC_SIGTRAMP_OFFSET): Ditto.
(FRAME_PAST_SIGTRAMP_FRAME): Ditto.
* config/alpha/tm-alphalinux.h (PROC_DESC_IS_DYN_SIGTRAMP): Remove.
(PROC_SIGTRAMP_MAGIC): Ditto.
(PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(DYNAMIC_SIGTRAMP_OFFSET): Ditto.
(FRAME_PAST_SIGTRAMP_FRAME): Ditto.
This commit is contained in:
Jason Thorpe 2002-04-25 02:28:57 +00:00
parent 2f4bc57b95
commit 36a6271d5e
9 changed files with 172 additions and 87 deletions

View File

@ -1,3 +1,44 @@
2002-04-24 Jason Thorpe <thorpej@wasabisystems.com>
* Makefile.in (ALLDEPFILES): Add alpha-osf1-tdep.c.
(alpha-osf1-tdep.o): New dependency list.
* alpha-tdep.h (gdbarch_tdep): Add dynamic_sigtramp_offset
and skip_sigtramp_frame members.
* alpha-linux-tdep.c: Include gdbcore.h.
(alpha_linux_sigtramp_offset): Change return type to LONGEST.
(alpha_linux_init_abi): Initialize tdep->dynamic_sigtramp_offset.
* alpha-osf1-tdep.c: New file.
* alpha-tdep.c (alpha_osf_skip_sigtramp_frame): Moved to
alpha-osf1-dep.c.
(alpha_frame_past_sigtramp_frame): New function.
(alpha_dynamic_sigtramp_offset): Ditto.
(alpha_proc_desc_is_dyn_sigtramp): Ditto.
(alpha_set_proc_desc_is_dyn_sigtramp): Ditto.
(ALPHA_PROC_SIGTRAMP_MAGIC): Define.
(push_sigtramp_desc): Use alpha_set_proc_desc_is_dyn_sigtramp.
(after_prologue): Use alpha_proc_desc_is_dyn_sigtramp.
(find_proc_desc): Use alpha_dynamic_sigtramp_offset.
(alpha_frame_chain): Use alpha_frame_past_sigtramp_frame.
(alpha_init_extra_frame_info): Use alpha_proc_desc_is_dyn_sigtramp.
(alpha_pop_frame): Use alpha_proc_desc_is_dyn_sigtramp.
(alpha_gdbarch_init): Initialize tdep->dynamic_sigtramp_offset
and tdep->skip_sigtramp_frame. Set gdbarch_skip_trampoline_code
to find_solib_trampoline_target.
* config/alpha/alpha-osf1.mt (TDEPFILES): Add alpha-osf1-tdep.o.
* config/alpha/tm-alpha.h: Remove inclusion of regcache.h.
(SKIP_TRAMPOLINE_CODE): Remove.
(PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(DYNAMIC_SIGTRAMP_OFFSET): Ditto.
(FRAME_PAST_SIGTRAMP_FRAME): Ditto.
* config/alpha/tm-alphalinux.h (PROC_DESC_IS_DYN_SIGTRAMP): Remove.
(PROC_SIGTRAMP_MAGIC): Ditto.
(PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(SET_PROC_DESC_IS_DYN_SIGTRAMP): Ditto.
(DYNAMIC_SIGTRAMP_OFFSET): Ditto.
(FRAME_PAST_SIGTRAMP_FRAME): Ditto.
2002-04-24 Jason Thorpe <thorpej@wasabisystems.com>
* NEWS: Note that Alpha targets are now multi-arch.

View File

@ -1178,8 +1178,8 @@ unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
29k-share/udi/udi2go32.c \
a29k-tdep.c a68v-nat.c \
alpha-nat.c alphabsd-nat.c alpha-tdep.c alpha-linux-tdep.c \
alphafbsd-tdep.c \
alpha-nat.c alphabsd-nat.c alpha-tdep.c \
alpha-linux-tdep.c alpha-osf1-tdep.c alphafbsd-tdep.c \
arm-linux-nat.c arm-linux-tdep.c arm-tdep.c \
armnbsd-nat.c armnbsd-tdep.c \
coff-solib.c \
@ -1255,6 +1255,8 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) alpha-tdep.h
alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) alpha-tdep.h
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) alpha-tdep.h
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h)

View File

@ -19,6 +19,7 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "gdbcore.h"
#include "value.h"
#include "alpha-tdep.h"
@ -45,7 +46,7 @@
middle of the designated sequence, in which case there is no
guarantee that we are in the middle of a sigreturn syscall. Don't
think this will be a problem in praxis, though. */
long
LONGEST
alpha_linux_sigtramp_offset (CORE_ADDR pc)
{
unsigned int i[3], w;
@ -88,7 +89,9 @@ static void
alpha_linux_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
/* Place holder. */
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->dynamic_sigtramp_offset = alpha_linux_sigtramp_offset;
}
void

53
gdb/alpha-osf1-tdep.c Normal file
View File

@ -0,0 +1,53 @@
/* Target-dependent code for OSF/1 on Alpha.
Copyright 2002 Free Software Foundation, Inc.
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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "frame.h"
#include "value.h"
#include "alpha-tdep.h"
/* Under OSF/1, the __sigtramp routine is frameless and has a frame
size of zero, but we are able to backtrace through it. */
static CORE_ADDR
alpha_osf1_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
{
char *name;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
if (PC_IN_SIGTRAMP (pc, name))
return frame->frame;
return 0;
}
static void
alpha_osf1_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame;
}
void
_initialize_alpha_osf1_tdep (void)
{
alpha_gdbarch_register_os_abi (ALPHA_ABI_OSF1, alpha_osf1_init_abi);
}

View File

@ -167,8 +167,6 @@ static unsigned int heuristic_fence_post = 0;
*/
/* *INDENT-ON* */
#define PROC_LOW_ADDR(proc) ((proc)->pdr.adr) /* least address */
/* These next two fields are kind of being hijacked. I wonder if
iline is too small for the values it needs to hold, if GDB is
@ -201,19 +199,53 @@ alpha_osf_in_sigtramp (CORE_ADDR pc, char *func_name)
return (func_name != NULL && STREQ ("__sigtramp", func_name));
}
/* Under OSF/1, the __sigtramp routine is frameless and has a frame
size of zero, but we are able to backtrace through it. */
CORE_ADDR
alpha_osf_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
static CORE_ADDR
alpha_frame_past_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
{
char *name;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
if (PC_IN_SIGTRAMP (pc, name))
return frame->frame;
else
return 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (tdep->skip_sigtramp_frame != NULL)
return (tdep->skip_sigtramp_frame (frame, pc));
return (0);
}
static LONGEST
alpha_dynamic_sigtramp_offset (CORE_ADDR pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* Must be provided by OS/ABI variant code if supported. */
if (tdep->dynamic_sigtramp_offset != NULL)
return (tdep->dynamic_sigtramp_offset (pc));
return (-1);
}
#define ALPHA_PROC_SIGTRAMP_MAGIC 0x0e0f0f0f
/* Return TRUE if the procedure descriptor PROC is a procedure
descriptor that refers to a dynamically generated signal
trampoline routine. */
static int
alpha_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info *proc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (tdep->dynamic_sigtramp_offset != NULL)
return (proc->pdr.isym == ALPHA_PROC_SIGTRAMP_MAGIC);
return (0);
}
static void
alpha_set_proc_desc_is_dyn_sigtramp (struct alpha_extra_func_info *proc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (tdep->dynamic_sigtramp_offset != NULL)
proc->pdr.isym = ALPHA_PROC_SIGTRAMP_MAGIC;
}
/* Dynamically create a signal-handler caller procedure descriptor for
the signal-handler return code starting at address LOW_ADDR. The
@ -242,7 +274,7 @@ push_sigtramp_desc (CORE_ADDR low_addr)
PROC_FREG_MASK (proc_desc) = 0xffff;
PROC_PC_REG (proc_desc) = 26;
PROC_LOCALOFF (proc_desc) = 0;
SET_PROC_DESC_IS_DYN_SIGTRAMP (proc_desc);
alpha_set_proc_desc_is_dyn_sigtramp (proc_desc);
return (proc_desc);
}
@ -734,7 +766,7 @@ after_prologue (CORE_ADDR pc, alpha_extra_func_info_t proc_desc)
if (proc_desc)
{
if (PROC_DESC_IS_DYN_SIGTRAMP (proc_desc))
if (alpha_proc_desc_is_dyn_sigtramp (proc_desc))
return PROC_LOW_ADDR (proc_desc); /* "prologue" is in kernel */
/* If function is frameless, then we need to do it the hard way. I
@ -876,7 +908,7 @@ find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
/* If PC is inside a dynamically generated sigtramp handler,
create and push a procedure descriptor for that code: */
offset = DYNAMIC_SIGTRAMP_OFFSET (pc);
offset = alpha_dynamic_sigtramp_offset (pc);
if (offset >= 0)
return push_sigtramp_desc (pc - offset);
@ -925,7 +957,7 @@ alpha_frame_chain (struct frame_info *frame)
/* The previous frame from a sigtramp frame might be frameless
and have frame size zero. */
&& !frame->signal_handler_caller)
return FRAME_PAST_SIGTRAMP_FRAME (frame, saved_pc);
return alpha_frame_past_sigtramp_frame (frame, saved_pc);
else
return read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc))
+ PROC_FRAME_OFFSET (proc_desc);
@ -976,7 +1008,7 @@ alpha_init_extra_frame_info (int fromleaf, struct frame_info *frame)
Get the value of the frame relative sp, procedure might have been
interrupted by a signal at it's very start. */
else if (frame->pc == PROC_LOW_ADDR (proc_desc)
&& !PROC_DESC_IS_DYN_SIGTRAMP (proc_desc))
&& !alpha_proc_desc_is_dyn_sigtramp (proc_desc))
frame->frame = read_next_frame_reg (frame->next, SP_REGNUM);
else
frame->frame = read_next_frame_reg (frame->next, PROC_FRAME_REG (proc_desc))
@ -1285,7 +1317,7 @@ alpha_pop_frame (void)
flush_cached_frames ();
if (proc_desc && (PROC_DESC_IS_DUMMY (proc_desc)
|| PROC_DESC_IS_DYN_SIGTRAMP (proc_desc)))
|| alpha_proc_desc_is_dyn_sigtramp (proc_desc)))
{
struct linked_proc_info *pi_ptr, *prev_ptr;
@ -1934,6 +1966,9 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
decide when to stop looking. */
tdep->vm_min_address = (CORE_ADDR) 0x120000000;
tdep->dynamic_sigtramp_offset = NULL;
tdep->skip_sigtramp_frame = NULL;
/* Type sizes */
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
@ -2026,6 +2061,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
/* Floats are always passed as doubles. */
set_gdbarch_coerce_float_to_double (gdbarch,

View File

@ -96,6 +96,15 @@ struct gdbarch_tdep
const char *abi_name; /* Name of the above. */
CORE_ADDR vm_min_address; /* used by heuristic_proc_start */
/* If PC is inside a dynamically-generated signal trampoline function
(i.e. one copied onto the user stack at run-time), return how many
bytes PC is beyond the start of that function. Otherwise, return -1. */
LONGEST (*dynamic_sigtramp_offset) (CORE_ADDR);
/* If FRAME refers to a sigtramp frame, return the address of the next
frame. */
CORE_ADDR (*skip_sigtramp_frame) (struct frame_info *, CORE_ADDR);
};
void alpha_software_single_step (enum target_signal, int);

View File

@ -1,3 +1,3 @@
# Target: Little-endian Alpha
TDEPFILES= alpha-tdep.o
TDEPFILES= alpha-tdep.o alpha-osf1-tdep.o
TM_FILE= tm-alpha.h

View File

@ -26,7 +26,6 @@
#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
#include "regcache.h"
#include "bfd.h"
#include "coff/sym.h" /* Needed for PDR below. */
#include "coff/symconst.h"
@ -37,9 +36,8 @@ struct value;
struct symbol;
/* Number of traps that happen between exec'ing the shell
* to run an inferior, and when we finally get to
* the inferior code. This is 2 on most implementations.
*/
to run an inferior, and when we finally get to
the inferior code. This is 2 on most implementations. */
#define START_INFERIOR_TRAPS_EXPECTED 3
/* Offset from address of function to start of its code.
@ -99,40 +97,10 @@ extern void alpha_print_extra_frame_info (struct frame_info *);
alpha_setup_arbitrary_frame (argc, argv)
extern struct frame_info *alpha_setup_arbitrary_frame (int, CORE_ADDR *);
/* If PC is in a shared library trampoline code, return the PC
where the function itself actually starts. If not, return 0. */
#define SKIP_TRAMPOLINE_CODE(pc) find_solib_trampoline_target (pc)
/* Return TRUE if procedure descriptor PROC is a procedure descriptor
that refers to a dynamically generated sigtramp function.
OSF/1 doesn't use dynamic sigtramp functions, so this is always
FALSE. */
#define PROC_DESC_IS_DYN_SIGTRAMP(proc) (0)
#define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc)
/* If PC is inside a dynamically generated sigtramp function, return
how many bytes the program counter is beyond the start of that
function. Otherwise, return a negative value.
OSF/1 doesn't use dynamic sigtramp functions, so this always
returns -1. */
#define DYNAMIC_SIGTRAMP_OFFSET(pc) (-1)
/* Translate a signal handler frame into the address of the sigcontext
structure. */
#define SIGCONTEXT_ADDR(frame) \
(read_memory_integer ((frame)->next ? frame->next->frame : frame->frame, 8))
/* If FRAME refers to a sigtramp frame, return the address of the next
frame. */
#define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) \
(alpha_osf_skip_sigtramp_frame (frame, pc))
extern CORE_ADDR alpha_osf_skip_sigtramp_frame (struct frame_info *,
CORE_ADDR);
#endif /* TM_ALPHA_H */

View File

@ -29,7 +29,7 @@
/* Are we currently handling a signal ? */
extern long alpha_linux_sigtramp_offset (CORE_ADDR);
extern LONGEST alpha_linux_sigtramp_offset (CORE_ADDR);
#undef IN_SIGTRAMP
#define IN_SIGTRAMP(pc, name) (alpha_linux_sigtramp_offset (pc) >= 0)
@ -42,42 +42,15 @@ extern long alpha_linux_sigtramp_offset (CORE_ADDR);
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. This is 2
on GNU/Linux and most implementations. */
#undef START_INFERIOR_TRAPS_EXPECTED
#define START_INFERIOR_TRAPS_EXPECTED 2
/* Return TRUE if procedure descriptor PROC is a procedure descriptor
that refers to a dynamically generated sigtramp function. */
#undef PROC_DESC_IS_DYN_SIGTRAMP
#define PROC_SIGTRAMP_MAGIC 0x0e0f0f0f
#define PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym \
== PROC_SIGTRAMP_MAGIC)
#undef SET_PROC_DESC_IS_DYN_SIGTRAMP
#define SET_PROC_DESC_IS_DYN_SIGTRAMP(proc) ((proc)->pdr.isym \
= PROC_SIGTRAMP_MAGIC)
/* If PC is inside a dynamically generated sigtramp function, return
how many bytes the program counter is beyond the start of that
function. Otherwise, return a negative value. */
#undef DYNAMIC_SIGTRAMP_OFFSET
#define DYNAMIC_SIGTRAMP_OFFSET(pc) (alpha_linux_sigtramp_offset (pc))
/* Translate a signal handler frame into the address of the sigcontext
structure. */
#undef SIGCONTEXT_ADDR
#define SIGCONTEXT_ADDR(frame) ((frame)->frame - 0x298)
/* If FRAME refers to a sigtramp frame, return the address of the next frame.
Under GNU/Linux, sigtramp handlers have dynamically generated
procedure descriptors that make this hack unnecessary. */
#undef FRAME_PAST_SIGTRAMP_FRAME
#define FRAME_PAST_SIGTRAMP_FRAME(frame, pc) (0)
#include "tm-linux.h"
#endif /* TM_LINUXALPHA_H */