gdbstub: Re-factor gdb command extensions
authorAlex Bennée <alex.bennee@linaro.org>
Thu, 18 Jul 2024 09:45:11 +0000 (10:45 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Mon, 22 Jul 2024 08:37:44 +0000 (09:37 +0100)
commite8122a7118eb22ace9e60c91bfbf2d4bbfc6f15a
tree7468627d37e0da1da14e45b935da9690e1beba7c
parent955ad1121d7df678603336f4af6c8e774f657558
gdbstub: Re-factor gdb command extensions

Coverity reported a memory leak (CID 1549757) in this code and its
admittedly rather clumsy handling of extending the command table.
Instead of handing over a full array of the commands lets use the
lighter weight GPtrArray and simply test for the presence of each
entry as we go. This avoids complications of transferring ownership of
arrays and keeps the final command entries as static entries in the
target code.

Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Gustavo Bueno Romero <gustavo.romero@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240718094523.1198645-4-alex.bennee@linaro.org>
gdbstub/gdbstub.c
include/gdbstub/commands.h
target/arm/gdbstub.c
target/arm/gdbstub64.c
target/arm/internals.h