Skip to content

Commit

Permalink
ticks: extended buffers for disassemble2
Browse files Browse the repository at this point in the history
(fixes a bug introduced by #2104)
  • Loading branch information
desertkun committed Dec 26, 2022
1 parent d923bc1 commit 23ac97c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/ticks/debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ int debugger_evaluate(char* line)
void debugger()
{
static char *last_line = NULL;
char buf[256];
char prompt[300];
char *line;
static char buf[2048];
char prompt[300];
char *line;

if ( last_line == NULL ) {
last_line = strdup("");
Expand Down Expand Up @@ -1188,7 +1188,7 @@ const char *resolve_to_label(int addr)

static int cmd_disassemble(int argc, char **argv)
{
char buf[256];
static char buf[2048];
int i = 0;
int disassemble_size = 10;
int where = -1;
Expand Down Expand Up @@ -1839,8 +1839,8 @@ static int cmd_list(int argc, char **argv)

static void print_hotspots(void)
{
char buf[256];
int i;
static char buf[2048];
int i;
FILE *fp;

if ( hotspot == 0 ) return;
Expand Down
5 changes: 2 additions & 3 deletions src/ticks/debugger_gdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,8 @@ uint8_t breakpoints_check()

void debugger_next()
{
extern int next_address;
char buf[100];
int len;
static char buf[2048];
int len;
const unsigned short pc = bk.pc();

uint8_t opcode = bk.get_memory(pc);
Expand Down
4 changes: 2 additions & 2 deletions src/ticks/debugger_mi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static void cmd_data_disassemble(const char* flow, int argc, char **argv) {
utstring_new(dump_buffer);

while (pc <= to_d) {
char db[256] = "";
static char db[2048];
int len = disassemble2(pc, db, sizeof(db), 2);

if (!first) {
Expand Down Expand Up @@ -948,7 +948,7 @@ static void cmd_plain_disassemble(const char* flow, int argc, char **argv) {
bk.console("Dump of assembler code from 0x%08x to 0x%08x:\n", from_d, to_d);

while (pc <= to_d) {
char db[256] = "";
static char db[2048];
int len = disassemble2(pc, db, sizeof(db), 2);

const char* ppp = (pc == regs.pc) ? "=> " : " ";
Expand Down
4 changes: 2 additions & 2 deletions src/ticks/debugger_ticks.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ static breakpoint_ret_t do_nothing(uint8_t type, uint16_t at, uint8_t sz) { retu

void next()
{
char buf[100];
int len;
static char buf[2048];
int len;
const unsigned short pc = bk.pc();

uint8_t opcode = bk.get_memory(pc);
Expand Down
4 changes: 2 additions & 2 deletions src/ticks/disassembler_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ int main(int argc, char **argv)

static void disassemble_loop(int start, int end)
{
char buf[256];
int start2 = start;
static char buf[2048];
int start2 = start;

while ( start2 < end ) {
start2 += disassemble2(start2, buf, sizeof(buf), 0);
Expand Down

0 comments on commit 23ac97c

Please sign in to comment.