Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 8be6515

Browse files
committed
gdb_main: Use packet buffer for m/M-packets instead of alloca
1 parent 7e35068 commit 8be6515

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/gdb_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int32_t gdb_main_loop(target_controller_s *const tc, const gdb_packet_s *const p
150150
break;
151151
}
152152
DEBUG_GDB("m packet: addr = %" PRIx32 ", len = %" PRIx32 "\n", addr, len);
153-
uint8_t *mem = alloca(len);
153+
char *mem = gdb_packet_buffer() + GDB_PACKET_BUFFER_SIZE / 2U;
154154
if (target_mem32_read(cur_target, mem, addr, len))
155155
gdb_put_packet_error(1U);
156156
else
@@ -180,7 +180,7 @@ int32_t gdb_main_loop(target_controller_s *const tc, const gdb_packet_s *const p
180180
break;
181181
}
182182
DEBUG_GDB("M packet: addr = %" PRIx32 ", len = %" PRIx32 "\n", addr, len);
183-
uint8_t *mem = alloca(len);
183+
char *mem = gdb_packet_buffer();
184184
unhexify(mem, rest, len);
185185
if (target_mem32_write(cur_target, addr, mem, len))
186186
gdb_put_packet_error(1U);

0 commit comments

Comments
 (0)