summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Watson <davejwatson@fb.com>2017-08-16 11:27:43 -0700
committerDave Watson <davejwatson@fb.com>2017-08-16 11:27:43 -0700
commit644cce3d722e677073d0529c5a969e025888af86 (patch)
tree318a049b2311a1d207d28b93fff409dd4ee31220
parent4e8b7a595e144e905fd9c8aed053d7529afb78a4 (diff)
downloadlibunwind-644cce3d722e677073d0529c5a969e025888af86.tar.gz
half finished unw_local_init2
-rw-r--r--include/libunwind-common.h.in10
-rw-r--r--src/x86_64/Ginit_local.c15
-rw-r--r--tests/Ltest-init-local-signal.c4
3 files changed, 23 insertions, 6 deletions
diff --git a/include/libunwind-common.h.in b/include/libunwind-common.h.in
index 0a9537eb..9811f491 100644
--- a/include/libunwind-common.h.in
+++ b/include/libunwind-common.h.in
@@ -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 *);
diff --git a/src/x86_64/Ginit_local.c b/src/x86_64/Ginit_local.c
index 2d2b1754..7696f11c 100644
--- a/src/x86_64/Ginit_local.c
+++ b/src/x86_64/Ginit_local.c
@@ -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 */
diff --git a/tests/Ltest-init-local-signal.c b/tests/Ltest-init-local-signal.c
index b834d44d..d23d66f9 100644
--- a/tests/Ltest-init-local-signal.c
+++ b/tests/Ltest-init-local-signal.c
@@ -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);