Skip to content

Commit

Permalink
Bump the gdb packet size.
Browse files Browse the repository at this point in the history
  • Loading branch information
joneschrisg committed Mar 26, 2014
1 parent 903fb9b commit 7a1a542
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -144,6 +144,7 @@ set(BASIC_TESTS
prw
ptrace
rdtsc
read_big_struct
save_data_fd
sched_setaffinity
sched_yield
Expand Down
6 changes: 3 additions & 3 deletions src/debugger_gdb.cc
Expand Up @@ -77,11 +77,11 @@ struct dbg_context {
int listen_fd;
int sock_fd;
/* XXX probably need to dynamically size these */
byte inbuf[4096]; /* buffered input from gdb */
byte inbuf[32768]; /* buffered input from gdb */
ssize_t inlen; /* length of valid data */
ssize_t insize; /* total size of buffer */
ssize_t packetend; /* index of '#' character */
byte outbuf[4096]; /* buffered output for gdb */
byte outbuf[32768]; /* buffered output for gdb */
ssize_t outlen;
ssize_t outsize;
};
Expand Down Expand Up @@ -734,7 +734,7 @@ static int query(struct dbg_context* dbg, char* payload)
snprintf(supported, sizeof(supported) - 1,
"PacketSize=%x;QStartNoAckMode+;qXfer:auxv:read+"
";multiprocess+",
sizeof(dbg->outbuf));
dbg->outsize);
write_packet(dbg, supported);
return 0;
}
Expand Down
25 changes: 25 additions & 0 deletions src/test/read_big_struct.c
@@ -0,0 +1,25 @@
/* -*- Mode: C; tab-width: 8; c-basic-offset: 8; indent-tabs-mode: t; -*- */

#include "rrutil.h"

static void breakpoint(void) {
int break_here = 1;
(void)break_here;
}

/* FIXME: we should be able to send arbitrarily large structs over the
* debugging socket. This is a temporary hack. */
struct big {
char bytes[8192];
};

int main(int argc, char *argv[]) {
struct big big;

memset(&big, 0x5a, sizeof(big));

breakpoint();

atomic_puts("EXIT-SUCCESS");
return 0;
}
15 changes: 15 additions & 0 deletions src/test/read_big_struct.py
@@ -0,0 +1,15 @@
from rrutil import *

send_gdb('b breakpoint\n')
expect_gdb('Breakpoint 1')

send_gdb('c\n')
expect_gdb('Breakpoint 1, breakpoint')

send_gdb('f 1\n')
expect_gdb('(gdb)')

send_gdb('p big\n')
expect_gdb(" bytes = 'Z'")

ok()
2 changes: 2 additions & 0 deletions src/test/read_big_struct.run
@@ -0,0 +1,2 @@
source `dirname $0`/util.sh read_big_struct "$@"
debug_test

0 comments on commit 7a1a542

Please sign in to comment.