[PATCH] Add gdb remote protocol handling to strace

Stan Cox scox at redhat.com
Wed Sep 25 13:29:26 UTC 2019


This is the latest version of the gdbserver backend patch.
It also adds a ptrace instantiation of the backend dispatch
mechanism added for the gdbserver backend.  It is a large patch
but much of it is boilerplate changes due to adding and use of the 
tracing_backend struct.  The code is located on the branch 'gdbserver0' 
in the repository:
  https://github.com/stanfordcox/strace
There is a copr build here:
  https://copr.fedorainfracloud.org/coprs/scox/strace/

Thanks to Eugene Syromiatnikov for suggestions and coding effort on the 
ptrace instantiation of the backend dispatch mechanism.

(The backend piece could be split out as a separate piece to simplify 
the patch)


configure*: configure support

-tracing_backend.h:
  struct tracing_backend:  backend dispatch table.   All of the 
gdbserver/ptrace
  versions of these routines are independent and self contained except
  for get_regs which needs access to the register structures
  Any change not mentioned is only a change to allow for calling via a
  backend routine

-ptrace_backend.{c,h}:
  ptrace instantiation of tracing_backend.  It dispatches to existing 
routines

-strace.c/syscall.c
  dispatch to the ptrace_* routines defined in ptrace_backend.h
  Add 'G' option to indicate how to connect to gdbs backend
  start_init invokes gdbserver, startup_child, startup_attach (via
  attach_tcb) start or connect to the child,
-syscall.c
  invoke backend.get_regs, which needs to access the iovec.  gdbserver
  does not require a separate routine to get the syscall number.
-gdbrsp.test
  New test

-gdbserver.c
  the gdbserver of the backend methods are defined here.  Communicates
  with gdbserver via the gdb remote protocol and converts to the
  packets that strace expects.  gdbserver has a syscall mode that
  returns information on syscalls via stop packets.  gdbserver has two
  protocol modes, all stop and non stop; both are supported.
-protocol.c
  support routines: gdb remote packets are deciphered here
-protocol.h
-signals.def
-signals.h
  gdb to native signal translation
-gdb_get_regs.c
  Gets the register set from gdbserver and converts to strace structures.

-gdbrsp.test/gdbrsp.c
  Adds a gdbserver specific syscall test.  The test is a gdb/gdbserver
  test.

-tests/gen_tests.in / tests/gen_tests.sh
  The gen_tests are also run in gdbserver mode.  Some of the tests do not
  work in the gdbserver environment so they are "blacklisted" with
  # !gdb

-tests/init.sh
  Adds run_strace_gdbserver and run_strace_gdbserver_match_diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdbserver-backend.patch
Type: text/x-patch
Size: 138665 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190925/db28e818/attachment.bin>


More information about the Strace-devel mailing list