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

Message ID cover.1581956646.git.tankut.baris.aktemur@intel.com
Headers show
Series
  • Turn gdbserver's process_stratum_target into a class
Related show

Message

Tankut Baris Aktemur Feb. 17, 2020, 4:57 p.m.
Hello,

This is v2 of the series that was posted at

  https://sourceware.org/ml/gdb-patches/2020-02/msg00313.html

This revision makes the following updates to the previous version:

1. Pedro's comments have been addressed.

2. The series has been rebased on the current master.

3. The win32-low target has been built (but not tested) via
cross-compilation (my thanks to Christian for the tips).  There were a
couple problems detected -- I fixed them.

I am in the process of using buildbot to test on a wide range of
available targets (assuming a series of this size will be accepted by
buildbot).  However, I'm afraid I won't be able to build and test
nto-low and lynx-low.

Finally, this revision is also available at
https://github.com/barisaktemur/gdb/tree/gdbserver-cppify-target-v2

Regards,
Baris


Pedro Alves (1):
  gdbserver: simply copy the pointer in 'set_target_ops'

Tankut Baris Aktemur (57):
  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: finish turning the target ops vector into a class

 gdbserver/hostio.cc            |  13 +-
 gdbserver/linux-aarch32-low.cc |   6 +-
 gdbserver/linux-aarch64-low.cc |   4 +-
 gdbserver/linux-arm-low.cc     |   8 +-
 gdbserver/linux-cris-low.cc    |   4 +-
 gdbserver/linux-crisv32-low.cc |   4 +-
 gdbserver/linux-low.cc         | 654 ++++++++++++++++++---------------
 gdbserver/linux-low.h          | 219 +++++++++++
 gdbserver/linux-m32r-low.cc    |   4 +-
 gdbserver/linux-mips-low.cc    |   2 +-
 gdbserver/linux-nios2-low.cc   |   4 +-
 gdbserver/linux-ppc-low.cc     |   2 +-
 gdbserver/linux-sh-low.cc      |   2 +-
 gdbserver/linux-sparc-low.cc   |   6 +-
 gdbserver/linux-tic6x-low.cc   |   2 +-
 gdbserver/linux-tile-low.cc    |   2 +-
 gdbserver/linux-x86-low.cc     |   2 +-
 gdbserver/linux-xtensa-low.cc  |   4 +-
 gdbserver/lynx-low.cc          | 139 +++----
 gdbserver/lynx-low.h           |  43 +++
 gdbserver/mem-break.cc         |  11 +-
 gdbserver/nto-low.cc           | 208 ++++-------
 gdbserver/nto-low.h            |  60 +++
 gdbserver/regcache.cc          |  16 +-
 gdbserver/remote-utils.cc      |  13 +-
 gdbserver/server.cc            |  77 ++--
 gdbserver/target.cc            | 570 ++++++++++++++++++++++++----
 gdbserver/target.h             | 554 +++++++++++++---------------
 gdbserver/tracepoint.cc        |  54 ++-
 gdbserver/win32-low.cc         | 221 +++++------
 gdbserver/win32-low.h          |  69 ++++
 31 files changed, 1830 insertions(+), 1147 deletions(-)

-- 
2.17.1

Comments

Simon Marchi Feb. 19, 2020, 2:45 a.m. | #1
On 2020-02-17 11:57 a.m., Tankut Baris Aktemur wrote:
> Hello,

> 

> This is v2 of the series that was posted at

> 

>   https://sourceware.org/ml/gdb-patches/2020-02/msg00313.html

> 

> This revision makes the following updates to the previous version:

> 

> 1. Pedro's comments have been addressed.

> 

> 2. The series has been rebased on the current master.

> 

> 3. The win32-low target has been built (but not tested) via

> cross-compilation (my thanks to Christian for the tips).  There were a

> couple problems detected -- I fixed them.

> 

> I am in the process of using buildbot to test on a wide range of

> available targets (assuming a series of this size will be accepted by

> buildbot).  However, I'm afraid I won't be able to build and test

> nto-low and lynx-low.


Do your best for those.  As far as I know there is no publicly / freely
available toolchain for those, so there's not much we can do.

Pedro already went over it, so I won't review it again (there are so many
patches to review!), but I wanted to say thanks for doing this, the series
look very well made and split in incremental steps.

Simon
Pedro Alves Feb. 19, 2020, 2:10 p.m. | #2
On 2/17/20 4:57 PM, Tankut Baris Aktemur wrote:
> Hello,

> 

> This is v2 of the series that was posted at

> 

>   https://sourceware.org/ml/gdb-patches/2020-02/msg00313.html

> 

> This revision makes the following updates to the previous version:

> 

> 1. Pedro's comments have been addressed.


Thank you.

I went over the series again, and I just had one minor comment to
patch #24.  Otherwise this all looks great to me.  Please push.

Thanks again for doing all this.

Pedro Alves
Tankut Baris Aktemur Feb. 20, 2020, 4:03 p.m. | #3
On Wednesday, February 19, 2020 3:11 PM, Pedro Alves wrote:
> 

> I went over the series again, and I just had one minor comment to

> patch #24.  Otherwise this all looks great to me.  Please push.

> 

> Thanks again for doing all this.

> 

> Pedro Alves


Thanks for your review.  I noticed one thing in Patch #43
(https://sourceware.org/ml/gdb-patches/2020-02/msg00668.html)
It introduced this function:

+bool
+linux_process_target::supports_fast_tracepoints ()
+{
+  return true;
+}

This is the correct definition based on the current behavior because 
linux-low's install_fast_tracepoint_jump_pad target op is non-null
-- it directly forwards the request to the_low_target. However, this would
lead to a segfault if the_low_target does not provide an implementation
for the install_fast_tracepoint_jump_pad linux_target_op.

I've changed the definition to

+bool
+linux_process_target::supports_fast_tracepoints ()
+{
+  return the_low_target.install_fast_tracepoint_jump_pad != nullptr;
+}

I'll push with this fix (and the fix for patch #24).

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Tom Tromey Feb. 20, 2020, 5:02 p.m. | #4
Pedro> Thanks again for doing all this.

I'd like to echo Simon's and Pedro's thanks.  This is super.

Tom
Tom Tromey Feb. 20, 2020, 5:04 p.m. | #5
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:


>> However, I'm afraid I won't be able to build and test

>> nto-low and lynx-low.


Simon> Do your best for those.  As far as I know there is no publicly / freely
Simon> available toolchain for those, so there's not much we can do.

IIUC there isn't a C++ compiler for LynxOS and so gdbserver can't be
built there any more.  If this is actually the case, we could remove it.

Tom
Tankut Baris Aktemur Feb. 21, 2020, 8:07 a.m. | #6
On Thursday, February 20, 2020 6:02 PM, Tom Tromey wrote:
> 

> I'd like to echo Simon's and Pedro's thanks.  This is super.

> 

> Tom


Thank you, too, for the acknowledgment.

Note: A similar transformation to convert linux-XYZ-low targets into classes
that derive from linux_process_target is under preparation.

-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928