14 #define CMP(x, y) (st64)((st64)x - ((PE64_RUNTIME_FUNCTION *)y)->EndAddress)
15 #define READ_AT(address, buf, size) dbg->iob.read_at(dbg->iob.io, address, buf, size)
30 if (!exception_table_size || exception_table_size ==
UT32_MAX) {
88 const ut64 rip_offset_to_function =
context->rip - function_address;
90 if (!
info->FrameRegister) {
95 return integer_registers[
info->FrameRegister] -
info->FrameOffset * 16;
100 for (
i = 0;
i <
info->CountOfCodes;
i++) {
106 if (rip_offset_to_function >=
info->UnwindCode[
i].CodeOffset) {
107 return integer_registers[
info->FrameRegister] -
info->FrameOffset * 16;
136 const ut64 module_address,
137 const ut64 function_address) {
139 bool is_chained =
false;
141 ut64 machine_frame_start;
142 bool is_machine_frame =
false;
155 process_chained_info:
156 if (
info->Version != 1 &&
info->Version != 2) {
159 (
ut32)
info->Version, function_address);
164 while (i < info->CountOfCodes) {
169 if (!is_chained &&
context->rip < function_address +
code.CodeOffset) {
171 switch (
code.UnwindOp) {
194 switch (
code.UnwindOp) {
210 frame->
bp = integer_registers[
info->FrameRegister];
211 context->rsp = integer_registers[
info->FrameRegister] -
info->FrameOffset * 16;
233 is_machine_frame =
true;
234 machine_frame_start =
context->rsp + 40;
260 goto process_chained_info;
262 if (is_machine_frame) {
263 frame->
size = machine_frame_start - frame->
sp;
275 *out_frames = frames;
286 if (!arena || arena_size <
sizeof(*
context)) {
318 if (
module != last_module) {
338 for (index--; function_address >
context->rip && index >= 0; index--) {
342 if (index < 0 && function_address >
context->rip) {
RZ_API ut8 * rz_reg_get_bytes(RzReg *reg, int type, int *size)
RzBinInfo * info(RzBinFile *bf)
RZ_API RzList * rz_debug_modules_list(RzDebug *dbg)
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_BORROW RzListIter * rz_list_find(RZ_NONNULL const RzList *list, const void *p, RZ_NONNULL RzListComparator cmp)
Returns RzListIter element which matches via the RzListComparator.
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API void * rz_list_iter_get_data(RzListIter *list)
returns the value stored in the list element
RZ_API RZ_OWN void * rz_list_pop(RZ_NONNULL RzList *list)
Removes and returns the last element of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
#define PE_IMAGE_DIRECTORY_ENTRY_EXCEPTION
#define PE64_UNW_FLAG_CHAININFO
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)
static ut64 rz_read_le64(const void *src)
#define RZ_LOG_ERROR(fmtstr,...)
#define rz_offsetof(type, member)
static void * rz_vector_index_ptr(RzVector *vec, size_t index)
#define rz_vector_upper_bound(vec, x, i, cmp)
RZ_API void * rz_vector_reserve(RzVector *vec, size_t capacity)
RZ_API void * rz_vector_push(RzVector *vec, void *x)
RZ_API void rz_vector_fini(RzVector *vec)
static size_t rz_vector_len(const RzVector *vec)
RZ_API void rz_vector_init(RzVector *vec, size_t elem_size, RzVectorFree free, void *free_user)
static ut64 get_frame_base(const PE64_UNWIND_INFO *info, const struct context_type_amd64 *context, const ut64 function_address)
static ut32 read_slot32(RzDebug *dbg, PE64_UNWIND_INFO *info, int *index)
#define READ_AT(address, buf, size)
static bool backtrace_windows_x64(RZ_IN RzDebug *dbg, RZ_INOUT RzList **out_frames, RZ_INOUT struct context_type_amd64 *context)
static ut16 read_slot16(RzDebug *dbg, PE64_UNWIND_INFO *info, int *index)
static int is_pc_inside_module(const void *value, const void *list_data)
static bool init_module_runtime_functions(RzDebug *dbg, RzVector *functions, ut64 module_base)
static PE64_UNWIND_INFO * read_unwind_info(RzDebug *dbg, ut64 at)
static ut64 read_register(RzDebug *dbg, ut64 at)
static bool unwind_function(RzDebug *dbg, RzDebugFrame *frame, PE64_RUNTIME_FUNCTION *rfcn, struct context_type_amd64 *context, const ut64 module_address, const ut64 function_address)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()