[PATCHv2,0/7] gdb: fix target_ops reference count for some cases

Message ID cover.1664729721.git.aburgess@redhat.com
Series gdb: fix target_ops reference count for some cases |


Andrew Burgess Oct. 2, 2022, 5:04 p.m. UTC
  A complete rewrite (and expansion) of this patch after Simon's

The original idea (from v1) is really covered by patches #3 and #5.
There's still (maybe) an open question about the use of
scoped_restore_pspace_and_thread vs scoped_restore_thread, but I hope
I've addressed this question in the v1 thread.  Do let me know if
there's still any questions on this though.

Patches #1 and #2 are target_ops ref-count related cleanups that I
spotted while working on this updated series.

Patch #4 is also a cleanup, moving some global functions to become
member functions on the inferior class.

Patch #6 is a completely random addition to add some extra maintenance
output, I ended up using this while debugging patch #7, but this
change isn't actually required at all.

Patch #7 does relate to target_ops, and target_ops sharing, which is
kind-of related to reference counting... maybe?  I can easily drop
this patch from the series if it turns out the idea in here is not
taking GDB in the right direction.




Andrew Burgess (7):
  gdb/remote: remove some manual reference count handling
  gdb: remove decref_target
  gdb: have target_stack automate reference count handling
  gdb: remove the pop_all_targets (and friends) global functions
  gdb: ensure all targets are popped before an inferior is destructed
  gdb/maint: add core file name to 'maint info program-spaces' output
  gdb: some process_stratum_target should not be shared

 gdb/NEWS                                      |  11 ++
 gdb/corelow.c                                 |   5 +
 gdb/doc/gdb.texinfo                           |  45 ++++-
 gdb/event-top.c                               |   3 +-
 gdb/inferior.c                                |  71 ++++++++
 gdb/inferior.h                                |  26 ++-
 gdb/progspace.c                               |  18 +-
 gdb/remote.c                                  |  40 +++--
 gdb/scoped-mock-context.h                     |   2 +-
 gdb/target.c                                  | 100 +++++------
 gdb/target.h                                  |  33 ++--
 gdb/testsuite/gdb.multi/multi-core-files-1.c  |  37 +++++
 gdb/testsuite/gdb.multi/multi-core-files-2.c  |  31 ++++
 gdb/testsuite/gdb.multi/multi-core-files.exp  | 156 ++++++++++++++++++
 .../gdb.python/py-connection-removed.exp      |  92 +++++++++++
 gdb/top.c                                     |   3 +-
 16 files changed, 563 insertions(+), 110 deletions(-)
 create mode 100644 gdb/testsuite/gdb.multi/multi-core-files-1.c
 create mode 100644 gdb/testsuite/gdb.multi/multi-core-files-2.c
 create mode 100644 gdb/testsuite/gdb.multi/multi-core-files.exp
 create mode 100644 gdb/testsuite/gdb.python/py-connection-removed.exp