1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-22 07:37:38 +01:00

unw_step: add unique id debugging features

This commit is contained in:
Théophile Bastian 2019-06-08 15:38:11 +02:00
parent f02a57cdfc
commit 4979ec08bb
2 changed files with 16 additions and 1 deletions

View file

@ -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:

View file

@ -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)
{