mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-08 18:33:42 +01:00
half finished unw_local_init2
This commit is contained in:
parent
4e8b7a595e
commit
644cce3d72
3 changed files with 23 additions and 6 deletions
|
@ -86,6 +86,12 @@ typedef enum
|
|||
}
|
||||
unw_caching_policy_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
|
||||
}
|
||||
unw_init_local2_flags_t;
|
||||
|
||||
typedef int unw_regnum_t;
|
||||
|
||||
/* The unwind cursor starts at the youngest (most deeply nested) frame
|
||||
|
@ -219,7 +225,7 @@ unw_save_loc_t;
|
|||
#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
|
||||
#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
|
||||
#define unw_init_local UNW_OBJ(init_local)
|
||||
#define unw_init_local_signal UNW_OBJ(init_local_signal)
|
||||
#define unw_init_local2 UNW_OBJ(init_local2)
|
||||
#define unw_init_remote UNW_OBJ(init_remote)
|
||||
#define unw_step UNW_OBJ(step)
|
||||
#define unw_resume UNW_OBJ(resume)
|
||||
|
@ -250,7 +256,7 @@ extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
|
|||
extern const char *unw_regname (unw_regnum_t);
|
||||
|
||||
extern int unw_init_local (unw_cursor_t *, unw_context_t *);
|
||||
extern int unw_init_local_signal (unw_cursor_t *, unw_context_t *);
|
||||
extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
|
||||
extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
|
||||
extern int unw_step (unw_cursor_t *);
|
||||
extern int unw_resume (unw_cursor_t *);
|
||||
|
|
|
@ -62,9 +62,20 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
|
|||
}
|
||||
|
||||
PROTECTED int
|
||||
unw_init_local_signal (unw_cursor_t *cursor, ucontext_t *uc)
|
||||
unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
|
||||
{
|
||||
return unw_init_local_common(cursor, uc, 0);
|
||||
if (!flag)
|
||||
{
|
||||
return unw_init_local_common(cursor, uc, 1);
|
||||
}
|
||||
else if (flag == UNW_INIT_SIGNAL_FRAME)
|
||||
{
|
||||
return unw_init_local_common(cursor, uc, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -UNW_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !UNW_REMOTE_ONLY */
|
||||
|
|
|
@ -25,12 +25,12 @@ int stepper(unw_cursor_t* c) {
|
|||
|
||||
/* Verify that we can step from both ucontext, and from getcontext()
|
||||
* roughly the same. This tests that the IP from ucontext is used
|
||||
* correctly (see impl of unw_init_local_signal) */
|
||||
* correctly (see impl of unw_init_local2) */
|
||||
void handler(int num, siginfo_t* info, void* ucontext) {
|
||||
unw_cursor_t c;
|
||||
unw_context_t context;
|
||||
unw_getcontext(&context);
|
||||
int ret = unw_init_local_signal(&c, ucontext);
|
||||
int ret = unw_init_local2(&c, ucontext, UNW_INIT_SIGNAL_FRAME);
|
||||
assert(!ret);
|
||||
int ucontext_steps = stepper(&c);
|
||||
|
||||
|
|
Loading…
Reference in a new issue