Rizin
unix-like reverse engineering framework and cli tools
common_windows.h File Reference
#include <rz_debug.h>

Go to the source code of this file.

Functions

RzDebugReasonType windows_exception_to_reason (ut32 exception_code)
 
bool windows_is_exception_fatal (ut32 exception_code)
 
void windows_print_exception_event (ut32 pid, ut32 tid, ut32 exception_code, bool second_chance)
 

Function Documentation

◆ windows_exception_to_reason()

RzDebugReasonType windows_exception_to_reason ( ut32  exception_code)

Definition at line 33 of file common_windows.c.

33  {
34  switch (exception_code) {
47  return RZ_DEBUG_REASON_FPU;
53  return RZ_DEBUG_REASON_STEP;
54  default:
55  return RZ_DEBUG_REASON_TRAP;
56  }
57 }
#define EXCEPTION_SINGLE_STEP
Definition: common_windows.c:9
#define EXCEPTION_GUARD_PAGE
#define EXCEPTION_FLT_STACK_CHECK
#define EXCEPTION_INT_DIVIDE_BY_ZERO
#define EXCEPTION_FLT_UNDERFLOW
#define EXCEPTION_FLT_OVERFLOW
#define EXCEPTION_FLT_DENORMAL_OPERAND
#define EXCEPTION_FLT_INEXACT_RESULT
#define EXCEPTION_ILLEGAL_INSTRUCTION
#define EXCEPTION_ACCESS_VIOLATION
Definition: common_windows.c:6
#define EXCEPTION_BREAKPOINT
Definition: common_windows.c:8
#define EXCEPTION_FLT_INVALID_OPERATION
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
@ RZ_DEBUG_REASON_STEP
Definition: rz_debug.h:98
@ RZ_DEBUG_REASON_ILLEGAL
Definition: rz_debug.h:102
@ RZ_DEBUG_REASON_BREAKPOINT
Definition: rz_debug.h:94
@ RZ_DEBUG_REASON_TRAP
Definition: rz_debug.h:111
@ RZ_DEBUG_REASON_FPU
Definition: rz_debug.h:114
@ RZ_DEBUG_REASON_SEGFAULT
Definition: rz_debug.h:93
@ RZ_DEBUG_REASON_DIVBYZERO
Definition: rz_debug.h:101

References EXCEPTION_ACCESS_VIOLATION, EXCEPTION_BREAKPOINT, EXCEPTION_FLT_DENORMAL_OPERAND, EXCEPTION_FLT_DIVIDE_BY_ZERO, EXCEPTION_FLT_INEXACT_RESULT, EXCEPTION_FLT_INVALID_OPERATION, EXCEPTION_FLT_OVERFLOW, EXCEPTION_FLT_STACK_CHECK, EXCEPTION_FLT_UNDERFLOW, EXCEPTION_GUARD_PAGE, EXCEPTION_ILLEGAL_INSTRUCTION, EXCEPTION_INT_DIVIDE_BY_ZERO, EXCEPTION_SINGLE_STEP, RZ_DEBUG_REASON_BREAKPOINT, RZ_DEBUG_REASON_DIVBYZERO, RZ_DEBUG_REASON_FPU, RZ_DEBUG_REASON_ILLEGAL, RZ_DEBUG_REASON_SEGFAULT, RZ_DEBUG_REASON_STEP, and RZ_DEBUG_REASON_TRAP.

Referenced by rz_debug_winkd_wait(), and w32_dbg_wait().

◆ windows_is_exception_fatal()

bool windows_is_exception_fatal ( ut32  exception_code)

Definition at line 97 of file common_windows.c.

97  {
98  switch (exception_code) {
109  return true;
110  default:
111  return false;
112  }
113 }
#define EXCEPTION_NONCONTINUABLE_EXCEPTION
#define EXCEPTION_STACK_OVERFLOW
#define EXCEPTION_IN_PAGE_ERROR
#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED
#define EXCEPTION_PRIV_INSTRUCTION

References EXCEPTION_ACCESS_VIOLATION, EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_FLT_STACK_CHECK, EXCEPTION_GUARD_PAGE, EXCEPTION_ILLEGAL_INSTRUCTION, EXCEPTION_IN_PAGE_ERROR, EXCEPTION_INT_DIVIDE_BY_ZERO, EXCEPTION_NONCONTINUABLE_EXCEPTION, EXCEPTION_PRIV_INSTRUCTION, and EXCEPTION_STACK_OVERFLOW.

Referenced by w32_dbg_wait(), and windows_print_exception_event().

◆ windows_print_exception_event()

void windows_print_exception_event ( ut32  pid,
ut32  tid,
ut32  exception_code,
bool  second_chance 
)

Definition at line 115 of file common_windows.c.

115  {
116  bool is_fatal = windows_is_exception_fatal(exception_code);
117  RZ_LOG_INFO("(%" PFMT32u ") %s Exception %04X (%s) in thread %" PFMT32u "\n",
118  pid,
119  is_fatal ? "Fatal" : "Non-fatal",
120  exception_code, get_exception_name(exception_code),
121  tid);
122  if (second_chance) {
123  RZ_LOG_WARN("A second-chance exception has ocurred!\n");
124  }
125  if (is_fatal) {
126  RZ_LOG_INFO("Use 'dce' continue into exception handler\n");
127  }
128 }
static const char * get_exception_name(ut32 ExceptionCode)
bool windows_is_exception_fatal(ut32 exception_code)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
Definition: sflib.h:64
#define RZ_LOG_INFO(fmtstr,...)
Definition: rz_log.h:54
#define RZ_LOG_WARN(fmtstr,...)
Definition: rz_log.h:56
#define PFMT32u
Definition: rz_types.h:409

References get_exception_name(), PFMT32u, pid, RZ_LOG_INFO, RZ_LOG_WARN, and windows_is_exception_fatal().

Referenced by rz_debug_winkd_wait(), and w32_dbg_wait().