On Tue, Mar 22, 2011 at 9:52 PM, Ian Lance Taylor <[email protected]> wrote:
> "H.J. Lu" <[email protected]> writes:
>
>>> This suggests that, at least, when sizeof(_Unwind_Word) > sizeof(void*),
>>> we need to extend _Unwind_Context with a new array at the end, and use
>>> that new array when by_value[REG] is true.
>>
>> Will there be a case where 2 copies of unwind-dw2.c are within the same
>> process?
>
> Sure, that's easy. I think what you are really asking is: will there be
> a case where we could call functions from one copy and then pass the
> context to the functions from a different copy. I don't know the answer
> to that, but it doesn't seem impossible.
>
Then. will this be acceptable?
Thanks.
--
H.J.
---
#ifndef UNWIND_REGISTER_AS_UNION
#if defined __x86_64 && !defined __LP64__
# define UNWIND_REGISTER_AS_UNION
#endif
#endif
#ifdef UNWIND_REGISTER_AS_UNION
typedef union
{
void *ref;
_Unwind_Word val;
} _Unwind_Register;
# define UNWIND_REGISTER_GET_VAL_FROM_REF(TYPE, REG) \
* (TYPE *) (REG).ref
# define UNWIND_REGISTER_SET_VAL(INDEX, VAL) \
context->reg[INDEX].val = (VAL)
# define UNWIND_REGISTER_GET_REF(INDEX) \
context->reg[INDEX].ref
# define UNWIND_REGISTER_GET_REF_FROM_VAL(INDEX) \
&context->reg[INDEX].val
#else
typedef void *_Unwind_Register;
# define UNWIND_REGISTER_GET_VAL_FROM_REF(TYPE, REG) \
* (TYPE *) (REG)
# define UNWIND_REGISTER_SET_VAL(INDEX, VAL) \
context->reg[INDEX] = (void *) (_Unwind_Internal_Ptr) (VAL)
# define UNWIND_REGISTER_GET_REF(INDEX) \
context->reg[INDEX]
# define UNWIND_REGISTER_GET_REF_FROM_VAL(INDEX) \
&context->reg[INDEX]
#endif
/* This is the register and unwind state for a particular frame. This
provides the information necessary to unwind up past a frame and return
to its caller. */
struct _Unwind_Context
{
_Unwind_Register reg[DWARF_FRAME_REGISTERS+1];
void *cfa;