mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
__frame_state_for: Use <unwind-link.h> for unwinder access
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define STATIC static
|
#define STATIC static
|
||||||
#define __frame_state_for fallback_frame_state_for
|
#define __frame_state_for fallback_frame_state_for
|
||||||
@@ -25,6 +24,8 @@
|
|||||||
#undef __frame_state_for
|
#undef __frame_state_for
|
||||||
#include <gnu/lib-names.h>
|
#include <gnu/lib-names.h>
|
||||||
|
|
||||||
|
#include <unwind-link.h>
|
||||||
|
|
||||||
typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
|
typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
|
||||||
struct frame_state *__frame_state_for (void *pc,
|
struct frame_state *__frame_state_for (void *pc,
|
||||||
struct frame_state *frame_state);
|
struct frame_state *frame_state);
|
||||||
@@ -32,21 +33,15 @@ struct frame_state *__frame_state_for (void *pc,
|
|||||||
struct frame_state *
|
struct frame_state *
|
||||||
__frame_state_for (void *pc, struct frame_state *frame_state)
|
__frame_state_for (void *pc, struct frame_state *frame_state)
|
||||||
{
|
{
|
||||||
static framesf frame_state_for;
|
struct unwind_link *unwind_link = __libc_unwind_link_get ();
|
||||||
|
if (unwind_link != NULL)
|
||||||
if (frame_state_for == NULL)
|
return UNWIND_LINK_PTR (unwind_link, __frame_state_for) (pc, frame_state);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
void *handle = __libc_dlopen (LIBGCC_S_SO);
|
|
||||||
|
|
||||||
if (handle == NULL
|
|
||||||
|| (frame_state_for
|
|
||||||
= (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
|
|
||||||
#ifndef __USING_SJLJ_EXCEPTIONS__
|
#ifndef __USING_SJLJ_EXCEPTIONS__
|
||||||
frame_state_for = fallback_frame_state_for;
|
return fallback_frame_state_for (pc, frame_state);
|
||||||
#else
|
#else
|
||||||
frame_state_for = abort;
|
abort ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return frame_state_for (pc, frame_state);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user