23 snprintf(
buf, 127,
"PacketSize=%x;QStartNoAckMode+;qXfer:exec-file:read+",
24 (
ut32)(
g->read_max - 1));
49 if (cmd_cb(
g, core_ptr,
"dm", ptr,
sizeof(
buf) - (ptr -
buf) - 1) < 0) {
58 char *
buf, *ptr,
cmd[64] = { 0 };
64 ptr =
g->data + strlen(
"qXfer:exec-file:read:");
67 if ((
pid = (
int)strtol(ptr,
NULL, 16)) <= 0 ||
pid !=
g->pid) {
71 if (!(ptr = strchr(ptr,
':'))) {
95 g->data[
g->data_len] =
'\0';
100 if (!(memstr = strchr(
g->data,
':')) || !*(++memstr)) {
103 if (memlen2 != strlen(memstr)) {
110 buf[memlen2 + 63] =
'\0';
112 if (cmd_cb(
g, core_ptr,
buf,
NULL, 0) < 0) {
125 if (
g->data_len > 1) {
129 if (cmd_cb(
g, core_ptr,
"ds",
NULL, 0) < 0) {
145 if (
g->data_len > 1) {
149 if (cmd_cb(
g, core_ptr,
"dc",
NULL, 0) < 0) {
230 if (cmd_cb(
g, core_ptr,
cmd,
NULL, 0) < 0) {
242 g->data[
g->data_len] =
'\0';
243 if (
g->data[5] ==
'?') {
247 if (!strtok(
g->data,
";")) {
255 if (cmd_cb(
g, core_ptr,
"ds",
NULL, 0) < 0) {
262 if (cmd_cb(
g, core_ptr,
"dc",
NULL, 0) < 0) {
295 if (
g->data_len <= 2 ||
isalpha(
g->data[2])) {
299 if (
g->data[2] ==
'0' || !strncmp(
g->data + 2,
"-1", 2)) {
302 sscanf(
g->data + 2,
"%x", &tid);
305 if (cmd_cb(
g, core_ptr,
cmd,
NULL, 0) < 0) {
320 if (
g->data_len <= 2 ||
isalpha(
g->data[2])) {
324 if (
g->data[2] ==
'0' || !strncmp(
g->data + 2,
"-1", 2)) {
327 sscanf(
g->data + 2,
"%x", &tid);
330 if (cmd_cb(
g, core_ptr,
cmd,
NULL, 0) < 0) {
340 size_t buf_len =
g->stub_features.pkt_sz;
347 if (cmd_cb(
g, core_ptr,
"dpt",
buf,
buf_len) < 0) {
394 g->data[
g->data_len] = 0;
405 if ((
length = cmd_cb(
g, core_ptr,
cmd,
buf, (
g->data_max / 2) - 1)) < 0 ||
length >=
g->data_max / 2) {
427 regnum = strtol(
g->data + 1,
NULL, 16);
429 for (
i = 0;
i < regnum;
i++) {
430 if (!*
g->registers[
i].name) {
434 if (
snprintf(
cmd,
sizeof(
cmd) - 1,
"dr %s",
g->registers[regnum].name) < 0) {
452 if (!
isxdigit(
g->data[1]) || !(ptr = strchr(
g->data,
'='))) {
459 regnum = strtol(
g->data + 1,
NULL, 16);
461 for (
i = 0;
i < regnum;
i++) {
462 if (!*
g->registers[
i].name) {
466 len = strlen(
g->registers[regnum].name) + strlen(ptr) + 10;
471 if (cmd_cb(
g, core_ptr,
cmd,
NULL, 0) < 0) {
504 if (
g->data_len == 0) {
597 if (
g->data[0] ==
'z' ||
g->data[0] ==
'Z') {
603 if (
g->data[0] ==
's') {
609 if (
g->data[0] ==
'c') {
650 if (
g->server_debug) {
651 eprintf(
"[noack mode enabled]\n");
660 g->data[
g->data_len] =
'\0';
661 eprintf(
"Unknown packet: %s\n",
g->data);
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
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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
int send_ack(libgdbr_t *g)
Functions sends a single ack ('+')
RZ_API void Ht_() free(HtName_(Ht) *ht)
int read_packet(libgdbr_t *instance, bool vcont)
int send_msg(libgdbr_t *g, const char *command)
return memset(p, 0, total)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
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")
int handle_qSupported(libgdbr_t *g)
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
int(* gdbr_server_cmd_cb)(libgdbr_t *, void *, const char *, char *, size_t)
int pack_hex(const char *src, ut64 len, char *dst)
static int _server_handle_vMustReplyEmpty(libgdbr_t *g)
static int _server_handle_Hg(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_g(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_p(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qTStatus(libgdbr_t *g)
static int _server_handle_k(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_m(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_M(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qSupported(libgdbr_t *g)
static int _server_handle_vKill(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_ques(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_vCont(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
int gdbr_server_serve(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_exec_file_read(libgdbr_t *g, gdbr_server_cmd_cb cb, void *core_ptr)
static int _server_handle_z(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_c(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_P(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qOffsets(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qC(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_s(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qTfV(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_Hc(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qfThreadInfo(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qsThreadInfo(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
static int _server_handle_qAttached(libgdbr_t *g, gdbr_server_cmd_cb cmd_cb, void *core_ptr)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()