mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
parent
ca69fee8bb
commit
a369768c27
14 changed files with 591 additions and 0 deletions
|
@ -0,0 +1,52 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2004 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "unwind_i.h"
|
||||||
|
|
||||||
|
PROTECTED unw_addr_space_t
|
||||||
|
unw_create_addr_space (unw_accessors_t *a, int byte_order)
|
||||||
|
{
|
||||||
|
#ifdef UNW_LOCAL_ONLY
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
unw_addr_space_t as = malloc (sizeof (*as));
|
||||||
|
|
||||||
|
if (!as)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
memset (as, 0, sizeof (*as));
|
||||||
|
|
||||||
|
as->acc = *a;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* hppa supports only big-endian.
|
||||||
|
*/
|
||||||
|
if (byte_order != 0 && byte_order != __BIG_ENDIAN)
|
||||||
|
return NULL;
|
||||||
|
return as;
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2004 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#include "unwind_i.h"
|
||||||
|
|
||||||
|
PROTECTED int
|
||||||
|
unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
|
||||||
|
{
|
||||||
|
struct cursor *c = (struct cursor *) cursor;
|
||||||
|
dwarf_loc_t loc;
|
||||||
|
|
||||||
|
loc = DWARF_NULL_LOC; /* default to "not saved" */
|
||||||
|
|
||||||
|
#warning FIX ME!
|
||||||
|
|
||||||
|
memset (sloc, 0, sizeof (sloc));
|
||||||
|
|
||||||
|
if (DWARF_IS_NULL_LOC (loc))
|
||||||
|
{
|
||||||
|
sloc->type = UNW_SLT_NONE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(UNW_LOCAL_ONLY)
|
||||||
|
if (DWARF_IS_REG_LOC (loc))
|
||||||
|
{
|
||||||
|
sloc->type = UNW_SLT_REG;
|
||||||
|
sloc->u.regnum = DWARF_GET_LOC (loc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
sloc->type = UNW_SLT_MEMORY;
|
||||||
|
sloc->u.addr = DWARF_GET_LOC (loc);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#include "unwind_i.h"
|
||||||
|
|
||||||
|
HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
HIDDEN int tdep_needs_initialization = 1;
|
||||||
|
|
||||||
|
HIDDEN void
|
||||||
|
tdep_init (void)
|
||||||
|
{
|
||||||
|
intrmask_t saved_mask;
|
||||||
|
|
||||||
|
sigfillset (&unwi_full_mask);
|
||||||
|
|
||||||
|
sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask);
|
||||||
|
mutex_lock (&hppa_lock);
|
||||||
|
{
|
||||||
|
if (!tdep_needs_initialization)
|
||||||
|
/* another thread else beat us to it... */
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
mi_init ();
|
||||||
|
|
||||||
|
dwarf_init ();
|
||||||
|
|
||||||
|
#ifndef UNW_REMOTE_ONLY
|
||||||
|
hppa_local_addr_space_init ();
|
||||||
|
#endif
|
||||||
|
tdep_needs_initialization = 0; /* signal that we're initialized... */
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
mutex_unlock (&hppa_lock);
|
||||||
|
sigprocmask (SIG_SETMASK, &saved_mask, NULL);
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#include "init.h"
|
||||||
|
#include "unwind_i.h"
|
||||||
|
|
||||||
|
PROTECTED int
|
||||||
|
unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
|
||||||
|
{
|
||||||
|
#ifdef UNW_LOCAL_ONLY
|
||||||
|
return -UNW_EINVAL;
|
||||||
|
#else /* !UNW_LOCAL_ONLY */
|
||||||
|
struct cursor *c = (struct cursor *) cursor;
|
||||||
|
|
||||||
|
if (tdep_needs_initialization)
|
||||||
|
tdep_init ();
|
||||||
|
|
||||||
|
Debug (1, "(cursor=%p)\n", c);
|
||||||
|
|
||||||
|
c->dwarf.as = as;
|
||||||
|
c->dwarf.as_arg = as_arg;
|
||||||
|
return common_init (c);
|
||||||
|
#endif /* !UNW_LOCAL_ONLY */
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Gcreate_addr_space.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Gget_save_loc.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Gglobal.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Ginit_remote.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Gis_signal_frame.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
|
#include "Gresume.c"
|
||||||
|
#endif
|
|
@ -0,0 +1,88 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2003-2004 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <libunwind.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "jmpbuf.h"
|
||||||
|
#include "setjmp_i.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
_longjmp (jmp_buf env, int val)
|
||||||
|
{
|
||||||
|
extern int _UI_longjmp_cont;
|
||||||
|
unw_context_t uc;
|
||||||
|
unw_cursor_t c;
|
||||||
|
unw_word_t sp;
|
||||||
|
unw_word_t *wp = (unw_word_t *) env;
|
||||||
|
|
||||||
|
if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
|
||||||
|
abort ();
|
||||||
|
if (sp != wp[JB_SP])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!bsp_match (&c, wp))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* found the right frame: */
|
||||||
|
|
||||||
|
assert (UNW_NUM_EH_REGS >= 2);
|
||||||
|
|
||||||
|
if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0
|
||||||
|
|| unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
|
||||||
|
|| unw_set_reg (&c, UNW_REG_IP,
|
||||||
|
(unw_word_t) &_UI_longjmp_cont))
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
unw_resume (&c);
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
while (unw_step (&c) >= 0);
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
void longjmp (jmp_buf env, int val) __attribute__ ((alias ("_longjmp")));
|
||||||
|
#else
|
||||||
|
|
||||||
|
void
|
||||||
|
longjmp (jmp_buf env, int val)
|
||||||
|
{
|
||||||
|
_longjmp (env, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< .merge_file_NH3KvZ
|
||||||
/* libunwind - a platform-independent unwind library
|
/* libunwind - a platform-independent unwind library
|
||||||
Copyright (C) 2003-2005 Hewlett-Packard Co
|
Copyright (C) 2003-2005 Hewlett-Packard Co
|
||||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
@ -116,3 +117,123 @@ resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !UNW_TARGET_IA64 */
|
#endif /* !UNW_TARGET_IA64 */
|
||||||
|
=======
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2003-2005 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#if UNW_TARGET_IA64
|
||||||
|
|
||||||
|
#include "tdep.h"
|
||||||
|
#include "ia64/rse.h"
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
bsp_match (unw_cursor_t *c, unw_word_t *wp)
|
||||||
|
{
|
||||||
|
unw_word_t bsp, pfs, sol;
|
||||||
|
|
||||||
|
if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0
|
||||||
|
|| unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
/* simulate the effect of "br.call sigsetjmp" on ar.bsp: */
|
||||||
|
sol = (pfs >> 7) & 0x7f;
|
||||||
|
bsp = rse_skip_regs (bsp, sol);
|
||||||
|
|
||||||
|
if (bsp != wp[JB_BSP])
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (unlikely (sol == 0))
|
||||||
|
{
|
||||||
|
unw_word_t sp, prev_sp;
|
||||||
|
unw_cursor_t tmp = *c;
|
||||||
|
|
||||||
|
/* The caller of {sig,}setjmp() cannot have a NULL-frame. If we
|
||||||
|
see a NULL-frame, we haven't reached the right target yet.
|
||||||
|
To have a NULL-frame, the number of locals must be zero and
|
||||||
|
the stack-frame must also be empty. */
|
||||||
|
|
||||||
|
if (unw_step (&tmp) < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0
|
||||||
|
|| unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
if (sp == prev_sp)
|
||||||
|
/* got a NULL-frame; keep looking... */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* On ia64 we cannot always call sigprocmask() at
|
||||||
|
_UI_siglongjmp_cont() because the signal may have switched stacks
|
||||||
|
and the old stack's register-backing store may have overflown,
|
||||||
|
leaving us no space to allocate the stacked registers needed to
|
||||||
|
call sigprocmask(). Fortunately, we can just let unw_resume() (via
|
||||||
|
sigreturn) take care of restoring the signal-mask. That's faster
|
||||||
|
anyhow. */
|
||||||
|
static inline int
|
||||||
|
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
|
||||||
|
{
|
||||||
|
unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr;
|
||||||
|
struct sigcontext *sc = (struct sigcontext *) sc_addr;
|
||||||
|
sigset_t current_mask;
|
||||||
|
void *mp;
|
||||||
|
|
||||||
|
if (!sc_addr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* let unw_resume() install the desired signal mask */
|
||||||
|
|
||||||
|
if (wp[JB_MASK_SAVED])
|
||||||
|
mp = &wp[JB_MASK];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0)
|
||||||
|
abort ();
|
||||||
|
mp = ¤t_mask;
|
||||||
|
}
|
||||||
|
memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !UNW_TARGET_IA64 */
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
bsp_match (unw_cursor_t *c, unw_word_t *wp)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
|
||||||
|
{
|
||||||
|
/* We may want to do this analogously as for ia64... */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !UNW_TARGET_IA64 */
|
||||||
|
>>>>>>> .merge_file_F6t3ZY
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< .merge_file_OTjtqa
|
||||||
/* libunwind - a platform-independent unwind library
|
/* libunwind - a platform-independent unwind library
|
||||||
Copyright (C) 2003-2005 Hewlett-Packard Co
|
Copyright (C) 2003-2005 Hewlett-Packard Co
|
||||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
@ -92,3 +93,103 @@ siglongjmp (sigjmp_buf env, int val)
|
||||||
|
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2003-2004 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <libunwind.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "tdep.h"
|
||||||
|
#include "jmpbuf.h"
|
||||||
|
#include "setjmp_i.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
siglongjmp (sigjmp_buf env, int val)
|
||||||
|
{
|
||||||
|
unw_word_t *wp = (unw_word_t *) env;
|
||||||
|
extern int _UI_siglongjmp_cont;
|
||||||
|
extern int _UI_longjmp_cont;
|
||||||
|
unw_context_t uc;
|
||||||
|
unw_cursor_t c;
|
||||||
|
unw_word_t sp;
|
||||||
|
int *cont;
|
||||||
|
|
||||||
|
if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
|
||||||
|
abort ();
|
||||||
|
if (sp != wp[JB_SP])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!bsp_match (&c, wp))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* found the right frame: */
|
||||||
|
|
||||||
|
/* default to resuming without restoring signal-mask */
|
||||||
|
cont = &_UI_longjmp_cont;
|
||||||
|
|
||||||
|
/* Order of evaluation is important here: if unw_resume()
|
||||||
|
restores signal mask, we must set it up appropriately, even
|
||||||
|
if wp[JB_MASK_SAVED] is FALSE. */
|
||||||
|
if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED])
|
||||||
|
{
|
||||||
|
/* sigmask was saved */
|
||||||
|
if (UNW_NUM_EH_REGS < 4 || _NSIG >= 16 * sizeof (unw_word_t))
|
||||||
|
/* signal mask doesn't fit into EH arguments and we can't
|
||||||
|
put it on the stack without overwriting something
|
||||||
|
else... */
|
||||||
|
abort ();
|
||||||
|
else
|
||||||
|
if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0
|
||||||
|
|| (_NSIG > 8 * sizeof (unw_word_t)
|
||||||
|
&& unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0))
|
||||||
|
abort ();
|
||||||
|
cont = &_UI_siglongjmp_cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0
|
||||||
|
|| unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
|
||||||
|
|| unw_set_reg (&c, UNW_REG_IP, (unw_word_t) cont))
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
unw_resume (&c);
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
while (unw_step (&c) >= 0);
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
>>>>>>> .merge_file_qE75m7
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* libunwind - a platform-independent unwind library
|
||||||
|
Copyright (C) 2004 Hewlett-Packard Co
|
||||||
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
|
This file is part of libunwind.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
.globl _UI_longjmp_cont
|
||||||
|
|
||||||
|
.type _UI_longjmp_cont, @function
|
||||||
|
_UI_longjmp_cont:
|
||||||
|
.cfi_startproc
|
||||||
|
.cfi_register 8, 0 /* IP saved in EAX */
|
||||||
|
push %eax /* push target IP as return address */
|
||||||
|
.cfi_restore 8
|
||||||
|
mov %edx, %eax /* set up return-value */
|
||||||
|
ret
|
||||||
|
.cfi_endproc
|
||||||
|
.size _UI_siglongjmp_cont, .-_UI_longjmp_cont
|
Loading…
Reference in a new issue