Re: [PATCH 7/8] ia64-hpux: unwinding bsp value from system call

Pedro Alves
2010-12-29T10:42:25Z

On Wednesday 29 December 2010 03:28:48, Joel Brobecker wrote:
> > What is the underlying object you're getting those values from?
> > I understood it to be whatever object TT_LWP_RUREGS accesses?
> > You seem to call it save_state_t? Why not TARGET_OBJECT_HPUX_RUREGS
> > or TARGET_OBJECT_HPUX_SAVE_STATE, or something along those lines?
> > Then, the offset, and length passed to target_xfer would the
> > the offset and length you're currently passing to
> > ia64_hpux_read_register_from_save_state_t. This would allow
> > (if useful) exporting this object similarly to the $_siginfo and
> > $_tlb objects.
>
> I cannot determine the offset from the tdep code. The offset is
> is a obtained by including one of the system hearders.

Before you dismiss this completely on that
ground, looking at hppa-hpux-tdep.c, I see:

/* Bit in the `ss_flag' member of `struct save_state' that indicates
that the 64-bit register values are live. From
<machine/save_state.h>. */
#define HPPA_HPUX_SS_WIDEREGS 0x40

/* Offsets of various parts of `struct save_state'. From
<machine/save_state.h>. */
#define HPPA_HPUX_SS_FLAGS_OFFSET 0
#define HPPA_HPUX_SS_NARROW_OFFSET 4
#define HPPA_HPUX_SS_FPBLOCK_OFFSET 256
#define HPPA_HPUX_SS_WIDE_OFFSET 640

/* The size of `struct save_state. */
#define HPPA_HPUX_SAVE_STATE_SIZE 1152

/* The size of `struct pa89_save_state', which corresponds to PA-RISC
1.1, the lowest common denominator that we support. */
#define HPPA_HPUX_PA89_SAVE_STATE_SIZE 512

...

* Bit in the `ss_flag' member of `struct save_state' that indicates
the state was saved from a system call. From
<machine/save_state.h>. */
#define HPPA_HPUX_SS_INSYSCALL 0x02

And e.g., see hppa_hpux_supply_save_state.

When you implement core support for ia64-hpux, if done
right (in tdep code, host-independent, supporting cross core
debugging), you'll need to hardcode these offsets anyway. It
looks like HPUX dumps each LWP's save_save in the cores. These
offset are usually practically part of the ABI.

Just adding this as a data point.

--
Pedro Alves