diff --git a/src/x86_64/Ginit_remote.c b/src/x86_64/Ginit_remote.c index 93399143..8d8022f3 100644 --- a/src/x86_64/Ginit_remote.c +++ b/src/x86_64/Ginit_remote.c @@ -29,6 +29,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "../eh_elf/eh_elf.h" #include "unwind_i.h" +int init_id = 0; + PROTECTED int unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) { @@ -42,7 +44,8 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) if (!tdep_init_done) tdep_init (); - Debug (1, "(cursor=%p)\n", c); + init_id++; + Debug (1, "(init_id=%d, cursor=%p)\n", init_id, c); switch(eh_elf_acc->init_mode) { case UNW_EH_ELF_INIT_PID: diff --git a/src/x86_64/Gstep.c b/src/x86_64/Gstep.c index 5ed2568e..e7b03072 100644 --- a/src/x86_64/Gstep.c +++ b/src/x86_64/Gstep.c @@ -55,6 +55,18 @@ is_plt_entry (struct dwarf_cursor *c) return ret; } +extern int init_id; + +static int unw_step_id(unw_cursor_t *cursor) { + struct cursor *c = (struct cursor *) cursor; + return ( + ((c->dwarf.ip + c->dwarf.cfa * 257) % 1000003) + + (1000003 * init_id)) + % (1000000007); +} + +#define UnwDebug(lvl, fmt, ...) Debug(lvl, "[%X] " fmt, unw_step_id(cursor), ##__VA_ARGS__) + PROTECTED int unw_step (unw_cursor_t *cursor) {