diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-08-28 10:58:44 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-27 22:30:11 -0400 |
commit | 676362df181a39a5c58bba15f4f7524bfd58b88d (patch) | |
tree | 3c2c4c09993903dacbb08a5005dcb0fc3ec5235f /gdb/linux-nat.c | |
parent | b0f6c8d24726d9bf4a5571a9c881eaa49e3129a3 (diff) | |
download | gdb-676362df181a39a5c58bba15f4f7524bfd58b88d.zip gdb-676362df181a39a5c58bba15f4f7524bfd58b88d.tar.gz gdb-676362df181a39a5c58bba15f4f7524bfd58b88d.tar.bz2 |
gdb: add destructor to lwp_info
Replace the lwp_free function with a destructor. Make lwp_info
non-copyable, since there is now a destructor (we wouldn't want an
lwp_info object getting copied and this->arch_private getting deleted
twice).
Change-Id: I09fcbe967e362566d3a06fed2abca2a9955570fa
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r-- | gdb/linux-nat.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index f063db8..a297d3b 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -793,13 +793,10 @@ static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp); /* Destroy and free LP. */ -static void -lwp_free (struct lwp_info *lp) +lwp_info::~lwp_info () { /* Let the arch specific bits release arch_lwp_info. */ - linux_target->low_delete_thread (lp->arch_private); - - xfree (lp); + linux_target->low_delete_thread (this->arch_private); } /* Traversal function for purge_lwp_list. */ @@ -814,7 +811,7 @@ lwp_lwpid_htab_remove_pid (void **slot, void *info) { htab_clear_slot (lwp_lwpid_htab, slot); lwp_list_remove (lp); - lwp_free (lp); + delete lp; } return 1; @@ -899,7 +896,7 @@ delete_lwp (ptid_t ptid) lwp_list_remove (lp); /* Release. */ - lwp_free (lp); + delete lp; } /* Return a pointer to the structure describing the LWP corresponding |