Skip to content
Snippets Groups Projects
  1. Jan 01, 2023
  2. Jul 18, 2022
    • Tom Tromey's avatar
      Add gdb.free_objfile event registry · 0b4fe76f
      Tom Tromey authored
      Currently, Python code can use event registries to detect when gdb
      loads a new objfile, and when gdb clears the objfile list.  However,
      there's no way to detect the removal of an objfile, say when the
      inferior calls dlclose.
      
      This patch adds a gdb.free_objfile event registry and arranges for an
      event to be emitted in this case.
      
      0b4fe76f
  3. Jan 01, 2022
  4. Nov 30, 2021
    • Andrew Burgess's avatar
      gdb/python: introduce gdb.TargetConnection object type · 0e3b7c25
      Andrew Burgess authored
      This commit adds a new object type gdb.TargetConnection.  This new
      type represents a connection within GDB (a connection as displayed by
      'info connections').
      
      There's three ways to find a gdb.TargetConnection, there's a new
      'gdb.connections()' function, which returns a list of all currently
      active connections.
      
      Or you can read the new 'connection' property on the gdb.Inferior
      object type, this contains the connection for that inferior (or None
      if the inferior has no connection, for example, it is exited).
      
      Finally, there's a new gdb.events.connection_removed event registry,
      this emits a new gdb.ConnectionEvent whenever a connection is removed
      from GDB (this can happen when all inferiors using a connection exit,
      though this is not always the case, depending on the connection type).
      The gdb.ConnectionEvent has a 'connection' property, which is the
      gdb.TargetConnection being removed from GDB.
      
      The gdb.TargetConnection has an 'is_valid()' method.  A connection
      object becomes invalid when the underlying connection is removed from
      GDB (as discussed above, this might be when all inferiors using a
      connection exit, or it might be when the user explicitly replaces a
      connection in GDB by issuing another 'target' command).
      
      The gdb.TargetConnection has the following read-only properties:
      
        'num': The number for this connection,
      
        'type': e.g. 'native', 'remote', 'sim', etc
      
        'description': The longer description as seen in the 'info
                       connections' command output.
      
        'details': A string or None.  Extra details for the connection, for
                   example, a remote connection's details might be
                   'hostname:port'.
      0e3b7c25
  5. Oct 05, 2021
    • Andrew Burgess's avatar
      gdb/python: add a new gdb_exiting event · b1f0f284
      Andrew Burgess authored
      Add a new event, gdb.events.gdb_exiting, which is called once GDB
      decides it is going to exit.
      
      This event is not triggered in the case that GDB performs a hard
      abort, for example, when handling an internal error and the user
      decides to quit the debug session, or if GDB hits an unexpected,
      fatal, signal.
      
      This event is triggered if the user just types 'quit' at the command
      prompt, or if GDB is run with '-batch' and has processed all of the
      required commands.
      
      The new event type is gdb.GdbExitingEvent, and it has a single
      attribute exit_code, which is the value that GDB is about to exit
      with.
      
      The event is triggered before GDB starts dismantling any of its own
      internal state, so, my expectation is that most Python calls should
      work just fine at this point.
      
      When considering this functionality I wondered about using the
      'atexit' Python module.  However, this is triggered when the Python
      environment is shut down, which is done from a final cleanup.  At
      this point we don't know for sure what other GDB state has already
      been cleaned up.
      b1f0f284
  6. Jan 01, 2021
  7. Jan 01, 2020
  8. Jan 01, 2019
    • Joel Brobecker's avatar
      Update copyright year range in all GDB files. · 42a4f53d
      Joel Brobecker authored
      This commit applies all changes made after running the gdb/copyright.py
      script.
      
      Note that one file was flagged by the script, due to an invalid
      copyright header
      (gdb/unittests/basic_string_view/element_access/char/empty.cc).
      As the file was copied from GCC's libstdc++-v3 testsuite, this commit
      leaves this file untouched for the time being; a patch to fix the header
      was sent to gcc-patches first.
      
      gdb/ChangeLog:
      
      	Update copyright year range in all GDB files.
      42a4f53d
  9. Jan 02, 2018
  10. Sep 11, 2017
    • Tom Tromey's avatar
      Make it simpler to add events to Python · 7d221d74
      Tom Tromey authored
      The first patch in this series went through several iterations as I'd
      forgotten how many places had to be touched to add a new event and a
      new event type.
      
      This patch simplifies the process using two new ".def" files.  Now, a
      new event type can be added by adding a line to "py-event-types.def",
      and a new event registry can be added by adding a line to
      "py-all-events.def".
      
      ChangeLog
      2017-09-11  Tom Tromey  <tom@tromey.com>
      
      	* python/python.c (do_start_initialization): Use
      	py-event-types.def to initialize types.
      	Define all object type structures.
      	* python/python-internal.h: Don't declare event initialization
      	functions.
      	* python/py-threadevent.c (thread_event_object_type): Don't
      	define.
      	* python/py-stopevent.c (stop_event_object_type): Don't define.
      	* python/py-signalevent.c (signal_event_object_type): Don't
      	declare or define.
      	* python/py-newobjfileevent.c (new_objfile_event_object_type)
      	(clear_objfiles_event_object_type): Don't declare or define.
      	* python/py-infevents.c (inferior_call_pre_event_object_type)
      	(inferior_call_post_event_object_type)
      	(register_changed_event_object_type)
      	(memory_changed_event_object_type): Don't declare or define.
      	* python/py-inferior.c (new_thread_event_object_type)
      	(new_inferior_event_object_type)
      	(inferior_deleted_event_object_type): Don't declare or define.
      	* python/py-exitedevent.c (exited_event_object_type): Don't
      	declare or define.
      	* python/py-evts.c (gdbpy_initialize_py_events): Use
      	py-all-events.def.
      	* python/py-events.h (thread_event_object_type): Don't declare.
      	(events_object): Use py-all-events.def.
      	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove.  Use
      	py-event-types.def.
      	* python/py-event-types.def: New file.
      	* python/py-continueevent.c (create_continue_event_object): Don't
      	declare or define.
      	* python/py-bpevent.c (breakpoint_event_object_type): Don't
      	declare or define.
      	* python/py-all-events.def: New file.
      7d221d74
Loading