11 #define O_(n) kdctx->windctx.profile->f[n]
33 const struct context_type_arm *
ctx = (
void *)
buf;
41 const struct context_type_i386 *
ctx = (
void *)
buf;
79 kd_packet_t *pkt =
NULL;
95 stc = (kd_stc_64 *)pkt->data;
127 if (memcmp(mz,
"MZ", 2)) {
139 if (memcmp(pe,
"PE", 2)) {
161 if (strncmp(
desc->plugin->name,
"winkd", 6)) {
185 if (!
mod->timestamp || !
mod->size) {
187 RZ_LOG_ERROR(
"Could not get timestamp for kernel module\n");
194 char *exepath, *pdbpath;
198 &exepath, &pdbpath)) {
209 RZ_LOG_INFO(
"Trying to build profile dinamically by using the ntoskrnl.exe's PDB\n");
261 tag = (
int *)
b->data;
286 rz_list_foreach (pids, it,
p) {
294 newpid->
pid =
p->uniqueid;
306 if (
pid != old || tid != old_tid) {
342 rz_list_foreach (
threads, it, t) {
379 mod->addr_end =
m->addr +
m->size;
412 rz_list_foreach (
maps, it,
m) {
423 map->size =
m->end -
m->start;
424 map->addr =
m->start;
425 map->addr_end =
m->end;
456 #ifndef RZ_PLUGIN_INCORE
static RzList * maps(RzBinFile *bf)
RzDebugReasonType windows_exception_to_reason(ut32 exception_code)
void windows_print_exception_event(ut32 pid, ut32 tid, ut32 exception_code, bool second_chance)
void winkd_build_profile(WindCtx *ctx, RzTypeDB *db)
bool winkd_download_module_and_pdb(WindModule *module, const char *symserver, const char *symstore, char **exepath, char **pdbpath)
RZ_API void * rz_cons_sleep_begin(void)
RZ_API void rz_cons_sleep_end(void *user)
RzDebugPlugin rz_debug_plugin_winkd
static int rz_debug_winkd_select(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid, int tid)
static int rz_debug_winkd_attach(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid)
static void get_current_process_and_thread(RZ_BORROW RZ_NONNULL RzDebug *dbg, ut64 thread_address)
static int rz_debug_winkd_breakpoint(RZ_BORROW RZ_NONNULL RzBreakpoint *bp, RZ_BORROW RZ_NULLABLE RzBreakpointItem *b, bool set)
static RzList * rz_debug_winkd_frames(RZ_BORROW RZ_NONNULL RzDebug *dbg, ut64 at)
static int rz_debug_winkd_detach(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid)
RZ_API RzLibStruct rizin_plugin
static bool get_module_timestamp(ut64 addr, ut32 *timestamp, ut32 *sizeofimage)
static RzList * rz_debug_winkd_maps(RZ_BORROW RZ_NONNULL RzDebug *dbg)
static RzList * rz_debug_winkd_threads(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid)
static RzList * rz_debug_winkd_pids(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid)
static int rz_debug_winkd_reg_write(RZ_BORROW RZ_NONNULL RzDebug *dbg, int type, const ut8 *buf, int size)
static int rz_debug_winkd_reg_read(RZ_BORROW RZ_NONNULL RzDebug *dbg, int type, ut8 *buf, int size)
static RzList * rz_debug_winkd_modules(RZ_BORROW RZ_NONNULL RzDebug *dbg)
static char * rz_debug_winkd_reg_profile(RZ_BORROW RZ_NONNULL RzDebug *dbg)
static bool rz_debug_winkd_init(RZ_BORROW RZ_NONNULL RzDebug *dbg, void **user)
static RzDebugReasonType rz_debug_winkd_wait(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid)
static int rz_debug_winkd_continue(RZ_BORROW RZ_NONNULL RzDebug *dbg, int pid, int tid, int sig)
RZ_API void rz_debug_map_free(RzDebugMap *map)
size_t map(int syms, int left, int len)
static RzList * backtrace_generic(RZ_BORROW RZ_NONNULL RzDebug *dbg)
RZ_API void Ht_() free(HtName_(Ht) *ht)
@ DbgKdLoadSymbolsStateChange
@ DbgKdExceptionStateChange
@ KD_PACKET_TYPE_STATE_CHANGE64
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
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.
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
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API RzDebugPid * rz_debug_pid_free(RzDebugPid *pid)
@ RZ_DEBUG_REASON_UNKNOWN
@ RZ_DEBUG_REASON_NEW_LIB
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)
RZ_API const char * rz_file_dos_basename(RZ_BORROW RZ_NONNULL const char *path)
void(* RzListFree)(void *ptr)
#define RZ_LOG_VERBOSE(fmtstr,...)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
#define RZ_PTR_MOVE(d, s)
static struct sockaddr static addrlen static backlog const void static flags void flags
WindReadAt * read_at_kernel_virtual
struct rz_io_desc_t * desc
static uv_thread_t * threads
if(dbg->bits==RZ_SYS_BITS_64)
static bool backtrace_windows_x64(RZ_IN RzDebug *dbg, RZ_INOUT RzList **out_frames, RZ_INOUT struct context_type_amd64 *context)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
ut64 winkd_get_target_base(RZ_BORROW RZ_NONNULL WindCtx *ctx)
bool winkd_read_ver(RZ_BORROW RZ_NONNULL KdCtx *ctx)
ut32 winkd_get_target(RZ_BORROW RZ_NONNULL WindCtx *ctx)
WindThread * winkd_get_thread_at(RZ_BORROW RZ_NONNULL WindCtx *ctx, ut64 address)
bool winkd_lock_leave(RZ_BORROW RZ_NONNULL KdCtx *ctx)
int winkd_read_at(RZ_BORROW RZ_NONNULL KdCtx *ctx, const ut64 offset, RZ_BORROW RZ_NONNULL RZ_OUT ut8 *buf, const int count)
RzList * winkd_list_threads(RZ_BORROW RZ_NONNULL WindCtx *ctx)
int winkd_wait_packet(RZ_BORROW RZ_NONNULL KdCtx *ctx, const ut32 type, RZ_NULLABLE RZ_OUT kd_packet_t **p)
int winkd_read_reg(RZ_BORROW RZ_NONNULL KdCtx *ctx, RZ_BORROW RZ_NONNULL RZ_OUT ut8 *buf, int size)
RzList * winkd_list_maps(RZ_BORROW RZ_NONNULL WindCtx *ctx)
bool winkd_write_reg(RZ_BORROW RZ_NONNULL KdCtx *ctx, ut32 flags, RZ_BORROW RZ_NONNULL RZ_IN const ut8 *buf, int size)
ut32 winkd_get_target_thread(RZ_BORROW RZ_NONNULL WindCtx *ctx)
RzList * winkd_list_modules(RZ_BORROW RZ_NONNULL WindCtx *ctx)
bool winkd_set_cpu(RZ_BORROW RZ_NONNULL KdCtx *ctx, int cpu)
int winkd_continue(RZ_BORROW RZ_NONNULL KdCtx *ctx, bool handled)
bool winkd_set_target(RZ_BORROW RZ_NONNULL WindCtx *ctx, ut32 pid, ut32 tid)
bool winkd_lock_enter(RZ_BORROW RZ_NONNULL KdCtx *ctx)
int winkd_sync(RZ_BORROW RZ_NONNULL KdCtx *ctx)
WindProc * winkd_get_process_at(RZ_BORROW RZ_NONNULL WindCtx *ctx, ut64 address)
int winkd_bkpt(RZ_BORROW RZ_NONNULL KdCtx *ctx, const ut64 addr, const int set, const int hw, RZ_BORROW RZ_NONNULL int *handle)
RzList * winkd_list_process(RZ_BORROW RZ_NONNULL WindCtx *ctx)
int winkd_get_bits(RZ_BORROW RZ_NONNULL WindCtx *ctx)
@ K_OffsetKThreadApcProcess
static ut64 winkd_read_ptr_at(RZ_BORROW RZ_NONNULL WindCtx *ctx, RZ_BORROW RZ_NONNULL WindReadAt *read_at_func, ut64 at)