]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/rx-tdep.c
gdb: change functions returning value contents to use gdb::array_view
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 5 Oct 2021 00:47:06 +0000 (20:47 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 25 Oct 2021 18:51:44 +0000 (14:51 -0400)
commit50888e42dcd32b30e1144c0aa6d1c1490da45cd9
tree72fad89d67057ecb53f26bac0464542829053e3e
parentd9f82e931394efed68858eb7c7bb5832ad888482
gdb: change functions returning value contents to use gdb::array_view

The bug fixed by this [1] patch was caused by an out-of-bounds access to
a value's content.  The code gets the value's content (just a pointer)
and then indexes it with a non-sensical index.

This made me think of changing functions that return value contents to
return array_views instead of a plain pointer.  This has the advantage
that when GDB is built with _GLIBCXX_DEBUG, accesses to the array_view
are checked, making bugs more apparent / easier to find.

This patch changes the return types of these functions, and updates
callers to call .data() on the result, meaning it's not changing
anything in practice.  Additional work will be needed (which can be done
little by little) to make callers propagate the use of array_view and
reap the benefits.

[1] https://sourceware.org/pipermail/gdb-patches/2021-September/182306.html

Change-Id: I5151f888f169e1c36abe2cbc57620110673816f3
96 files changed:
gdb/aarch64-linux-tdep.c
gdb/aarch64-tdep.c
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/ada-valprint.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/amd64-windows-tdep.c
gdb/arc-tdep.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/bfin-tdep.c
gdb/breakpoint.c
gdb/c-lang.c
gdb/c-valprint.c
gdb/cli/cli-cmds.c
gdb/cli/cli-dump.c
gdb/compile/compile-object-load.c
gdb/cp-valprint.c
gdb/cris-tdep.c
gdb/csky-tdep.c
gdb/d-valprint.c
gdb/dummy-frame.c
gdb/dwarf2/expr.c
gdb/dwarf2/loc.c
gdb/dwarf2/read.c
gdb/elfread.c
gdb/eval.c
gdb/f-lang.c
gdb/f-valprint.c
gdb/findcmd.c
gdb/findvar.c
gdb/frame-unwind.c
gdb/frame.c
gdb/frv-tdep.c
gdb/gdbtypes.c
gdb/gnu-v3-abi.c
gdb/go-valprint.c
gdb/guile/scm-value.c
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-darwin-tdep.c
gdb/i386-tdep.c
gdb/i387-tdep.c
gdb/ia64-tdep.c
gdb/infcall.c
gdb/infcmd.c
gdb/infrun.c
gdb/iq2000-tdep.c
gdb/lm32-tdep.c
gdb/m2-valprint.c
gdb/m32c-tdep.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/mep-tdep.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/msp430-tdep.c
gdb/nds32-tdep.c
gdb/nios2-tdep.c
gdb/opencl-lang.c
gdb/or1k-tdep.c
gdb/p-valprint.c
gdb/ppc-sysv-tdep.c
gdb/printcmd.c
gdb/python/py-inferior.c
gdb/python/py-unwind.c
gdb/python/py-value.c
gdb/regcache.c
gdb/riscv-tdep.c
gdb/rl78-tdep.c
gdb/rs6000-aix-tdep.c
gdb/rs6000-lynx178-tdep.c
gdb/rust-lang.c
gdb/rx-tdep.c
gdb/s390-tdep.c
gdb/score-tdep.c
gdb/sh-tdep.c
gdb/sparc-tdep.c
gdb/sparc64-tdep.c
gdb/stack.c
gdb/std-regs.c
gdb/tic6x-tdep.c
gdb/tilegx-tdep.c
gdb/tracepoint.c
gdb/v850-tdep.c
gdb/valarith.c
gdb/valops.c
gdb/valprint.c
gdb/value.c
gdb/value.h
gdb/vax-tdep.c
gdb/windows-tdep.c
gdb/xstormy16-tdep.c
gdb/xtensa-tdep.c