Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_userconf.h>
#include <rz_debug.h>
#include <rz_reg.h>
#include <rz_lib.h>
#include <rz_analysis.h>
#include <signal.h>
#include <sys/uio.h>
#include <errno.h>
#include "linux_debug.h"
#include "../procfs.h"
#include <sys/syscall.h>
#include <unistd.h>
#include <elf.h>
#include "linux_ptrace.h"
Go to the source code of this file.
Macros | |
#define | HAVE_YMM 0 |
#define | MAXPID 99999 |
#define | PRINT_FPU(fpregs) |
#define | PRINT_FPU_NOXMM(fpregs) |
#define HAVE_YMM 0 |
Definition at line 25 of file linux_debug.c.
#define MAXPID 99999 |
#define PRINT_FPU | ( | fpregs | ) |
Definition at line 976 of file linux_debug.c.
#define PRINT_FPU_NOXMM | ( | fpregs | ) |
Definition at line 986 of file linux_debug.c.
RzDebugPid* fill_pid_info | ( | const char * | info, |
const char * | path, | ||
int | tid | ||
) |
Definition at line 789 of file linux_debug.c.
References rz_debug_pid_t::gid, info(), NULL, rz_debug_pid_t::path, path, rz_debug_pid_t::pc, rz_debug_pid_t::pid, rz_debug_pid_t::ppid, rz_debug_pid_t::runnable, RZ_DBG_PROC_DEAD, RZ_DBG_PROC_RUN, RZ_DBG_PROC_SLEEP, RZ_DBG_PROC_STOP, RZ_DBG_PROC_ZOMBIE, RZ_NEW0, rz_debug_pid_t::status, strdup(), and rz_debug_pid_t::uid.
Referenced by linux_add_new_thread(), linux_pid_list(), and linux_thread_list().
Definition at line 709 of file linux_debug.c.
References dbg, linux_thread_list(), list(), rz_debug_t::main_pid, and rz_list_new().
Referenced by linux_attach().
Definition at line 614 of file linux_debug.c.
References dbg, fill_pid_info(), info(), linux_set_options(), rz_debug_t::n_threads, NULL, procfs_pid_slurp(), rz_debug_pid_new(), rz_list_append(), and rz_debug_t::threads.
Definition at line 718 of file linux_debug.c.
References dbg, get_pid_thread_list(), linux_attach_single_pid(), match_pid(), pid, rz_list_find(), and rz_debug_t::threads.
Referenced by linux_attach_new_process(), and linux_select().
Definition at line 451 of file linux_debug.c.
References dbg, linux_attach(), linux_detach_all(), NULL, rz_debug_t::pid, pid, rz_debug_select(), rz_list_free(), rz_debug_t::threads, and rz_debug_t::tid.
Referenced by linux_select(), and rz_debug_continue_kill().
Definition at line 676 of file linux_debug.c.
References dbg, eprintf, linux_set_options(), linux_stop_thread(), NULL, and PTRACE_ATTACH.
Referenced by linux_attach(), and linux_thread_list().
RzDebugReasonType linux_dbg_wait | ( | RzDebug * | dbg, |
int | pid | ||
) |
Definition at line 502 of file linux_debug.c.
References rz_debug_t::continue_all_threads, dbg, EINTR, eprintf, flags, linux_dbg_wait_break(), linux_dbg_wait_break_main(), linux_handle_new_task(), linux_handle_signals(), linux_ptrace_event(), linux_remove_thread(), rz_debug_t::main_pid, match_pid(), NULL, pid, rz_debug_t::reason, rz_cons_break_pop(), rz_cons_break_push(), rz_cons_context_is_main(), rz_cons_sleep_begin(), rz_cons_sleep_end(), RZ_DEBUG_REASON_DEAD, RZ_DEBUG_REASON_ERROR, RZ_DEBUG_REASON_NEW_PID, RZ_DEBUG_REASON_NONE, RZ_DEBUG_REASON_SIGNAL, RZ_DEBUG_REASON_UNKNOWN, rz_list_find(), rz_list_free(), status, rz_debug_t::threads, rz_debug_reason_t::tid, and rz_debug_reason_t::type.
|
static |
Definition at line 496 of file linux_debug.c.
References dbg, eprintf, linux_kill_thread(), and rz_debug_t::pid.
Referenced by linux_dbg_wait().
|
static |
Definition at line 470 of file linux_debug.c.
References dbg, eprintf, getpgid, linux_kill_thread(), rz_debug_t::pid, and rz_sys_perror.
Referenced by linux_dbg_wait().
Definition at line 1319 of file linux_debug.c.
References dirent::d_name, dd, desc, fail, len, memcpy(), NULL, path, pid, readdir, readlink, rz_debug_desc_free(), rz_debug_desc_new(), rz_list_append(), rz_list_free(), rz_list_newf(), RZ_LOG_ERROR, RZ_PERM_R, RZ_PERM_W, rz_strf, rz_sys_perror, stat, and type.
|
static |
Definition at line 410 of file linux_debug.c.
References dbg, rz_debug_t::main_pid, NULL, rz_debug_pid_t::pid, PTRACE_DETACH, and rz_debug_t::threads.
Referenced by linux_attach_new_process().
|
static |
Definition at line 330 of file linux_debug.c.
References dbg, linux_ptrace_event(), rz_debug_pid_t::pid, RZ_DEBUG_REASON_UNKNOWN, status, and rz_debug_t::threads.
Referenced by linux_dbg_wait().
Definition at line 103 of file linux_debug.c.
References b, rz_debug_t::bp, rz_debug_reason_t::bp_addr, dbg, eprintf, ESRCH, rz_debug_t::glob_libs, rz_debug_t::glob_unlibs, name, p, PFMT64x, rz_debug_t::pid, rz_debug_t::reason, rz_debug_t::reg, rz_bp_get_ending_at(), rz_cons_is_breaked(), RZ_DEBUG_REASON_ABORT, RZ_DEBUG_REASON_BREAKPOINT, RZ_DEBUG_REASON_DEAD, RZ_DEBUG_REASON_EXIT_LIB, RZ_DEBUG_REASON_NEW_LIB, RZ_DEBUG_REASON_SEGFAULT, RZ_DEBUG_REASON_SIGNAL, RZ_DEBUG_REASON_STEP, RZ_DEBUG_REASON_USERSUSP, rz_debug_reg_get(), rz_debug_select(), rz_reg_get_name(), RZ_REG_NAME_A0, RZ_REG_NAME_A1, rz_str_appendf(), rz_str_startswith(), rz_sys_perror, rz_debug_reason_t::signum, rz_debug_t::stopaddr, rz_debug_t::tid, TRAP_TRACE, rz_debug_reason_t::type, and ut64().
Referenced by linux_dbg_wait().
RzDebugInfo* linux_info | ( | RzDebug * | dbg, |
const char * | arg | ||
) |
Definition at line 745 of file linux_debug.c.
References dbg, found, rz_debug_pid_t::gid, linux_thread_list(), NULL, rz_debug_t::pid, rz_debug_pid_t::pid, rdi, read_link(), RZ_DBG_PROC_STOP, rz_file_slurp(), rz_list_free(), rz_list_new(), RZ_NEW0, snprintf, rz_debug_pid_t::status, rz_debug_t::threads, rz_debug_t::tid, and rz_debug_pid_t::uid.
Definition at line 629 of file linux_debug.c.
References __NR_tkill, and syscall.
Referenced by linux_dbg_wait_break(), linux_dbg_wait_break_main(), and linux_stop_thread().
Definition at line 838 of file linux_debug.c.
References dirent::d_name, fill_pid_info(), i, info(), list(), NULL, path, pid, rz_debug_pid_t::ppid, procfs_pid_slurp(), readdir, RZ_DBG_PROC_STOP, rz_debug_pid_free(), rz_debug_pid_new(), rz_list_append(), rz_list_free(), and rz_sys_perror.
char* linux_reg_profile | ( | RzDebug * | dbg | ) |
Definition at line 55 of file linux_debug.c.
References rz_debug_t::bits, rz_debug_t::bp, dbg, rz_bp_t::endian, NULL, and RZ_SYS_BITS_32.
Definition at line 1090 of file linux_debug.c.
References a, dbg, eprintf, i, iov, memcpy(), memset(), NULL, pid, print_fpu(), PTRACE_GETFPREGS, PTRACE_GETFPXREGS, PTRACE_GETREGS, PTRACE_PEEKUSER, regs, rz_debug_ptrace_get_x86_xstate(), RZ_DEBUG_REG_T, RZ_MIN, rz_offsetof, RZ_REG_TYPE_DRX, RZ_REG_TYPE_FLG, RZ_REG_TYPE_FPU, RZ_REG_TYPE_GPR, RZ_REG_TYPE_MMX, RZ_REG_TYPE_SEG, RZ_REG_TYPE_XMM, RZ_REG_TYPE_YMM, rz_sys_perror, rz_debug_t::tid, and type.
Definition at line 1265 of file linux_debug.c.
References dbg, eprintf, false, i, NT_PRSTATUS, NULL, pid, PTRACE_POKEUSER, PTRACE_SETFPREGS, PTRACE_SETREGS, RZ_DEBUG_REG_T, rz_offsetof, RZ_REG_TYPE_DRX, RZ_REG_TYPE_FPU, RZ_REG_TYPE_GPR, rz_sys_perror, rz_debug_t::tid, type, and val.
|
static |
Definition at line 197 of file linux_debug.c.
References b, rz_debug_t::bp, rz_bp_t::bps, dbg, rz_debug_t::forked_pid, rz_debug_t::pid, rz_bp_get_index_at(), rz_bp_restore(), rz_debug_bp_update(), rz_debug_drx_unset(), rz_debug_reg_sync(), rz_debug_select(), RZ_REG_TYPE_DRX, and rz_debug_t::tid.
Definition at line 430 of file linux_debug.c.
References dbg, rz_debug_t::n_threads, rz_debug_pid_t::pid, rz_list_delete(), and rz_debug_t::threads.
Referenced by linux_dbg_wait().
Definition at line 444 of file linux_debug.c.
References dbg, linux_attach(), linux_attach_new_process(), rz_debug_t::pid, and pid.
Definition at line 383 of file linux_debug.c.
References dbg, pid, rz_cons_sleep_begin(), rz_cons_sleep_end(), rz_debug_t::trace_aftersyscall, rz_debug_t::trace_execs, and rz_debug_t::trace_forks.
Referenced by linux_add_new_thread(), and linux_attach_single_pid().
Definition at line 369 of file linux_debug.c.
References dbg, pid, PTRACE_SINGLESTEP, and rz_debug_t::tid.
Definition at line 640 of file linux_debug.c.
References dbg, linux_kill_thread(), and status.
Referenced by linux_attach_single_pid(), and linux_stop_threads().
Definition at line 660 of file linux_debug.c.
References dbg, linux_stop_thread(), rz_debug_pid_t::pid, and rz_debug_t::threads.
Definition at line 875 of file linux_debug.c.
References dirent::d_name, dbg, fill_pid_info(), i, info(), linux_attach_single_pid(), list(), MAXPID, rz_debug_t::n_threads, NULL, rz_debug_pid_t::pc, pc, pid, procfs_pid_slurp(), readdir, rz_debug_map_sync(), rz_debug_pid_free(), rz_debug_pid_new(), rz_debug_reg_get(), rz_debug_reg_sync(), rz_file_is_directory(), rz_list_append(), rz_list_free(), RZ_REG_TYPE_GPR, snprintf, rz_debug_t::tid, and ut64().
Referenced by get_pid_thread_list(), and linux_info().
Definition at line 608 of file linux_debug.c.
References rz_debug_pid_t::pid, and pid.
Referenced by linux_attach(), and linux_dbg_wait().
|
static |
Definition at line 995 of file linux_debug.c.
References a, b, c, d, f, i, PFMT64x, PRINT_FPU, PRINT_FPU_NOXMM, rz_cons_printf(), and ut64().
Referenced by linux_reg_read().
Definition at line 732 of file linux_debug.c.
References NULL, path, pid, readlink, snprintf, and strdup().
Referenced by linux_info().
Definition at line 50 of file linux_debug.c.
Referenced by linux_reg_read().