binutils-gdb/gdb/python
Tom Tromey aac3cc8258 Memoize gdb.Block and make them hashable
In subsequent patches, it's handy if gdb.Block is hashable, so it can
be stored in a set or a dictionary.  However, doing this in a
straightforward way is not really possible, because a block isn't
truly immutable -- it can be invalidated.  And, while this isn't a
real problem for my use case (in DAP the maps are only used during a
single stop), it seemed error-prone.

This patch instead takes the approach of using the gdb.Block's own
object identity to allow hashing.  This seems fine because the
contents don't affect the hashing.  In order for this to work, though,
the blocks have to be memoized -- two requests for the same block must
return the same object.

This also allows (actually, requires) the simplification of the
rich-compare method for blocks.

Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2024-06-04 10:54:18 -06:00
..
lib/gdb Put "source" into DAP scope 2024-06-04 10:36:34 -06:00
py-all-events.def Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-arch.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-auto-load.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-block.c Memoize gdb.Block and make them hashable 2024-06-04 10:54:18 -06:00
py-bpevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-breakpoint.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-cmd.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-connection.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-continueevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-dap.c Don't allow new-ui to start the TUI 2024-05-17 09:39:41 -06:00
py-disasm.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-event-types.def Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-event.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-event.h gdb: pass frames as const frame_info_ptr & 2024-02-20 10:42:25 -05:00
py-events.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-evtregistry.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-evts.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-exitedevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-finishbreakpoint.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-frame.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-framefilter.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-function.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-gdb-readline.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-inferior.c [gdb/python] Throw MemoryError in inferior.read_memory if malloc fails 2024-04-16 15:53:47 +02:00
py-infevents.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-infthread.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-instruction.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-instruction.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-lazy-string.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-linetable.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-membuf.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-mi.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-micmd.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-newobjfileevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-objfile.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-param.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-prettyprint.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-progspace.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-record-btrace.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-record-btrace.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-record-full.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-record-full.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-record.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-record.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-ref.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-registers.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-signalevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-stopevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-stopevent.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
py-symbol.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-symtab.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-threadevent.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-tui.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-type.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-uiout.h gdb: Buffer output streams during events that might download debuginfo 2024-01-19 00:18:00 -05:00
py-unwind.c [gdb/python] Make gdb.UnwindInfo.add_saved_register more robust (fixup) 2024-05-10 08:46:21 +02:00
py-utils.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-value.c Enable call of overloaded subscript operator from python 2024-06-03 17:23:26 +02:00
py-varobj.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-xmethods.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
python-config.py Run isort 2024-04-02 11:21:39 -06:00
python-internal.h Remove 'if' from GDB_PY_HANDLE_EXCEPTION 2024-03-14 08:57:00 -06:00
python.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
python.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00