This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 00/58] Turn gdbserver's process_stratum_target into a class


Hi All,

This is a C++'ification series that aims to convert the target ops
vector in gdbserver into a class.  Currently, the target ops is a
struct of function pointers.  At the end of the series, it becomes a
class with methods, and the existing low target definitions become
subclasses.  That is, we end up with the following class hierarchy:

process_stratum_target
^
â??â??â?? linux-low
â??â??â?? lynx-low
â??â??â?? nto-low
â??â??â?? win32-low

process_stratum_target either defines the default behavior for the
target ops or leaves them as pure virtual for the subclasses to
override.

PATCH 1's commit message gives more details about the approach in this
transformation.

If and when this series is accepted, the next step is to C++'ify linux
low targets, giving a hierarchy that looks like below.  (This second
phase is not included in this series.)

process_stratum_target
^
â??â??â?? linux-low
â??   ^
â??   â??â??â?? linux-arm-low
â??   â??â??â?? linux-ppc-low
â??   â??â??â?? linux-x86-low
â??   â??â??â?? ...
â??â??â?? lynx-low
â??â??â?? nto-low
â??â??â?? win32-low

My goal in this series was to make gdbserver buildable after each
patch.  I could test this for linux-low, but not for other targets --
in particular, for lynx-low, nto-low, and win32-low.  I verified their
code manually to my best; however, I may have made typos or some
oversights that break build on these systems.  Can builbot be used to
test?

The patches are also available at

https://github.com/barisaktemur/gdb/commits/gdbserver-cppify-target-v1

Thanks.
Baris

Tankut Baris Aktemur (58):
  gdbserver: start turning the target ops vector into a class
  gdbserver: turn target op 'create_inferior' into a method
  gdbserver: turn target op 'post_create_inferior' into a method
  gdbserver: turn target op 'attach' into a method
  gdbserver: turn target op 'kill' into a method
  gdbserver: turn target op 'detach' into a method
  gdbserver: turn target op 'mourn' into a method
  gdbserver: turn target op 'join' into a method
  gdbserver: turn target op 'thread_alive' into a method
  gdbserver: turn target op 'resume' into a method
  gdbserver: turn target op 'wait' into a method
  gdbserver: turn target ops 'fetch_registers' and 'store_registers'
    into methods
  gdbserver: turn prepare_to_access_memory & done_accessing_memory into
    methods
  gdbserver: turn target ops 'read_memory' and 'write_memory' into
    methods
  gdbserver: turn target op 'look_up_symbols' into a method
  gdbserver: turn target op 'request_interrupt' into a method
  gdbserver: turn target op 'read_auxv' into a method
  gdbserver: turn target op 'supports_z_point_type' into a method
  gdbserver: turn target ops 'insert_point' and 'remove_point' into
    methods
  gdbserver: turn target op '{supports_}stopped_by_sw_breakpoint' into a
    method
  gdbserver: turn target op '{supports_}stopped_by_hw_breakpoint' into a
    method
  gdbserver: turn target op 'supports_hardware_single_step' into a
    method
  gdbserver: turn target ops 'stopped_by_watchpoint' and
    'stopped_data_address' into methods
  gdbserver: turn target op 'read_offsets' into a method
  gdbserver: turn target op 'get_tls_address' into a method
  gdbserver: turn target op 'hostio_last_error' into a method
  gdbserver: turn target op 'qxfer_osdata' into a method
  gdbserver: turn target op 'qxfer_siginfo' into a method
  gdbserver: turn non-stop and async target ops into methods
  gdbserver: turn target op 'supports_multi_process' into a method
  gdbserver: turn target ops 'supports_{fork,vfork,exec}_events' into
    methods
  gdbserver: turn target op 'handle_new_gdb_connection' into a method
  gdbserver: turn target op 'handle_monitor_command' into a method
  gdbserver: turn target op 'core_of_thread' into a method
  gdbserver: turn target op 'read_loadmap' into a method
  gdbserver: turn target op 'process_qsupported' into a method
  gdbserver: turn target op 'supports_tracepoints' into a method
  gdbserver: turn target ops 'read_pc' and 'write_pc' into methods
  gdbserver: turn target op 'thread_stopped' into a method
  gdbserver: turn target op 'get_tib_address' into a method
  gdbserver: turn target ops 'pause_all' and 'unpause_all' into methods
  gdbserver: turn target op 'stabilize_threads' into a method
  gdbserver: turn fast tracepoint target ops into methods
  gdbserver: turn target op 'emit_ops' into a method
  gdbserver: turn target op 'supports_disable_randomization' into a
    method
  gdbserver: turn target op 'qxfer_libraries_svr4' into a method
  gdbserver: turn target op 'supports_agent' into a method
  gdbserver: turn btrace-related target ops into methods
  gdbserver: turn target op 'supports_range_stepping' into a method
  gdbserver: turn target op 'pid_to_exec_file' into a method
  gdbserver: turn target ops 'multifs_{open, readlink, unlink}' into
    methods
  gdbserver: turn breakpoint kind-related target ops into methods
  gdbserver: turn target ops 'thread_name' and 'thread_handle' into
    methods
  gdbserver: turn target op 'supports_software_single_step' into a
    method
  gdbserver: turn target op 'supports_catch_syscall' into a method
  gdbserver: turn target op 'get_ipa_tdesc_idx' into a method
  gdbserver: use unique_ptr for 'the_target'
  gdbserver: finish turning the target ops vector into a class

 gdbserver/fork-child.c        |   2 +-
 gdbserver/hostio.c            |  13 +-
 gdbserver/linux-aarch32-low.c |   6 +-
 gdbserver/linux-aarch64-low.c |   4 +-
 gdbserver/linux-arm-low.c     |   8 +-
 gdbserver/linux-cris-low.c    |   4 +-
 gdbserver/linux-crisv32-low.c |   4 +-
 gdbserver/linux-low.c         | 635 ++++++++++++++++++----------------
 gdbserver/linux-low.h         | 222 ++++++++++++
 gdbserver/linux-m32r-low.c    |   4 +-
 gdbserver/linux-mips-low.c    |   2 +-
 gdbserver/linux-nios2-low.c   |   4 +-
 gdbserver/linux-ppc-low.c     |   2 +-
 gdbserver/linux-sh-low.c      |   2 +-
 gdbserver/linux-sparc-low.c   |   6 +-
 gdbserver/linux-tic6x-low.c   |   2 +-
 gdbserver/linux-tile-low.c    |   2 +-
 gdbserver/linux-x86-low.c     |   2 +-
 gdbserver/linux-xtensa-low.c  |   4 +-
 gdbserver/lynx-low.c          | 128 +++----
 gdbserver/lynx-low.h          |  42 +++
 gdbserver/mem-break.c         |  11 +-
 gdbserver/nto-low.c           | 208 ++++-------
 gdbserver/nto-low.h           |  59 ++++
 gdbserver/regcache.c          |  16 +-
 gdbserver/remote-utils.c      |  15 +-
 gdbserver/server.c            |  77 +++--
 gdbserver/target.c            | 578 +++++++++++++++++++++++++++----
 gdbserver/target.h            | 555 ++++++++++++++---------------
 gdbserver/tracepoint.c        |  54 ++-
 gdbserver/win32-low.c         | 214 +++++-------
 gdbserver/win32-low.h         |  68 ++++
 32 files changed, 1803 insertions(+), 1150 deletions(-)

-- 
2.17.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]