Skip to content
Commit 226747a1 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Chris Friedt
Browse files

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: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
parent 53375e95
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment