Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
attaches to a process
pid | of the process to attach to |
Definition at line 439 of file core.c.
References buffer_size, calloc(), cmd, CMD_ATTACH, test_evm::end, free(), g, gdbr_check_extended_mode(), gdbr_lock_enter(), gdbr_lock_leave(), handle_attach(), int, NULL, pid, read_packet(), reg_cache, send_msg(), and snprintf.
Referenced by __open().
checks for extended mode availability
Definition at line 406 of file core.c.
References test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), read_packet(), reg_cache, send_ack(), and send_msg().
Referenced by gdbr_attach().
checks which subcommands of the vCont packet are supported
Definition at line 335 of file core.c.
References test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), NULL, read_packet(), send_ack(), and send_msg().
Referenced by gdbr_connect().
Definition at line 1539 of file core.c.
References test_evm::end, eprintf, g, gdbr_lock_enter(), gdbr_lock_leave(), handle_vFile_close(), read_packet(), send_msg(), and snprintf.
Referenced by gdbr_parse_processes_xml(), and rz_debug_gdb_map_get().
Function connects to a gdbserver instance.
server | string that represents the host |
number | that represents the port |
Definition at line 155 of file core.c.
References test_evm::end, g, GDB_MAX_PKTSZ, GDB_REMOTE_TYPE_LLDB, gdbr_break_process(), gdbr_check_vcont(), gdbr_connect_lldb(), gdbr_lock_enter(), gdbr_lock_leave(), gdbr_read_target_xml(), gdbr_select(), handle_qC(), handle_qSupported(), i, message, NULL, QSUPPORTED_MAX_RETRIES, read_packet(), reg_cache_init(), rz_cons_break_pop(), rz_cons_break_push(), rz_cons_sleep_begin(), rz_cons_sleep_end(), RZ_MAX, RZ_MIN, rz_socket_close(), rz_socket_connect_serial(), rz_socket_connect_tcp, rz_sys_getenv(), sdb_fmt(), send_ack(), and send_msg().
Referenced by __open().
Definition at line 950 of file core.c.
References CMD_C_CONT, CMD_C_CONT_SIG, command, test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), NULL, send_vcont(), snprintf, and write_thread_id().
Referenced by rz_debug_gdb_continue().
detaches from a process
pid | of the process to detach from (only the multiprocess/pid variant) |
Definition at line 495 of file core.c.
References test_evm::end, g, gdbr_disconnect(), gdbr_lock_enter(), gdbr_lock_leave(), reg_cache, and send_msg().
Referenced by __system(), and rz_debug_gdb_detach().
Definition at line 520 of file core.c.
References buffer_size, calloc(), cmd, CMD_DETACH_MP, test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), NULL, pid, read_packet(), reg_cache, send_ack(), send_msg(), and snprintf.
Referenced by __system(), and rz_debug_gdb_detach().
disconnects the lib
Definition at line 283 of file core.c.
References test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), reg_cache, and rz_socket_close().
Referenced by __close(), gdbr_detach(), stop_reason_exit(), and stop_reason_terminated().
Get absolute name of file executed to create a process
Definition at line 1635 of file core.c.
References test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), len, memset(), msg, NULL, off, path, PFMT64x, pid, read_packet(), rz_str_append(), send_ack(), send_msg(), snprintf, and ut64().
Referenced by __open(), __system(), gdbr_pids_list(), gdbr_threads_list(), and rz_debug_gdb_info().
Get offset of lowest segment returned by 'qOffsets'
Definition at line 1931 of file core.c.
References test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), isxdigit, min, NULL, off, read_packet(), rz_str_startswith(), send_ack(), send_msg(), UINT64_MAX, and ut64().
Referenced by rz_debug_gdb_map_get().
void gdbr_invalidate_reg_cache | ( | void | ) |
invalidates the reg cache
Definition at line 1570 of file core.c.
References reg_cache.
Referenced by __system().
kills the process the remote gdbserver is debugging (TODO: handle pid)
pid | of the process to detach from (only the multiprocess/pid variant) \retuns a failure code (currently -1) or 0 if call successfully |
Definition at line 572 of file core.c.
References test_evm::end, g, gdbr_kill_pid(), gdbr_lock_enter(), gdbr_lock_leave(), reg_cache, and send_msg().
Referenced by rz_debug_gdb_kill().
Definition at line 605 of file core.c.
References buffer_size, calloc(), cmd, CMD_KILL_MP, test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), NULL, pid, read_packet(), reg_cache, send_ack(), send_msg(), and snprintf.
Referenced by gdbr_kill().
Acquires the gdbr lock and sets up breaking.
Definition at line 105 of file core.c.
References g, gdbr_break_process(), rz_cons_break_push(), rz_cons_sleep_begin(), rz_cons_sleep_end(), and rz_th_lock_enter().
Referenced by __system(), gdbr_attach(), gdbr_check_extended_mode(), gdbr_check_vcont(), gdbr_close_file(), gdbr_connect(), gdbr_connect_lldb(), gdbr_continue(), gdbr_detach(), gdbr_detach_pid(), gdbr_disconnect(), gdbr_exec_file_read(), gdbr_get_baddr(), gdbr_is_thread_dead(), gdbr_kill(), gdbr_kill_pid(), gdbr_open_file(), gdbr_pids_list(), gdbr_read_file(), gdbr_read_memory(), gdbr_read_memory_page(), gdbr_read_registers_lldb(), gdbr_select(), gdbr_send_qRcmd(), gdbr_step(), gdbr_stop_reason(), gdbr_threads_list(), gdbr_write_bin_registers(), gdbr_write_memory(), gdbr_write_reg(), gdbr_write_register(), gdbr_write_registers(), remove_bp(), send_vcont(), set_bp(), and test_command().
void gdbr_lock_leave | ( | libgdbr_t * | g | ) |
Releases the gdbr lock.
Definition at line 117 of file core.c.
References assert(), g, rz_cons_break_pop(), and rz_th_lock_leave().
Referenced by __system(), gdbr_attach(), gdbr_check_extended_mode(), gdbr_check_vcont(), gdbr_close_file(), gdbr_connect(), gdbr_connect_lldb(), gdbr_continue(), gdbr_detach(), gdbr_detach_pid(), gdbr_disconnect(), gdbr_exec_file_read(), gdbr_get_baddr(), gdbr_is_thread_dead(), gdbr_kill(), gdbr_kill_pid(), gdbr_open_file(), gdbr_pids_list(), gdbr_read_file(), gdbr_read_memory(), gdbr_read_memory_page(), gdbr_read_registers(), gdbr_read_registers_lldb(), gdbr_select(), gdbr_send_qRcmd(), gdbr_step(), gdbr_stop_reason(), gdbr_threads_list(), gdbr_write_bin_registers(), gdbr_write_memory(), gdbr_write_reg(), gdbr_write_register(), gdbr_write_registers(), remove_bp(), send_vcont(), set_bp(), and test_command().
File read from remote target (only one file open at a time for now)
Definition at line 1445 of file core.c.
References buf, buf_len, calloc(), test_evm::end, eprintf, flags, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), handle_vFile_open(), pack_hex(), read_packet(), send_msg(), and snprintf.
Referenced by gdbr_parse_processes_xml(), and rz_debug_gdb_map_get().
get a list of the child processes of the given pid
Definition at line 1731 of file core.c.
References test_evm::end, eprintf, free(), g, gdbr_exec_file_read(), gdbr_lock_enter(), gdbr_lock_leave(), gdbr_read_processes_xml(), rz_debug_pid_t::gid, list(), NULL, rz_debug_pid_t::path, rz_debug_pid_t::pid, pid, rz_debug_pid_t::ppid, read_packet(), read_thread_id(), rz_debug_pid_t::runnable, RZ_DBG_PROC_STOP, rz_list_append(), rz_list_free(), rz_list_new(), RZ_NEW0, send_ack(), send_msg(), rz_debug_pid_t::status, strdup(), and rz_debug_pid_t::uid.
Referenced by rz_debug_gdb_pids().
Definition at line 1485 of file core.c.
References command, test_evm::end, eprintf, g, GDB_MAX_PKTSZ, gdbr_lock_enter(), gdbr_lock_leave(), handle_vFile_pread(), INT32_MAX, PFMT64d, PFMT64x, read_packet(), RZ_MAX, RZ_MIN, send_msg(), snprintf, and ut64().
Referenced by gdbr_parse_processes_xml(), and rz_debug_gdb_map_get().
Definition at line 812 of file core.c.
References test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), gdbr_read_memory_page(), len, and autogen_x86imm::tmp.
Referenced by debug_gdb_read_at().
Definition at line 685 of file core.c.
References CMD_READREGS, test_evm::end, g, GDB_REMOTE_TYPE_LLDB, gdbr_lock_leave(), gdbr_lock_tryenter(), gdbr_read_registers_lldb(), handle_g(), memcpy(), memset(), read_packet(), reg_cache, and send_msg().
Referenced by gdbr_write_reg(), gdbr_write_registers(), and rz_debug_gdb_reg_read().
Definition at line 1377 of file core.c.
References BREAKPOINT, g, and remove_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1392 of file core.c.
References ACCESS_WATCHPOINT, g, and remove_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1380 of file core.c.
References g, HARDWARE_BREAKPOINT, and remove_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1388 of file core.c.
References g, READ_WATCHPOINT, and remove_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1384 of file core.c.
References g, remove_bp(), and WRITE_WATCHPOINT.
Referenced by rz_debug_gdb_breakpoint().
Select pid-tid
Definition at line 304 of file core.c.
References cmd, test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), pid, read_packet(), reg_cache, send_ack(), send_msg(), and write_thread_id().
Referenced by gdbr_connect(), rz_debug_gdb_select(), and rz_debug_gdb_wait().
int gdbr_send_qRcmd | ( | libgdbr_t * | g, |
const char * | cmd, | ||
PrintfCallback | cb_printf | ||
) |
sends a qRcmd packet which basically passes a command to the remote target's interpreter.
Definition at line 1574 of file core.c.
References buf, calloc(), cmd, test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), isxdigit, len, pack_hex(), read_packet(), reg_cache, send_ack(), send_msg(), and unpack_hex().
Referenced by __system().
Function sets normal breakpoint (0xcc, int3)
gdbr | instance that contains the current context |
addrress | at this position the breakpoint will be added |
conditions | TODO: examine how this condition string should look like |
Definition at line 1357 of file core.c.
References BREAKPOINT, conditions, g, and set_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1373 of file core.c.
References ACCESS_WATCHPOINT, conditions, g, and set_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1361 of file core.c.
References conditions, g, HARDWARE_BREAKPOINT, and set_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1369 of file core.c.
References conditions, g, READ_WATCHPOINT, and set_bp().
Referenced by rz_debug_gdb_breakpoint().
Definition at line 1365 of file core.c.
References conditions, g, set_bp(), and WRITE_WATCHPOINT.
Referenced by rz_debug_gdb_breakpoint().
Definition at line 929 of file core.c.
References CMD_C_STEP, test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), NULL, sdb_fmt(), send_vcont(), and write_thread_id().
Referenced by rz_debug_gdb_step().
gets reason why remote target stopped
Definition at line 391 of file core.c.
References test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), handle_stop_reason(), read_packet(), and send_msg().
Referenced by rz_debug_gdb_info(), and rz_debug_gdb_wait().
get list of threads for given pid
Definition at line 1833 of file core.c.
References test_evm::end, free(), g, gdbr_exec_file_read(), gdbr_is_thread_dead(), gdbr_lock_enter(), gdbr_lock_leave(), rz_debug_pid_t::gid, list(), NULL, rz_debug_pid_t::path, rz_debug_pid_t::pid, pid, read_packet(), read_thread_id(), rz_debug_pid_t::runnable, RZ_DBG_PROC_DEAD, RZ_DBG_PROC_STOP, rz_list_append(), rz_list_free(), rz_list_new(), RZ_NEW0, send_ack(), send_msg(), rz_debug_pid_t::status, strdup(), and rz_debug_pid_t::uid.
Referenced by rz_debug_gdb_threads().
Function writes general purpose registers.
gdbr | instance that contains the current context |
reg | contains the registers that should be written reg contains a comma separated string that uses <regname>=value,<regname>=value i.e. eax=0x123,ebx=0x234 |
Definition at line 975 of file core.c.
References buffer_size, calloc(), CMD_WRITEREGS, command, test_evm::end, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), handle_G(), len, NULL, pack_hex(), read_packet(), reg_cache, regs, send_msg(), and snprintf.
Referenced by gdbr_write_reg().
Definition at line 860 of file core.c.
References calloc(), CMD_WRITEMEM, test_evm::end, free(), g, GDB_MAX_PKTSZ, gdbr_lock_enter(), gdbr_lock_leave(), handle_M(), len, pack_hex(), PFMT64x, read_packet(), RZ_MAX, send_msg(), snprintf, autogen_x86imm::tmp, and ut64().
Referenced by debug_gdb_write_at().
Definition at line 1058 of file core.c.
References test_evm::end, eprintf, g, gdbr_lock_enter(), gdbr_lock_leave(), gdbr_read_registers(), gdbr_write_bin_registers(), gdbr_write_register(), i, len, memcpy(), reg_cache, and value.
Referenced by rz_debug_gdb_reg_write().
Definition at line 1018 of file core.c.
References CMD_WRITEREG, command, test_evm::end, eprintf, g, gdbr_lock_enter(), gdbr_lock_leave(), handle_P(), len, memset(), MSG_NOT_SUPPORTED, pack_hex(), read_packet(), reg_cache, send_msg(), snprintf, and value.
Referenced by gdbr_write_reg().
Definition at line 1096 of file core.c.
References buffer_size, calloc(), CMD_WRITEREGS, command, test_evm::end, eprintf, free(), g, gdbr_lock_enter(), gdbr_lock_leave(), gdbr_read_registers(), handle_G(), hex2char(), i, len, memcpy(), memset(), NULL, pack_hex(), read_packet(), reg, reg_cache, RZ_FREE, send_msg(), snprintf, ut64(), value, and x.
Definition at line 1193 of file core.c.
References command, test_evm::end, g, gdbr_lock_enter(), gdbr_lock_leave(), hexdump(), read_packet(), and send_msg().