HPCToolkit
x86-unwind.c File Reference
#include <stdio.h>
#include <setjmp.h>
#include <stdbool.h>
#include <assert.h>
#include <sys/types.h>
#include <unistd.h>
#include <monitor.h>
#include <libunwind.h>
#include <include/gcc-attr.h>
#include <x86-decoder.h>
#include <hpcrun/epoch.h>
#include <hpcrun/main.h>
#include "stack_troll.h"
#include "thread_use.h"
#include <unwind/common/unwind.h>
#include <unwind/common/backtrace.h>
#include <unwind/common/libunw_intervals.h>
#include <unwind/common/unw-throw.h>
#include <unwind/common/validate_return_addr.h>
#include <unwind/common/fence_enum.h>
#include <fnbounds/fnbounds_interface.h>
#include <unwind/common/uw_recipe_map.h>
#include <utilities/arch/mcontext.h>
#include <utilities/ip-normalized.h>
#include <hpcrun/thread_data.h>
#include "x86-build-intervals.h"
#include "x86-unwind-interval.h"
#include "x86-validate-retn-addr.h"
#include <messages/messages.h>
#include <messages/debug-flag.h>
Include dependency graph for x86-unwind.c:

Go to the source code of this file.

Macros

#define UNW_LOCAL_ONLY
 
#define MYDBG   0
 
#define _MM(a)   [UNW_ADDR_ ## a] = 0,
 

Typedefs

typedef unw_frame_regnum_t unw_reg_code_t
 

Functions

static void update_cursor_with_troll (hpcrun_unw_cursor_t *cursor, int offset)
 
static step_state unw_step_sp (hpcrun_unw_cursor_t *cursor)
 
static step_state unw_step_bp (hpcrun_unw_cursor_t *cursor)
 
static step_state unw_step_std (hpcrun_unw_cursor_t *cursor)
 
static step_state t1_dbg_unw_step (hpcrun_unw_cursor_t *cursor)
 
static void save_registers (hpcrun_unw_cursor_t *cursor, void **pc, void **bp, void *sp, void **ra_loc)
 
static void compute_normalized_ips (hpcrun_unw_cursor_t *cursor)
 
void hpcrun_unw_init (void)
 
static int hpcrun_unw_get_unnorm_reg (hpcrun_unw_cursor_t *cursor, unw_reg_code_t reg_id, void **reg_value)
 
static int hpcrun_unw_get_norm_reg (hpcrun_unw_cursor_t *cursor, unw_reg_code_t reg_id, ip_normalized_t *reg_value)
 
int hpcrun_unw_get_ip_norm_reg (hpcrun_unw_cursor_t *c, ip_normalized_t *reg_value)
 
int hpcrun_unw_get_ip_unnorm_reg (hpcrun_unw_cursor_t *c, void **reg_value)
 
void hpcrun_unw_init_cursor (hpcrun_unw_cursor_t *cursor, void *context)
 
void * hpcrun_unw_get_ra_loc (hpcrun_unw_cursor_t *cursor)
 
btuwi_status_t build_intervals (char *ins, unsigned int len, unwinder_t uw)
 
static step_state hpcrun_unw_step_real (hpcrun_unw_cursor_t *cursor)
 
void hpcrun_validation_summary (void)
 
static void vrecord (void *from, void *to, validation_status vstat)
 
static bool hpcrun_retry_libunw_find_step (hpcrun_unw_cursor_t *cursor, void *pc, void **sp, void **bp)
 
step_state hpcrun_unw_step (hpcrun_unw_cursor_t *cursor)
 
static step_state GCC_ATTR_UNUSED t2_dbg_unw_step (hpcrun_unw_cursor_t *cursor)
 

Variables

int debug_unw = 0
 
static int DEBUG_WAIT_BEFORE_TROLLING = 1
 
static int DEBUG_NO_LONGJMP = 0
 
static step_state(* dbg_unw_step )(hpcrun_unw_cursor_t *cursor) = t1_dbg_unw_step
 
size_t hpcrun_validation_counts []
 

Macro Definition Documentation

◆ _MM

#define _MM (   a)    [UNW_ADDR_ ## a] = 0,

◆ MYDBG

#define MYDBG   0

Definition at line 129 of file x86-unwind.c.

◆ UNW_LOCAL_ONLY

#define UNW_LOCAL_ONLY

Definition at line 70 of file x86-unwind.c.

Typedef Documentation

◆ unw_reg_code_t

typedef unw_frame_regnum_t unw_reg_code_t

Definition at line 186 of file x86-unwind.c.

Function Documentation

◆ build_intervals()

