Rizin
unix-like reverse engineering framework and cli tools
commands.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2014 defragger <rlaemmert@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #ifndef CLIENT_COMMANDS_H
5 #define CLIENT_COMMANDS_H
6 
7 #include "../libgdbr.h"
8 #include "rz_types_base.h"
9 #include <rz_util.h>
10 
16 
21 
28 int gdbr_connect(libgdbr_t *g, const char *server, int port);
29 
35 
39 void gdbr_invalidate_reg_cache(void);
40 
45 
51 
56 
62 int gdbr_send_qRcmd(libgdbr_t *g, const char *cmd, PrintfCallback cb_printf);
63 
69 int gdbr_attach(libgdbr_t *g, int pid);
70 
76 int gdbr_detach(libgdbr_t *g);
77 int gdbr_detach_pid(libgdbr_t *g, int pid);
78 
84 int gdbr_kill(libgdbr_t *g);
85 int gdbr_kill_pid(libgdbr_t *g, int pid);
86 
87 // Commands
88 int gdbr_continue(libgdbr_t *g, int pid, int tid, int sig);
89 int gdbr_step(libgdbr_t *g, int thread_id);
91 
100 int gdbr_write_bin_registers(libgdbr_t *g, const char *regs, int len);
101 int gdbr_write_reg(libgdbr_t *g, const char *name, char *value, int len);
102 int gdbr_write_register(libgdbr_t *g, int index, char *value, int len);
103 int gdbr_write_registers(libgdbr_t *g, char *registers);
104 int gdbr_read_memory(libgdbr_t *g, ut64 address, ut8 *buf, int len);
105 int gdbr_write_memory(libgdbr_t *g, ut64 address, const uint8_t *data, ut64 len);
106 int test_command(libgdbr_t *g, const char *command);
107 
115 int gdbr_set_bp(libgdbr_t *g, ut64 address, const char *conditions, int sizebp);
116 int gdbr_set_hwbp(libgdbr_t *g, ut64 address, const char *conditions, int sizebp);
117 int gdbr_set_hww(libgdbr_t *g, ut64 address, const char *conditions, int sizebp);
118 int gdbr_set_hwr(libgdbr_t *g, ut64 address, const char *conditions, int sizebp);
119 int gdbr_set_hwa(libgdbr_t *g, ut64 address, const char *conditions, int sizebp);
120 int gdbr_remove_bp(libgdbr_t *g, ut64 address, int sizebp);
121 int gdbr_remove_hwbp(libgdbr_t *g, ut64 address, int sizebp);
122 int gdbr_remove_hww(libgdbr_t *g, ut64 address, int sizebp);
123 int gdbr_remove_hwr(libgdbr_t *g, ut64 address, int sizebp);
124 int gdbr_remove_hwa(libgdbr_t *g, ut64 address, int sizebp);
128 int gdbr_open_file(libgdbr_t *g, const char *filename, int flags, int mode);
129 int gdbr_read_file(libgdbr_t *g, ut8 *buf, ut64 max_len);
131 
136 
141 
145 char *gdbr_exec_file_read(libgdbr_t *g, int pid);
146 
151 
155 int gdbr_select(libgdbr_t *g, int pid, int tid);
156 
157 #endif // CLIENT_COMMANDS_H
size_t len
Definition: 6502dis.c:15
static char * regs[]
Definition: analysis_sh.c:203
static int value
Definition: cmd_api.c:93
int gdbr_write_register(libgdbr_t *g, int index, char *value, int len)
Definition: core.c:1018
int gdbr_disconnect(libgdbr_t *g)
disconnects the lib
Definition: core.c:283
int gdbr_read_memory(libgdbr_t *g, ut64 address, ut8 *buf, int len)
Definition: core.c:812
int gdbr_check_extended_mode(libgdbr_t *g)
checks for extended mode availability
Definition: core.c:406
int gdbr_remove_hwa(libgdbr_t *g, ut64 address, int sizebp)
Definition: core.c:1392
int gdbr_remove_bp(libgdbr_t *g, ut64 address, int sizebp)
Definition: core.c:1377
int gdbr_connect(libgdbr_t *g, const char *server, int port)
Function connects to a gdbserver instance.
Definition: core.c:155
int gdbr_open_file(libgdbr_t *g, const char *filename, int flags, int mode)
Definition: core.c:1445
int gdbr_write_registers(libgdbr_t *g, char *registers)
Definition: core.c:1096
int gdbr_check_vcont(libgdbr_t *g)
checks which subcommands of the vCont packet are supported
Definition: core.c:335
int gdbr_attach(libgdbr_t *g, int pid)
attaches to a process
Definition: core.c:439
int gdbr_remove_hwbp(libgdbr_t *g, ut64 address, int sizebp)
Definition: core.c:1380
int gdbr_read_registers(libgdbr_t *g)
Definition: core.c:685
int gdbr_remove_hwr(libgdbr_t *g, ut64 address, int sizebp)
Definition: core.c:1388
int gdbr_detach(libgdbr_t *g)
detaches from a process
Definition: core.c:495
bool gdbr_lock_enter(libgdbr_t *g)
Acquires the gdbr lock and sets up breaking.
Definition: core.c:105
RzList * gdbr_threads_list(libgdbr_t *g, int pid)
get list of threads for given pid
Definition: core.c:1833
int gdbr_set_bp(libgdbr_t *g, ut64 address, const char *conditions, int sizebp)
Function sets normal breakpoint (0xcc, int3)
Definition: core.c:1357
char * gdbr_exec_file_read(libgdbr_t *g, int pid)
Definition: core.c:1635
int gdbr_remove_hww(libgdbr_t *g, ut64 address, int sizebp)
Definition: core.c:1384
void gdbr_lock_leave(libgdbr_t *g)
Releases the gdbr lock.
Definition: core.c:117
RzList * gdbr_pids_list(libgdbr_t *g, int pid)
get a list of the child processes of the given pid
Definition: core.c:1731
int gdbr_detach_pid(libgdbr_t *g, int pid)
Definition: core.c:520
int gdbr_set_hwa(libgdbr_t *g, ut64 address, const char *conditions, int sizebp)
Definition: core.c:1373
int test_command(libgdbr_t *g, const char *command)
Definition: core.c:1193
int gdbr_set_hwbp(libgdbr_t *g, ut64 address, const char *conditions, int sizebp)
Definition: core.c:1361
int gdbr_step(libgdbr_t *g, int thread_id)
Definition: core.c:929
void gdbr_invalidate_reg_cache(void)
invalidates the reg cache
Definition: core.c:1570
int gdbr_continue(libgdbr_t *g, int pid, int tid, int sig)
Definition: core.c:950
int gdbr_set_hwr(libgdbr_t *g, ut64 address, const char *conditions, int sizebp)
Definition: core.c:1369
int gdbr_write_reg(libgdbr_t *g, const char *name, char *value, int len)
Definition: core.c:1058
int gdbr_write_memory(libgdbr_t *g, ut64 address, const uint8_t *data, ut64 len)
Definition: core.c:860
int gdbr_read_file(libgdbr_t *g, ut8 *buf, ut64 max_len)
Definition: core.c:1485
ut64 gdbr_get_baddr(libgdbr_t *g)
Definition: core.c:1931
int gdbr_select(libgdbr_t *g, int pid, int tid)
Definition: core.c:304
int gdbr_kill(libgdbr_t *g)
kills the process the remote gdbserver is debugging (TODO: handle pid)
Definition: core.c:572
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: core.c:1574
int gdbr_set_hww(libgdbr_t *g, ut64 address, const char *conditions, int sizebp)
Definition: core.c:1365
int gdbr_stop_reason(libgdbr_t *g)
gets reason why remote target stopped
Definition: core.c:391
int gdbr_write_bin_registers(libgdbr_t *g, const char *regs, int len)
Function writes general purpose registers.
Definition: core.c:975
int gdbr_close_file(libgdbr_t *g)
Definition: core.c:1539
int gdbr_kill_pid(libgdbr_t *g, int pid)
Definition: core.c:605
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
Definition: sflib.h:79
struct @667 g
const char * filename
Definition: ioapi.h:137
const char int mode
Definition: ioapi.h:137
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
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
Definition: sflib.h:64
static const char * conditions[]
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
Definition: rz_types.h:233
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
unsigned char uint8_t
Definition: sftypes.h:31
Definition: z80asm.h:102
const char * command
Definition: main.c:7
ut64(WINAPI *w32_GetEnabledXStateFeatures)()