27 #include <machine/reg.h>
41 #define PTRACE_PEEKTEXT PT_READ_I
42 #define PTRACE_POKETEXT PT_WRITE_I
43 #define PTRACE_PEEKDATA PT_READ_D
44 #define PTRACE_POKEDATA PT_WRITE_D
45 #define PTRACE_ATTACH PT_ATTACH
46 #define PTRACE_DETACH PT_DETACH
47 #define PTRACE_SINGLESTEP PT_STEP
48 #define PTRACE_CONT PT_CONTINUE
49 #define PTRACE_GETREGS PT_GETREGS
50 #define PTRACE_SETREGS PT_SETREGS
51 #define PTRACE_SYSCALL PT_STEP
54 #define SNAP_PAGE_SIZE 4096
55 #define CHECK_POINT_LIMIT 0x100000
613 static inline void *rz_debug_ptrace_func(
RzDebug *
dbg,
void *(*func)(
void *),
void *user) {
651 - change memory protections
653 - filedescriptor set/get/
mod..
static const char * arg(RzAnalysis *a, csh *handle, cs_insn *insn, char *buf, int n)
static RzList * maps(RzBinFile *bf)
int bits(struct state *s, int need)
static RzNumCalcValue expr(RzNum *, RzNumCalc *, int)
RZ_API void rz_debug_trace_print(RzDebug *dbg, RzCmdStateOutput *state, ut64 offset)
RZ_API void rz_debug_map_list_visual(RzDebug *dbg, ut64 addr, const char *input, int colors)
RZ_API void rz_debug_traces_ascii(RzDebug *dbg, ut64 offset)
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static sync static getppid static getegid const char static filename request
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
RZ_API int rz_debug_desc_open(RzDebug *dbg, const char *path)
RZ_API int rz_debug_desc_seek(RzDebug *dbg, int fd, ut64 addr)
RZ_API int rz_debug_desc_list(RzDebug *dbg, int rad)
RZ_API int rz_debug_desc_dup(RzDebug *dbg, int fd, int newfd)
RZ_API int rz_debug_desc_write(RzDebug *dbg, int fd, ut64 addr, int len)
RZ_API int rz_debug_desc_close(RzDebug *dbg, int fd)
RZ_API RzDebugDesc * rz_debug_desc_new(int fd, char *path, int perm, int type, int off)
RZ_API int rz_debug_desc_read(RzDebug *dbg, int fd, ut64 addr, int len)
RZ_API void rz_debug_desc_free(RzDebugDesc *p)
RzDebugPlugin rz_debug_plugin_bf
RzDebugPlugin rz_debug_plugin_bochs
RzDebugPlugin rz_debug_plugin_dmp
RzDebugPlugin rz_debug_plugin_esil
RzDebugPlugin rz_debug_plugin_gdb
RzDebugPlugin rz_debug_plugin_io
RzDebugPlugin rz_debug_plugin_native
RzDebugPlugin rz_debug_plugin_null
RzDebugPlugin rz_debug_plugin_qnx
RzDebugPlugin rz_debug_plugin_rap
RzDebugPlugin rz_debug_plugin_windbg
RzDebugPlugin rz_debug_plugin_winkd
RZ_API ut64 rz_debug_esil_continue(RzDebug *dbg)
RZ_API ut64 rz_debug_esil_step(RzDebug *dbg, ut32 count)
RZ_API int rz_debug_esil_stepi(RzDebug *d)
RZ_API void rz_debug_esil_prestep(RzDebug *d, int p)
RZ_API void rz_debug_esil_watch_list(RzDebug *dbg)
RZ_API int rz_debug_esil_watch_empty(RzDebug *dbg)
RZ_API void rz_debug_esil_watch_reset(RzDebug *dbg)
RZ_API void rz_debug_esil_watch(RzDebug *dbg, int rwx, int dev, const char *expr)
RZ_API RzList * rz_debug_map_list_new(void)
RZ_API RZ_BORROW RzList * rz_debug_map_list(RzDebug *dbg, bool user_map)
Get RzList* of memory maps for the process currently being debugged.
RZ_API RzDebugMap * rz_debug_map_get(RzDebug *dbg, ut64 addr)
RZ_API void rz_debug_map_free(RzDebugMap *map)
RZ_API int rz_debug_map_dealloc(RzDebug *dbg, RzDebugMap *map)
RZ_API bool rz_debug_map_sync(RzDebug *dbg)
RZ_API RzDebugMap * rz_debug_map_new(char *name, ut64 addr, ut64 addr_end, int perm, int user)
RZ_API RzDebugMap * rz_debug_map_alloc(RzDebug *dbg, ut64 addr, int size, bool thp)
RZ_API RzList * rz_debug_modules_list(RzDebug *dbg)
RZ_API ut64 rz_debug_num_callback(RzNum *userptr, const char *str, int *ok)
RZ_API ut64 rz_debug_reg_get(RzDebug *dbg, const char *name)
RZ_API int rz_debug_reg_sync(RzDebug *dbg, int type, int write)
RZ_API int rz_debug_reg_set(struct rz_debug_t *dbg, const char *name, ut64 num)
RZ_API bool rz_debug_reg_profile_sync(RzDebug *dbg)
RZ_API void rz_debug_session_free(RzDebugSession *session)
RZ_API bool rz_debug_add_checkpoint(RzDebug *dbg)
RZ_API RzDebugSession * rz_debug_session_new(void)
RZ_API void rz_debug_session_deserialize(RzDebugSession *session, Sdb *db)
RZ_API bool rz_debug_session_add_reg_change(RzDebugSession *session, int arena, ut64 offset, ut64 data)
RZ_API void rz_debug_session_restore_reg_mem(RzDebug *dbg, ut32 cnum)
RZ_API bool rz_debug_session_save(RzDebugSession *session, const char *path)
RZ_API void rz_debug_session_serialize(RzDebugSession *session, Sdb *db)
RZ_API void rz_debug_session_list_memory(RzDebug *dbg)
RZ_API bool rz_debug_session_add_mem_change(RzDebugSession *session, ut64 addr, ut8 data)
RZ_API bool rz_debug_session_load(RzDebug *dbg, const char *path)
RZ_API void rz_debug_signal_setup(RzDebug *dbg, int num, int opt)
static struct @231 signals[]
RZ_API int rz_debug_signal_set(RzDebug *dbg, int num, ut64 addr)
RZ_API RzList * rz_debug_kill_list(RzDebug *dbg)
RZ_API void rz_debug_signal_init(RzDebug *dbg)
RZ_API void rz_debug_signal_list(RzDebug *dbg, RzOutputMode mode)
RZ_API int rz_debug_signal_send(RzDebug *dbg, int num)
RZ_API int rz_debug_signal_what(RzDebug *dbg, int num)
RZ_API int rz_debug_kill_setup(RzDebug *dbg, int sig, int action)
size_t map(int syms, int left, int len)
RZ_API bool rz_debug_can_kill(RzDebug *dbg)
check whether rz_debug_kill() will not definitely fail (for example because kill is unimplemented by ...
RZ_API int rz_debug_kill(RzDebug *dbg, int pid, int tid, int sig)
RZ_API bool rz_debug_goto_cnum(RzDebug *dbg, ut32 cnum)
RZ_API int rz_debug_drx_set(RzDebug *dbg, int idx, ut64 addr, int len, int rwx, int g)
RZ_API int rz_debug_start(RzDebug *dbg, const char *cmd)
RZ_API int rz_debug_continue_syscall(RzDebug *dbg, int sc)
RZ_API RZ_OWN RzDebug * rz_debug_new(RZ_BORROW RZ_NONNULL RzBreakpointContext *bp_ctx)
RZ_API void rz_debug_bp_rebase(RzDebug *dbg, ut64 old_base, ut64 new_base)
RZ_API int rz_debug_step_back(RzDebug *dbg, int steps)
RZ_API int rz_debug_step_over(RzDebug *dbg, int steps)
RZ_API int rz_debug_step(RzDebug *dbg, int steps)
RZ_API int rz_debug_map_protect(RzDebug *dbg, ut64 addr, int size, int perms)
RZ_API RZ_BORROW RzBreakpointItem * rz_debug_bp_add(RZ_NONNULL RzDebug *dbg, ut64 addr, int hw, bool watch, int rw, RZ_NULLABLE const char *module, st64 m_delta)
RZ_API int rz_debug_continue_until_optype(RzDebug *dbg, int type, int over)
RZ_API bool rz_debug_continue_back(RzDebug *dbg)
RZ_API int rz_debug_continue_until(RzDebug *dbg, ut64 addr)
RZ_API RzDebug * rz_debug_free(RzDebug *dbg)
RZ_API int rz_debug_drx_unset(RzDebug *dbg, int idx)
RZ_API int rz_debug_continue_until_nonblock(RzDebug *dbg, ut64 addr)
RZ_API int rz_debug_detach(RzDebug *dbg, int pid)
RZ_API const char * rz_debug_reason_to_string(int type)
RZ_API void rz_debug_bp_update(RzDebug *dbg)
RZ_API int rz_debug_continue(RzDebug *dbg)
RZ_API int rz_debug_stop(RzDebug *dbg)
RZ_API RzDebugReasonType rz_debug_wait(RzDebug *dbg, RzBreakpointItem **bp)
RZ_API int rz_debug_continue_syscalls(RzDebug *dbg, int *sc, int n_sc)
RZ_API int rz_debug_child_clone(RzDebug *dbg)
RZ_API int rz_debug_step_cnum(RzDebug *dbg, int steps)
RZ_API int rz_debug_child_fork(RzDebug *dbg)
RZ_API int rz_debug_attach(RzDebug *dbg, int pid)
RZ_API RzDebugInfo * rz_debug_info(RzDebug *dbg, const char *arg)
RZ_API void rz_debug_tracenodes_reset(RzDebug *dbg)
RZ_API int rz_debug_continue_until_nontraced(RzDebug *dbg)
RZ_API void rz_debug_drx_list(RzDebug *dbg)
RZ_API int rz_debug_continue_pass_exception(RzDebug *dbg)
RZ_API ut64 rz_debug_get_baddr(RzDebug *dbg, const char *file)
RZ_API int rz_debug_startv(struct rz_debug_t *dbg, int argc, char **argv)
RZ_API ut64 rz_debug_execute(RzDebug *dbg, const ut8 *buf, int len, int restore)
RZ_API bool rz_debug_is_dead(RzDebug *dbg)
RZ_API int rz_debug_continue_kill(RzDebug *dbg, int sig)
RZ_API bool rz_debug_set_arch(RzDebug *dbg, const char *arch, int bits)
RZ_API bool rz_debug_select(RzDebug *dbg, int pid, int tid)
RZ_API RzList * rz_debug_frames(RzDebug *dbg, ut64 at)
RZ_API RzDebugReasonType rz_debug_stop_reason(RzDebug *dbg)
RZ_API void rz_debug_info_free(RzDebugInfo *rdi)
static void list(RzEgg *egg)
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 static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
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
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 static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask dev
static static fork const void static count static fd const char const char static newpath char char argv
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment signal
static const char struct stat static buf struct stat static buf static vhangup int status
RZ_API RzList * rz_debug_pids(RzDebug *dbg, int pid)
RZ_API RzDebugPid * rz_debug_pid_free(RzDebugPid *pid)
RZ_API RzDebugPid * rz_debug_pid_new(const char *path, int pid, int uid, char status, ut64 pc)
RZ_API int rz_debug_pid_list(RzDebug *dbg, int pid, char fmt)
RZ_API int rz_debug_thread_list(RzDebug *dbg, int pid, char fmt)
RZ_API bool rz_debug_use(RzDebug *dbg, const char *str)
RZ_API void rz_debug_plugin_init(RzDebug *dbg)
RZ_API bool rz_debug_plugin_add(RzDebug *dbg, RzDebugPlugin *foo)
RZ_API bool rz_debug_plugin_set_reg_profile(RzDebug *dbg, const char *profile)
int(* RzBreakpointCallback)(struct rz_bp_t *bp, RzBreakpointItem *b, bool set)
struct rz_debug_t RzDebug
@ RZ_DEBUG_REASON_NEW_TID
@ RZ_DEBUG_REASON_WRITERR
@ RZ_DEBUG_REASON_READERR
@ RZ_DEBUG_REASON_ILLEGAL
@ RZ_DEBUG_REASON_TRACEPOINT
@ RZ_DEBUG_REASON_UNKNOWN
@ RZ_DEBUG_REASON_BREAKPOINT
@ RZ_DEBUG_REASON_USERSUSP
@ RZ_DEBUG_REASON_NEW_LIB
@ RZ_DEBUG_REASON_EXIT_LIB
@ RZ_DEBUG_REASON_SEGFAULT
@ RZ_DEBUG_REASON_NEW_PID
@ RZ_DEBUG_REASON_EXIT_PID
@ RZ_DEBUG_REASON_EXIT_TID
@ RZ_DEBUG_REASON_DIVBYZERO
struct rz_debug_signal_t RzDebugSignal
struct rz_debug_trace_t RzDebugTrace
RZ_LIB_VERSION_HEADER(rz_debug)
struct rz_session_header RSessionHeader
struct rz_debug_snap_t RzDebugSnap
struct rz_snap_entry RSnapEntry
struct rz_debug_desc_plugin_t RzDebugDescPlugin
struct rz_debug_tracepoint_t RzDebugTracepoint
struct rz_debug_info_t RzDebugInfo
struct rz_diff_entry RzDiffEntry
struct rz_debug_pid_t RzDebugPid
struct rz_debug_reason_t RzDebugReason
struct rz_debug_session_t RzDebugSession
struct rz_debug_map_t RzDebugMap
struct rz_debug_plugin_t RzDebugPlugin
struct rz_debug_checkpoint_t RzDebugCheckpoint
struct rz_debug_frame_t RzDebugFrame
struct rz_backtrace_t RzBacktrace
struct rz_debug_desc_t RzDebugDesc
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
RzOutputMode
Enum to describe the way data are printed.
RZ_API void rz_serialize_debug_save(RZ_NONNULL Sdb *db, RZ_NONNULL RzDebug *dbg)
Serialize debug state (RzDebug) and save to a sdb.
RZ_API bool rz_serialize_debug_load(RZ_NONNULL Sdb *db, RZ_NONNULL RzDebug *dbg, RZ_NULLABLE RzSerializeResultInfo *res)
Load a serialized debug state to a RzDebug instance.
RZ_API bool rz_debug_snap_is_equal(RzDebug *dbg, RzDebugSnap *a, RzDebugSnap *b)
RZ_API bool rz_debug_snap_contains(RzDebugSnap *snap, ut64 addr)
RZ_API RzDebugSnap * rz_debug_snap_map(RzDebug *dbg, RzDebugMap *map)
RZ_API ut8 * rz_debug_snap_get_hash(RzDebug *dbg, RzDebugSnap *snap, RzHashSize *size)
RZ_API void rz_debug_snap_free(RzDebugSnap *snap)
Outer context of mappings/etc. in which the RzBreakpoint instance will operate in....
Represent the output state of a command handler.
RzRegArena * arena[RZ_REG_TYPE_LAST]
int(* write)(int fd, ut64 addr, int len)
int(* dup)(int fd, int newfd)
int(* seek)(int fd, ut64 addr)
int(* open)(const char *path)
int(* read)(int fd, ut64 addr, int len)
bool(* gcore)(RzDebug *dbg, char *path, RzBuffer *dest)
int(* map_dealloc)(RzDebug *dbg, ut64 addr, int size)
int(* detach)(RzDebug *dbg, int pid)
bool(* kill)(RzDebug *dbg, int pid, int tid, int sig)
int(* attach)(RzDebug *dbg, int pid)
int(* step_over)(RzDebug *dbg)
int(* reg_read)(RzDebug *dbg, int type, ut8 *buf, int size)
Callback to be used for RzBreakpoint. When called, RzBreakpoint.user points to the RzDebug.
int(* drx)(RzDebug *dbg, int n, ut64 addr, int size, int rwx, int g, int api_type)
int(* startv)(int argc, char **argv)
int(* reg_write)(RzDebug *dbg, int type, const ut8 *buf, int size)
int(* select)(RzDebug *dbg, int pid, int tid)
int(* contsc)(RzDebug *dbg, int pid, int sc)
RzDebugReasonType(* wait)(RzDebug *dbg, int pid)
RzList(* backtrace)(RzDebug *dbg, int count)
int(* map_protect)(RzDebug *dbg, ut64 addr, int size, int perms)
void(* fini)(RzDebug *debug, void *user)
int(* cont)(RzDebug *dbg, int pid, int tid, int sig)
RzBreakpointCallback breakpoint
int(* step)(RzDebug *dbg)
int(* stop)(RzDebug *dbg)
int(* set_reg_profile)(RzDebug *dbg, const char *str)
bool(* init)(RzDebug *dbg, void **user)
RzDebugCheckpoint * cur_chkpt
RzDebugRecoilMode recoil_mode
bool continue_all_threads
struct rz_debug_plugin_t * cur
bool nt_x86_xstate_supported
Track whether X86_FEATURE_XSAVE feature is supported on current kernel.
int hitinfo
XXX: MUST SET ///.
RZ_API void rz_debug_trace_at(RzDebug *dbg, const char *str)
RZ_API int rz_debug_trace_tag(RzDebug *dbg, int tag)
RZ_API RZ_OWN RzList * rz_debug_traces_info(RzDebug *dbg, ut64 offset)
RZ_API RzDebugTracepoint * rz_debug_trace_add(RzDebug *dbg, ut64 addr, int size)
RZ_API RzDebugTracepoint * rz_debug_trace_get(RzDebug *dbg, ut64 addr)
RZ_API void rz_debug_trace_free(RzDebugTrace *trace)
RZ_API RzDebugTrace * rz_debug_trace_new(void)
RZ_API void rz_debug_trace_op(RzDebug *dbg, RzAnalysisOp *op)
RZ_API bool rz_debug_trace_ins_after(RzDebug *dbg)
RZ_API int rz_debug_trace_pc(RzDebug *dbg, ut64 pc)
RZ_API bool rz_debug_trace_ins_before(RzDebug *dbg)
RZ_API void rz_debug_trace_reset(RzDebug *dbg)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)