Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | WindProc |
struct | WindThread |
struct | WindModule |
struct | WindMap |
struct | Profile |
struct | _WindCtx |
struct | _KdCtx |
struct | _DmpCtx |
Macros | |
#define | TARGET_BACKEND 0 |
#define | TARGET_PHYSICAL 1 |
#define | TARGET_KERNEL 2 |
#define | TARGET_VIRTUAL 3 |
Typedefs | |
typedef struct WindProc | WindProc |
typedef struct WindThread | WindThread |
typedef struct WindModule | WindModule |
typedef struct WindMap | WindMap |
typedef int | WindReadAt(RZ_NONNULL void *user, ut64 address, RZ_BORROW RZ_NONNULL RZ_OUT ut8 *buf, int count) |
typedef int | WindWriteAt(RZ_NONNULL void *user, ut64 address, RZ_BORROW RZ_NONNULL RZ_IN const ut8 *buf, int count) |
typedef struct _WindCtx | WindCtx |
typedef struct _KdCtx | KdCtx |
typedef struct _DmpCtx | DmpCtx |
Enumerations | |
enum | { K_PaeEnabled = 0x036 , K_PsActiveProcessHead = 0x050 , K_CmNtCSDVersion = 0x268 , K_OffsetKThreadApcProcess = 0x2a0 } |
enum | { E_ActiveProcessLinks , E_UniqueProcessId , E_Peb , E_ImageFileName , E_VadRoot , E_ThreadListHead , K_DirectoryTableBase , P_ImageBaseAddress , P_ProcessParameters , RZ_ImagePathName , ET_ApcProcess , ET_ThreadListEntry , ET_Win32StartAddress , ET_Cid , C_UniqueThread , O_Max } |
typedef struct WindModule WindModule |
typedef int WindReadAt(RZ_NONNULL void *user, ut64 address, RZ_BORROW RZ_NONNULL RZ_OUT ut8 *buf, int count) |
typedef struct WindThread WindThread |
anonymous enum |
anonymous enum |
int winkd_bkpt | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | addr, | ||
const int | set, | ||
const int | hw, | ||
RZ_BORROW RZ_NONNULL int * | handle | ||
) |
Definition at line 1312 of file winkd.c.
References addr, DbgKdRestoreBreakPointApi, DbgKdWriteBreakPointApi, free(), handle, NULL, PKT_REQ, req, and winkd_send_state_manipulate_req().
Referenced by rz_debug_winkd_breakpoint().
void winkd_break | ( | void * | ctx | ) |
Definition at line 1442 of file winkd.c.
References iob_write().
Referenced by winkd_lock_enter().
int winkd_continue | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
bool | handled | ||
) |
Definition at line 1141 of file winkd.c.
References DbgKdContinueApi, KD_E_MALFORMED, KD_E_OK, KD_E_TIMEOUT, KD_PACKET_TYPE_ACKNOWLEDGE, KD_PACKET_TYPE_STATE_MANIPULATE, kd_send_data_packet(), NULL, req, rz_list_free(), winkd_lock_enter(), winkd_lock_leave(), and winkd_wait_packet().
Referenced by rz_debug_winkd_continue().
|
inlinestatic |
Definition at line 141 of file winkd.h.
References free().
Referenced by dmp_close(), and winkd_kdctx_free().
int winkd_get_bits | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 80 of file winkd.c.
References RZ_SYS_BITS_32, and RZ_SYS_BITS_64.
Referenced by rz_debug_winkd_attach().
int winkd_get_cpu | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
int winkd_get_cpus | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
WindProc* winkd_get_process_at | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx, |
ut64 | address | ||
) |
Definition at line 488 of file winkd.c.
References E_ImageFileName, E_Peb, E_UniqueProcessId, E_VadRoot, K_DirectoryTableBase, KOBJECT_PROCESS, Proc::name, NULL, O_, PFMT64x, proc, RZ_LOG_WARN, RZ_NEW0, type, and winkd_read_ptr_at().
Referenced by get_current_process_and_thread(), rz_debug_dmp_attach(), rz_debug_dmp_init(), and winkd_list_process().
Definition at line 58 of file winkd.c.
References bits(), build(), i, NULL, p, p_table, RZ_NEW0, and sp.
Referenced by rz_debug_dmp_init(), and winkd_read_ver().
int winkd_get_sp | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 40 of file winkd.c.
References K_CmNtCSDVersion, PFMT64x, RZ_LOG_DEBUG, ut64(), and UT64_MAX.
Referenced by rz_debug_dmp_init(), and winkd_read_ver().
ut32 winkd_get_target | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
ut64 winkd_get_target_base | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 166 of file winkd.c.
References O_, P_ImageBaseAddress, ut64(), and winkd_read_at_uva().
Referenced by rz_debug_winkd_select().
ut32 winkd_get_target_thread | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 162 of file winkd.c.
Referenced by rz_debug_winkd_select().
WindThread* winkd_get_thread_at | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx, |
ut64 | address | ||
) |
Definition at line 739 of file winkd.c.
References C_UniqueThread, calloc(), WindThread::entrypoint, ET_Cid, ET_Win32StartAddress, WindThread::ethread, KOBJECT_THREAD, NULL, O_, PFMT64x, WindThread::runnable, RZ_LOG_WARN, WindThread::status, type, WindThread::uniqueid, and ut64().
Referenced by get_current_process_and_thread(), rz_debug_dmp_attach(), rz_debug_dmp_init(), and winkd_list_threads().
Definition at line 187 of file winkd.c.
References desc, free(), RZ_FREE, rz_list_free(), rz_th_lock_free(), and winkd_ctx_fini().
Referenced by __close().
KdCtx* winkd_kdctx_new | ( | RZ_BORROW RZ_NONNULL io_desc_t * | desc | ) |
Definition at line 177 of file winkd.c.
References desc, NULL, RZ_NEW0, and rz_th_lock_new().
Referenced by __open().
RzList* winkd_list_maps | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 476 of file winkd.c.
References free(), maps(), NULL, rz_list_newf(), UT64_MAX, and winkd_walk_vadtree().
Referenced by rz_debug_dmp_maps(), and rz_debug_winkd_maps().
RzList* winkd_list_modules | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 625 of file winkd.c.
References calloc(), free(), is_target_kernel(), length, map_comparator(), mod(), NULL, PFMT64x, read_at_uva_or_kernel(), rz_list_add_sorted(), rz_list_free(), rz_list_join(), rz_list_newf(), RZ_LOG_DEBUG, RZ_LOG_ERROR, RZ_LOG_WARN, RZ_NEW0, rz_str_utf16_to_utf8(), ut64(), UT64_MAX, winkd_read_at_uva(), and winkd_windmodule_free().
Referenced by dmp_get_modules(), rz_debug_dmp_init(), and rz_debug_winkd_modules().
RzList* winkd_list_process | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 513 of file winkd.c.
References E_ActiveProcessLinks, free(), K_PsActiveProcessHead, NULL, O_, PFMT64x, proc, rz_list_append(), rz_list_newf(), RZ_LOG_ERROR, RZ_LOG_WARN, ut64(), UT64_MAX, winkd_get_process_at(), and winkd_read_ptr_at().
Referenced by rz_debug_dmp_pids(), rz_debug_winkd_pids(), and winkd_set_target().
RzList* winkd_list_threads | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx | ) |
Definition at line 782 of file winkd.c.
References E_ThreadListHead, ET_ThreadListEntry, WindThread::ethread, free(), NULL, O_, PFMT64x, rz_list_append(), rz_list_newf(), RZ_LOG_ERROR, RZ_LOG_WARN, ut64(), UT64_MAX, and winkd_get_thread_at().
Referenced by rz_debug_dmp_threads(), rz_debug_winkd_threads(), and winkd_set_target().
bool winkd_lock_enter | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
Definition at line 23 of file winkd.c.
References rz_cons_break_pop(), rz_cons_break_push(), rz_cons_is_breaked(), rz_th_lock_tryenter(), and winkd_break().
Referenced by do_io_reply(), rz_debug_winkd_wait(), winkd_continue(), winkd_send_state_manipulate_req(), and winkd_sync().
bool winkd_lock_leave | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
Definition at line 34 of file winkd.c.
References rz_cons_break_pop(), and rz_th_lock_leave().
Referenced by do_io_reply(), rz_debug_winkd_wait(), winkd_continue(), winkd_send_state_manipulate_req(), and winkd_sync().
int winkd_query_mem | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | addr, | ||
int * | address_space, | ||
int * | flags | ||
) |
Definition at line 1276 of file winkd.c.
References addr, DbgKdQueryMemoryApi, flags, free(), NULL, PKT_REQ, req, and winkd_send_state_manipulate_req().
int winkd_read_at | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_OUT ut8 * | buf, | ||
const int | count | ||
) |
Definition at line 1377 of file winkd.c.
References count, DbgKdReadVirtualMemoryApi, and read_at().
Referenced by __read(), read_at_kernel_virtual(), rz_debug_winkd_attach(), and winkd_read_ver().
int winkd_read_at_phys | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_OUT ut8 * | buf, | ||
const int | count | ||
) |
Definition at line 1370 of file winkd.c.
References count, DbgKdReadPhysicalMemoryApi, and read_at().
Referenced by op_at_phys().
int winkd_read_at_uva | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx, |
ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_OUT ut8 * | buf, | ||
int | count | ||
) |
Definition at line 596 of file winkd.c.
References count, and winkd_op_at_uva().
Referenced by __read(), dmp_read(), read_at_uva_or_kernel(), winkd_get_target_base(), and winkd_list_modules().
|
inlinestatic |
Definition at line 133 of file winkd.h.
References rz_read_le32(), and rz_read_le64().
Referenced by get_current_process_and_thread(), rz_debug_dmp_attach(), rz_debug_dmp_init(), rz_debug_dmp_pids(), rz_debug_dmp_reg_read(), winkd_get_process_at(), winkd_list_process(), and winkd_walk_vadtree().
int winkd_read_reg | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
RZ_BORROW RZ_NONNULL RZ_OUT ut8 * | buf, | ||
int | size | ||
) |
Definition at line 1231 of file winkd.c.
References DbgKdGetContextApi, free(), memcpy(), NULL, PKT_REQ, realloc(), req, RZ_MIN, autogen_x86imm::tmp, and winkd_send_state_manipulate_req().
Referenced by rz_debug_winkd_reg_read().
bool winkd_read_ver | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
Definition at line 997 of file winkd.c.
References DBGKD_VERS_FLAG_DATA, DBGKD_VERS_FLAG_PTR64, free(), K_PaeEnabled, KD_MACH_AMD64, KD_MACH_I386, NULL, PFMT64x, PKT_REQ, req, RZ_LOG_DEBUG, RZ_LOG_ERROR, RZ_LOG_WARN, ut64(), winkd_get_profile(), winkd_get_sp(), winkd_read_at(), and winkd_send_state_manipulate_req().
Referenced by rz_debug_winkd_attach().
bool winkd_set_cpu | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
int | cpu | ||
) |
Definition at line 106 of file winkd.c.
References found, p, pid, rz_list_first(), rz_list_free(), WindThread::uniqueid, winkd_list_process(), and winkd_list_threads().
Referenced by rz_debug_dmp_select(), and rz_debug_winkd_select().
int winkd_sync | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx | ) |
Definition at line 1065 of file winkd.c.
References test_evm::end, free(), iob_write(), KD_E_IOERR, KD_E_OK, KD_INITIAL_PACKET_ID, KD_IO_NET, KD_IO_PIPE, KD_PACKET_TYPE_RESET, KD_PACKET_TYPE_STATE_CHANGE64, kd_read_packet(), kd_send_ctrl_packet(), NULL, PKT_STC, rz_list_free(), RZ_LOG_INFO, s, winkd_lock_enter(), winkd_lock_leave(), and winkd_wait_packet().
Referenced by rz_debug_winkd_attach().
bool winkd_va_to_pa | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx, |
ut64 | directory_table, | ||
ut64 | va, | ||
RZ_BORROW RZ_NONNULL RZ_OUT ut64 * | pa | ||
) |
Definition at line 860 of file winkd.c.
References is_page_large(), mask, PTE_PROTOTYPE, PTE_VALID, RZ_LOG_ERROR, autogen_x86imm::tmp, and ut64().
Referenced by winkd_op_at_uva().
int winkd_wait_packet | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut32 | type, | ||
RZ_NULLABLE RZ_OUT kd_packet_t ** | p | ||
) |
Definition at line 258 of file winkd.c.
References cpu, DbgKdCommandStringStateChange, DbgKdExceptionStateChange, DbgKdLoadSymbolsStateChange, do_io_reply(), free(), KD_E_BREAK, KD_E_MALFORMED, KD_E_OK, KD_INITIAL_PACKET_ID, KD_PACKET_CTRL, KD_PACKET_DATA, KD_PACKET_TYPE_ACKNOWLEDGE, KD_PACKET_TYPE_FILE_IO, KD_PACKET_TYPE_RESEND, KD_PACKET_TYPE_RESET, KD_PACKET_TYPE_STATE_CHANGE64, KD_PACKET_TYPE_STATE_MANIPULATE, KD_PACKET_TYPE_UNUSED, kd_read_packet(), load_symbol_path_is_valid(), NULL, p, path, PFMT32x, PFMT64x, PKT_IO, PKT_REQ, PKT_STC, req, RZ_LOG_DEBUG, RZ_LOG_VERBOSE, RZ_LOG_WARN, rz_str_endswith(), rz_sys_backtrace(), strdup(), and type.
Referenced by do_io_reply(), rz_debug_winkd_wait(), winkd_continue(), winkd_send_state_manipulate_req(), and winkd_sync().
void winkd_windmodule_free | ( | void * | ptr | ) |
Definition at line 611 of file winkd.c.
Referenced by dmp_get_modules(), and winkd_list_modules().
int winkd_write_at | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_IN const ut8 * | buf, | ||
const int | count | ||
) |
Definition at line 1384 of file winkd.c.
References count, DbgKdWriteVirtualMemoryApi, free(), KD_MAX_PAYLOAD, NULL, PKT_REQ, req, RZ_MIN, and winkd_send_state_manipulate_req().
Referenced by __write().
int winkd_write_at_phys | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
const ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_IN const ut8 * | buf, | ||
const int | count | ||
) |
Definition at line 1408 of file winkd.c.
References count, DbgKdWritePhysicalMemoryApi, free(), KD_MAX_PAYLOAD, memset(), PKT_REQ, req, RZ_MIN, and winkd_send_state_manipulate_req().
Referenced by op_at_phys().
int winkd_write_at_uva | ( | RZ_BORROW RZ_NONNULL WindCtx * | ctx, |
ut64 | offset, | ||
RZ_BORROW RZ_NONNULL RZ_IN const ut8 * | buf, | ||
int | count | ||
) |
Definition at line 600 of file winkd.c.
References count, and winkd_op_at_uva().
Referenced by __write(), and dmp_write().
bool winkd_write_reg | ( | RZ_BORROW RZ_NONNULL KdCtx * | ctx, |
ut32 | flags, | ||
RZ_BORROW RZ_NONNULL RZ_IN const ut8 * | buf, | ||
int | size | ||
) |
Definition at line 1179 of file winkd.c.
References DbgKdSetContextApi, DbgKdSetContextEx, flags, free(), KD_MAX_PAYLOAD, malloc(), memcpy(), NULL, PKT_REQ, req, RZ_FREE, RZ_LOG_DEBUG, RZ_MIN, ut64(), and winkd_send_state_manipulate_req().
Referenced by rz_debug_winkd_reg_write().