diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-05-14 10:55:59 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-05-28 10:36:50 +0100 |
commit | 0e77ff2c86a163fe11135633837c8f19aee31ca0 (patch) | |
tree | 126990677c5d430e78df06a09956e0689c5b13b4 /ld/ldint.texi | |
parent | 6094a48ec821a52731172f3471dce4923a482cd1 (diff) | |
download | gdb-0e77ff2c86a163fe11135633837c8f19aee31ca0.zip gdb-0e77ff2c86a163fe11135633837c8f19aee31ca0.tar.gz gdb-0e77ff2c86a163fe11135633837c8f19aee31ca0.tar.bz2 |
gdb: use gdb::unique_xmalloc_ptr<char> for docs in cmdpy_init
Make use of gdb::unique_xmalloc_ptr<char> to hold the documentation
string in cmdpy_init (when creating a custom GDB command in Python).
I think this is all pretty straight forward, the only slight weirdness
is the removal of the call to free toward the end of this function.
Prior to this commit, if an exception was thrown after the GDB command
was created then we would (I think) end up freeing the documentation
string even though the command would remain registered with GDB, which
would surely lead to undefined behaviour.
After this commit we release the doc string at the point that we hand
it over to the command creation routines. If we throw _after_ the
command has been created within GDB then the doc string will be left
live. If we throw during the command creation itself (either from
add_prefix_cmd or add_cmd) then it is up to those functions to free
the doc string (I suspect we don't, but I think in general the
commands are pretty bad at cleaning up after themselves, so I don't
think this is a huge problem).
Diffstat (limited to 'ld/ldint.texi')
0 files changed, 0 insertions, 0 deletions