gdb: fix compilation failures
Compilation fails with an "index outside of array bounds" error:
In function 'find_memory_region',
inlined from 'gdb_mem_can_read' at \
zephyr/subsys/debug/gdbstub/gdbstub.c:93:7:
zephyr/subsys/debug/gdbstub/gdbstub.c:65:21: warning: array subscript \
idx is outside array bounds of 'const struct gdb_mem_region[0]' \
[-Warray-bounds]
65 | r = &gdb_mem_region_array[idx];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/subsys/debug/gdbstub/gdbstub.c: In function 'gdb_mem_can_read':
zephyr/subsys/debug/gdbstub/gdbstub.c:42:36: note: while referencing \
'gdb_mem_region_array'
42 | __weak const struct gdb_mem_region gdb_mem_region_array[0];
|
Use a single element array to fix the problem.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
53375e95ba
commit
226747a1c8
@ -38,12 +38,12 @@ LOG_MODULE_REGISTER(gdbstub);
|
||||
|
||||
static bool not_first_start;
|
||||
|
||||
/* Empty memory region array */
|
||||
__weak const struct gdb_mem_region gdb_mem_region_array[0];
|
||||
|
||||
/* Number of memory regions */
|
||||
__weak const size_t gdb_mem_num_regions;
|
||||
|
||||
/* Fall-back memory region array */
|
||||
__weak const struct gdb_mem_region gdb_mem_region_array[1];
|
||||
|
||||
/**
|
||||
* Given a starting address and length of a memory block, find a memory
|
||||
* region descriptor from the memory region array where the memory block
|
||||
|
||||
Loading…
Reference in New Issue
Block a user