gdb: Delay releasing target_desc_up in more cases
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 8 Oct 2020 09:44:55 +0000 (10:44 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 9 Oct 2020 10:45:44 +0000 (11:45 +0100)
commitbbb826f5e92e26815357b7f3243f6b3453ec5bc1
tree893a50c3a3e1d044c100b1fc3cacfd8ab31a16ea
parent361cb219351d8b7e39e1962fe77f40aa80657b27
gdb: Delay releasing target_desc_up in more cases

After commit:

  commit 51a948fdf0e14fb69ab9e0c79ae8b2415801f9a3
  Date:   Mon Jul 20 14:18:04 2020 +0100

      gdb: Have allocate_target_description return a unique_ptr

There were a few places where we could (should?) have delayed
releasing the target_desc_up until a little later.  This commit
catches these cases.

In the case of ARC, the target_desc_up is now exposed right out to
gdbserver, which means making a small change there too.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* arch/aarch32.c (aarch32_create_target_description): Release the
target_desc_up as late as possible.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/amd64.c (amd64_create_target_description): Likewise.
* arch/arc.c (arc_create_target_description): Return a
target_desc_up, don't release it.
* arch/arc.h (arc_create_target_description): Update declaration.
(arc_lookup_target_description): Move target_desc_up into the
cache, and return a borrowed pointer.
* arch/arm.c (arm_create_target_description): Release the
target_desc_up as late as possible.
* arch/i386.c (i386_create_target_description): Likewise.
* arch/riscv.h (riscv_create_target_description): Update
declaration to match definition.
* arch/tic6x.c (tic6x_create_target_description): Release the
target_desc_up as late as possible.

gdbserver/ChangeLog:

* linux-arc-low.cc (arc_linux_read_description): Release the
unique_ptr returned from arc_create_target_description.
12 files changed:
gdb/ChangeLog
gdb/arch/aarch32.c
gdb/arch/aarch64.c
gdb/arch/amd64.c
gdb/arch/arc.c
gdb/arch/arc.h
gdb/arch/arm.c
gdb/arch/i386.c
gdb/arch/riscv.h
gdb/arch/tic6x.c
gdbserver/ChangeLog
gdbserver/linux-arc-low.cc