8sa1-binutils-gdb/gdb/python
Andrew Burgess baf8791efb gdb/python: Reuse gdb.RegisterGroup objects where possible
Only create one gdb.RegisterGroup Python object for each of GDB's
reggroup objects.

I could have added a field into the reggroup object to hold the Python
object pointer for each reggroup, however, as reggroups are never
deleted within GDB, and are global (not per-architecture) a simpler
solution seemed to be just to hold a single global map from reggroup
pointer to a Python object representing the reggroup.  Then we can
reuse the objects out of this map.

After this commit it is possible for a user to tell that two
gdb.RegisterGroup objects are now identical when previously they were
unique, however, as both these objects are read-only I don't think
this should be a problem.

There should be no other user visible changes after this commit.

gdb/ChangeLog:

	* python/py-registers.c : Add 'unordered_map' include.
	(gdbpy_new_reggroup): Renamed to...
	(gdbpy_get_reggroup): ...this.  Update to only create register
	group descriptors when needed.
	(gdbpy_reggroup_iter_next): Update.

gdb/testsuite/ChangeLog:

	* gdb.python/py-arch-reg-groups.exp: Additional tests.
2020-07-21 21:57:08 +01:00
..
lib/gdb
py-all-events.def
py-arch.c gdb/python: New method to access list of register groups 2020-07-06 15:06:06 +01:00
py-auto-load.c default-args: allow to define default arguments for aliases 2020-06-22 21:14:13 +02:00
py-block.c
py-bpevent.c
py-breakpoint.c
py-cmd.c default-args: allow to define default arguments for aliases 2020-06-22 21:14:13 +02:00
py-continueevent.c
py-event-types.def
py-event.c
py-event.h
py-events.h
py-evtregistry.c
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-frame.c
py-framefilter.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-function.c
py-gdb-readline.c
py-inferior.c
py-infevents.c
py-infthread.c
py-instruction.c
py-instruction.h
py-lazy-string.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-linetable.c
py-newobjfileevent.c
py-objfile.c
py-param.c default-args: allow to define default arguments for aliases 2020-06-22 21:14:13 +02:00
py-prettyprint.c
py-progspace.c
py-record-btrace.c
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c
py-record.h
py-ref.h
py-registers.c gdb/python: Reuse gdb.RegisterGroup objects where possible 2020-07-21 21:57:08 +01:00
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c
py-symtab.c
py-threadevent.c
py-tui.c Fix crash when TUI window creation fails 2020-06-16 17:48:38 -06:00
py-type.c gdb: make type::bounds work for array and string types 2020-07-12 23:06:12 -04:00
py-unwind.c gdb/python: Add architecture method to gdb.PendingFrame 2020-07-06 15:06:05 +01:00
py-utils.c
py-value.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
py-varobj.c
py-xmethods.c gdb: remove TYPE_CODE macro 2020-05-14 13:46:38 -04:00
python-config.py
python-internal.h gdb/python: New method to access list of register groups 2020-07-06 15:06:06 +01:00
python.c gdb/python: Add gdb.Architecture.registers method 2020-07-06 15:06:06 +01:00
python.h