diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-07 16:28:56 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-07 16:28:56 -0400 |
commit | 91e3c425d6adb4797a2137dd9126a2f19e1833d8 (patch) | |
tree | 9de2cd0babb207e59089247ca6f3eab478dc10ad /gdb/ser-tcp.c | |
parent | 0b2f7ade5352e698ded54760ee8b34092fdd164f (diff) | |
download | gdb-91e3c425d6adb4797a2137dd9126a2f19e1833d8.zip gdb-91e3c425d6adb4797a2137dd9126a2f19e1833d8.tar.gz gdb-91e3c425d6adb4797a2137dd9126a2f19e1833d8.tar.bz2 |
gdb: make target_desc_info::filename an std::string
To make the management of memory automatic.
As to why I chose to make this an std::string and not an
std::unique_xmalloc_ptr<char>: some parts of the code consider both a
NULL value and an empty string value to mean "no filename".
target_desc_info_from_user_p, however, doesn't check for a non-NULL but
empty string value. So it seems like having two ways of denoting "no
filename" can lead to these kinds of inconsistencies. Using
std::string, "no filename" is only represented by an empty value.
As a bonus, using an std::string lets us copy target_desc_info objects
using the default assignment operator.
gdb/ChangeLog:
* target-descriptions.c (struct target_desc_info) <filename>:
Make std::string.
(copy_inferior_target_desc_info): Adjust.
(target_desc_info_free): Adjust.
(target_find_description): Adjust.
(set_tdesc_filename_cmd): Adjust.
(show_tdesc_filename_cmd): Adjust.
(unset_tdesc_filename_cmd): Adjust.
(maint_print_c_tdesc_cmd): Adjust.
Change-Id: I4e3a6ad8ccda2b88c202471d4f54249753cad127
Diffstat (limited to 'gdb/ser-tcp.c')
0 files changed, 0 insertions, 0 deletions