mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 15:12:07 -06:00
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>
This commit is contained in:
parent
955ad1121d
commit
e8122a7118
5 changed files with 105 additions and 86 deletions
|
@ -74,23 +74,28 @@ int gdb_put_packet(const char *buf);
|
|||
|
||||
/**
|
||||
* gdb_extend_query_table() - Extend query table.
|
||||
* @table: The table with the additional query packet handlers.
|
||||
* @size: The number of handlers to be added.
|
||||
* @table: GPtrArray of GdbCmdParseEntry entries.
|
||||
*
|
||||
* The caller should free @table afterwards
|
||||
*/
|
||||
void gdb_extend_query_table(GdbCmdParseEntry *table, int size);
|
||||
void gdb_extend_query_table(GPtrArray *table);
|
||||
|
||||
/**
|
||||
* gdb_extend_set_table() - Extend set table.
|
||||
* @table: The table with the additional set packet handlers.
|
||||
* @size: The number of handlers to be added.
|
||||
* @table: GPtrArray of GdbCmdParseEntry entries.
|
||||
*
|
||||
* The caller should free @table afterwards
|
||||
*/
|
||||
void gdb_extend_set_table(GdbCmdParseEntry *table, int size);
|
||||
void gdb_extend_set_table(GPtrArray *table);
|
||||
|
||||
/**
|
||||
* gdb_extend_qsupported_features() - Extend the qSupported features string.
|
||||
* @qsupported_features: The additional qSupported feature(s) string. The string
|
||||
* should start with a semicolon and, if there are more than one feature, the
|
||||
* features should be separate by a semiocolon.
|
||||
* features should be separate by a semicolon.
|
||||
*
|
||||
* The caller should free @qsupported_features afterwards if
|
||||
* dynamically allocated.
|
||||
*/
|
||||
void gdb_extend_qsupported_features(char *qsupported_features);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue