binutils-gdb/gdb/python
Andrew Burgess 5ddd0d7eef gdb/python: avoid depending on the curses library
The commit:

  commit 29c7078711
  Date:   Sun Sep 8 07:46:09 2024 +0200

      [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp

Highlighted that in some cases we might be running on a system with an
older version of Python (earlier than 3.7), and on a system for which
the curses library has not been installed.

In these circumstances the gdb.missing_debug module will not load as
it uses curses to provide isalnum() and isascii() functions.

To avoid this problem I propose that we copy the isalnum() and
isascii() from the Python curses library.  These functions are
basically trivial and removing the curses dependency means GDB will
work in more cases without increasing its dependencies.

I did consider keeping the uses of curses and only having the function
definitions be a fallback for when the curses library failed to load,
but this felt like overkill.  The function definitions are both tiny
and I think "obvious" given their specifications, so I figure we might
as well just use our own definitions if they are not available as
builtin methods on the str class.

For testing I changed this line:

  if sys.version_info >= (3, 7):

to

  if sys.version_info >= (3, 7) and False:

then reran gdb.python/py-missing-debug.exp, there were no failures.

Approved-By: Tom de Vries <tdevries@suse.de>
2024-09-10 14:07:11 +01:00
..
lib/gdb gdb/python: avoid depending on the curses library 2024-09-10 14:07:11 +01: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/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02: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/python] Use GDB_PY_SET_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-cmd.c gdb: split apart two different types of filename completion 2024-09-07 20:28:57 +01:00
py-connection.c [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02: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/python] Fix handling of ^C during disassembly 2024-08-08 23:52:00 +02: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/python] Use GDB_PY_SET_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-frame.c [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-framefilter.c gdb: drop struct keyword when using bound_minimal_symbol 2024-08-12 10:31:09 -04:00
py-function.c gdb: remove gdbcmd.h 2024-04-25 12:59:02 -04:00
py-gdb-readline.c [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-inferior.c [gdb] Add const to catch gdb_exception 2024-08-22 09:49:53 +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 fix division by zero in target_read_string() 2024-06-11 09:50:08 -06: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/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02: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: make objfile::pspace private 2024-07-15 13:55:00 +00:00
py-param.c [gdb/python] Use GDB_PY_SET_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-prettyprint.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
py-progspace.c gdb: make progspace::exec_filename private, add getter / setter 2024-06-07 23:09:03 -04:00
py-record-btrace.c [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-record-btrace.h python: Add clear() to gdb.Record. 2024-08-14 11:20:56 +02: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/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
py-record.h python: Introduce gdb.RecordAuxiliary class. 2024-08-14 11:20:56 +02: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/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02: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 Remove tui_wrefresh 2024-09-07 14:23:04 -06:00
py-type.c [gdb/python] Eliminate catch(...) in type_to_type_object 2024-08-22 09:49:53 +02: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 [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +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 btrace, python: Enable ptwrite filter registration. 2024-08-14 11:20:57 +02:00
python.c [gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often 2024-08-27 09:20:18 +02:00
python.h Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00