btuwi_status_t build_intervals ( char *  ins,
unsigned int  len,
unwinder_t  uw 
)

Definition at line 280 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_normalized_ips()

static void compute_normalized_ips ( hpcrun_unw_cursor_t cursor)
static

Definition at line 164 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_retry_libunw_find_step()

static bool hpcrun_retry_libunw_find_step ( hpcrun_unw_cursor_t cursor,
void *  pc,
void **  sp,
void **  bp 
)
static

Definition at line 394 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_get_ip_norm_reg()

int hpcrun_unw_get_ip_norm_reg ( hpcrun_unw_cursor_t c,
ip_normalized_t reg_value 
)

Definition at line 225 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_get_ip_unnorm_reg()

int hpcrun_unw_get_ip_unnorm_reg ( hpcrun_unw_cursor_t c,
void **  reg_value 
)

Definition at line 231 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_get_norm_reg()

static int hpcrun_unw_get_norm_reg ( hpcrun_unw_cursor_t cursor,
unw_reg_code_t  reg_id,
ip_normalized_t reg_value 
)
static

Definition at line 207 of file x86-unwind.c.

Here is the caller graph for this function:

◆ hpcrun_unw_get_ra_loc()

void* hpcrun_unw_get_ra_loc ( hpcrun_unw_cursor_t cursor)

Definition at line 274 of file x86-unwind.c.

Here is the caller graph for this function:

◆ hpcrun_unw_get_unnorm_reg()

static int hpcrun_unw_get_unnorm_reg ( hpcrun_unw_cursor_t cursor,
unw_reg_code_t  reg_id,
void **  reg_value 
)
static

Definition at line 189 of file x86-unwind.c.

Here is the caller graph for this function:

◆ hpcrun_unw_init()

void hpcrun_unw_init ( void  )

Definition at line 180 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_init_cursor()

void hpcrun_unw_init_cursor ( hpcrun_unw_cursor_t cursor,
void *  context 
)

Definition at line 237 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_step()

step_state hpcrun_unw_step ( hpcrun_unw_cursor_t cursor)

Definition at line 407 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_unw_step_real()

static step_state hpcrun_unw_step_real ( hpcrun_unw_cursor_t cursor)
static

Definition at line 289 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_validation_summary()

void hpcrun_validation_summary ( void  )

Definition at line 368 of file x86-unwind.c.

◆ save_registers()

static void save_registers ( hpcrun_unw_cursor_t cursor,
void **  pc,
void **  bp,
void *  sp,
void **  ra_loc 
)
static

Definition at line 154 of file x86-unwind.c.

Here is the caller graph for this function:

◆ t1_dbg_unw_step()

static step_state t1_dbg_unw_step ( hpcrun_unw_cursor_t cursor)
static

Definition at line 654 of file x86-unwind.c.

Here is the call graph for this function:

◆ t2_dbg_unw_step()

static step_state GCC_ATTR_UNUSED t2_dbg_unw_step ( hpcrun_unw_cursor_t cursor)
static

Definition at line 673 of file x86-unwind.c.

Here is the call graph for this function:

◆ unw_step_bp()

static step_state unw_step_bp ( hpcrun_unw_cursor_t cursor)
static

Definition at line 561 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unw_step_sp()

static step_state unw_step_sp ( hpcrun_unw_cursor_t cursor)
static

Definition at line 468 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unw_step_std()

static step_state unw_step_std ( hpcrun_unw_cursor_t cursor)
static

Definition at line 626 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_cursor_with_troll()

static void update_cursor_with_troll ( hpcrun_unw_cursor_t cursor,
int  offset 
)
static

Definition at line 694 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vrecord()

static void vrecord ( void *  from,
void *  to,
validation_status  vstat 
)
static

Definition at line 383 of file x86-unwind.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dbg_unw_step

step_state(* dbg_unw_step) (hpcrun_unw_cursor_t *cursor) = t1_dbg_unw_step
static

Definition at line 147 of file x86-unwind.c.

◆ DEBUG_NO_LONGJMP

int DEBUG_NO_LONGJMP = 0
static

Definition at line 121 of file x86-unwind.c.

◆ debug_unw

int debug_unw = 0

Definition at line 110 of file x86-unwind.c.

◆ DEBUG_WAIT_BEFORE_TROLLING

int DEBUG_WAIT_BEFORE_TROLLING = 1
static

Definition at line 119 of file x86-unwind.c.

◆ hpcrun_validation_counts

size_t hpcrun_validation_counts[]
Initial value:
= {
#define _MM(a)
}

Definition at line 361 of file x86-unwind.c.