mbox series

[v2,00/39] gdbserver multi-threaded debugging and POWER9/10 support

Message ID 20220420065013.222816-1-npiggin@gmail.com
Headers show
Series gdbserver multi-threaded debugging and POWER9/10 support | expand

Message

Nicholas Piggin April 20, 2022, 6:49 a.m. UTC
POWER10 is working well with sbefifo (modulo the start SBE command
being buggy with stop states -- make sure you use powersave=off when
testing this, until those can be fixed). POWER9 similarly works well,
with the exception of breakpoints causing PSI interrupt storm.

gdbserver itself was due for a bit of attention so there's a bunch of
improvements and fixes.

Multi-threaded debugging is implemented later in the series using the
gdb "all-stop" threads model (all target threads are stopped if any is
stopped).

Since v1:
- Made changes suggested by Joel (thanks).
- Made a generated target, split out the regen of the stale
  gdb_parser_precompile.c into that patch.
- Make the double-ctrl-C really immediately kill.
- Implemented multi-threaded debugging.
- A few more smaller improvements (put_mem handling, breakpoint
  command handling, returning more registers).
- Redudce round trips further by returning registers with stop reason.
- POWER9 support as well.
- Proper SPATTN / attn detection and clearing for POWER9/10.

Thanks,
Nick


Nicholas Piggin (39):
  libpdbg: fix p9chip and p10chip thread_stop
  gdbserver: add a 'generated' make target, update
    gdb_parser_precompile.c
  gdbserver: rename detach command handler
  gdbserver: fix put_mem command parsing
  gdbserver: include <port> argument in command line help text
  gdbserver: Document problem and workaround for client remote timeouts
  gdbserver: print some client/server info
  gdbserver: Make command callback array static
  gdbserver: use standard compatibility test calls
  gdbserver: fix read buffer overflow
  gdbserver: reduce PR_INFO noise
  gdbserver: fix interrupt double stop reason response
  libpdbg: thread_regs don't print regs
  gdbserver: lexer fixes
  gdbserver: put_mem handle arbitrary lengths
  gdbserver: implement NoAckMode
  libpdbg: Remove enable_attn target command
  gdbserver: disable attn after breaking
  gdbserver: use read-modify-write for put_mem that is not 8-byte
    aligned
  gdbserver: enable POWER9 support
  gdbserver: Add POWER10 support
  gdbserver: check for attn using the SPATTN register
  gdbserver: breakpoint instruction test current host endian when it is
    required
  gdbserver: catch ctrl-C to clean up host state
  gdbserver: return more registers
  gdbserver: initial thread support
  gdbserver: track attn enablement by breakpoints
  gdbproxy: implement get_thread / set_thread commands
  gdbserver: add multi-threaded start/stop helper functions
  gdbserver: tidy poll()
  gdbserver: multi-thread polling and stop-reason
  gdbserver: track stop reason per thread
  gdbserver: multithread debugging support
  gdbserver: allow gdbserver to start with targets running
  gdbserver: better deal with threads initially stopped
  gdbserver: send regs with stop reason
  gdbserver: use thread_stop_all() / thread_start_all()
  gdbserver: handle gdb breakpoint commands
  gdbserver: remove fallback breakpoint support in put_mem

 Makefile.am                 |   12 +
 README.md                   |   45 +-
 libpdbg/chip.c              |    2 -
 libpdbg/hwunit.c            |    1 +
 libpdbg/hwunit.h            |    2 +-
 libpdbg/p10chip.c           |    8 +-
 libpdbg/p8chip.c            |   31 -
 libpdbg/p9chip.c            |    8 +-
 libpdbg/thread.c            |    7 +-
 src/gdb_parser.rl           |  124 +++-
 src/gdb_parser_precompile.c |  478 ++++++++++-----
 src/main.c                  |    2 +-
 src/pdbgproxy.c             | 1121 +++++++++++++++++++++++++++++++----
 src/pdbgproxy.h             |   11 +-
 src/thread.c                |    2 +
 15 files changed, 1495 insertions(+), 359 deletions(-)

Comments

Joel Stanley May 3, 2022, 7:47 a.m. UTC | #1
On Wed, 20 Apr 2022 at 06:50, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> POWER10 is working well with sbefifo (modulo the start SBE command
> being buggy with stop states -- make sure you use powersave=off when
> testing this, until those can be fixed). POWER9 similarly works well,
> with the exception of breakpoints causing PSI interrupt storm.
>
> gdbserver itself was due for a bit of attention so there's a bunch of
> improvements and fixes.
>
> Multi-threaded debugging is implemented later in the series using the
> gdb "all-stop" threads model (all target threads are stopped if any is
> stopped).
>
> Since v1:
> - Made changes suggested by Joel (thanks).
> - Made a generated target, split out the regen of the stale
>   gdb_parser_precompile.c into that patch.
> - Make the double-ctrl-C really immediately kill.
> - Implemented multi-threaded debugging.
> - A few more smaller improvements (put_mem handling, breakpoint
>   command handling, returning more registers).
> - Redudce round trips further by returning registers with stop reason.
> - POWER9 support as well.
> - Proper SPATTN / attn detection and clearing for POWER9/10.

Looking good. Unless there's things you want to fix on the first go,
I'll merge these and you can send any improvements as follow up
patches?

Cheers,

Joel

>
> Thanks,
> Nick
>
>
> Nicholas Piggin (39):
>   libpdbg: fix p9chip and p10chip thread_stop
>   gdbserver: add a 'generated' make target, update
>     gdb_parser_precompile.c
>   gdbserver: rename detach command handler
>   gdbserver: fix put_mem command parsing
>   gdbserver: include <port> argument in command line help text
>   gdbserver: Document problem and workaround for client remote timeouts
>   gdbserver: print some client/server info
>   gdbserver: Make command callback array static
>   gdbserver: use standard compatibility test calls
>   gdbserver: fix read buffer overflow
>   gdbserver: reduce PR_INFO noise
>   gdbserver: fix interrupt double stop reason response
>   libpdbg: thread_regs don't print regs
>   gdbserver: lexer fixes
>   gdbserver: put_mem handle arbitrary lengths
>   gdbserver: implement NoAckMode
>   libpdbg: Remove enable_attn target command
>   gdbserver: disable attn after breaking
>   gdbserver: use read-modify-write for put_mem that is not 8-byte
>     aligned
>   gdbserver: enable POWER9 support
>   gdbserver: Add POWER10 support
>   gdbserver: check for attn using the SPATTN register
>   gdbserver: breakpoint instruction test current host endian when it is
>     required
>   gdbserver: catch ctrl-C to clean up host state
>   gdbserver: return more registers
>   gdbserver: initial thread support
>   gdbserver: track attn enablement by breakpoints
>   gdbproxy: implement get_thread / set_thread commands
>   gdbserver: add multi-threaded start/stop helper functions
>   gdbserver: tidy poll()
>   gdbserver: multi-thread polling and stop-reason
>   gdbserver: track stop reason per thread
>   gdbserver: multithread debugging support
>   gdbserver: allow gdbserver to start with targets running
>   gdbserver: better deal with threads initially stopped
>   gdbserver: send regs with stop reason
>   gdbserver: use thread_stop_all() / thread_start_all()
>   gdbserver: handle gdb breakpoint commands
>   gdbserver: remove fallback breakpoint support in put_mem
>
>  Makefile.am                 |   12 +
>  README.md                   |   45 +-
>  libpdbg/chip.c              |    2 -
>  libpdbg/hwunit.c            |    1 +
>  libpdbg/hwunit.h            |    2 +-
>  libpdbg/p10chip.c           |    8 +-
>  libpdbg/p8chip.c            |   31 -
>  libpdbg/p9chip.c            |    8 +-
>  libpdbg/thread.c            |    7 +-
>  src/gdb_parser.rl           |  124 +++-
>  src/gdb_parser_precompile.c |  478 ++++++++++-----
>  src/main.c                  |    2 +-
>  src/pdbgproxy.c             | 1121 +++++++++++++++++++++++++++++++----
>  src/pdbgproxy.h             |   11 +-
>  src/thread.c                |    2 +
>  15 files changed, 1495 insertions(+), 359 deletions(-)
>
> --
> 2.35.1
>
> --
> Pdbg mailing list
> Pdbg@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
Nicholas Piggin May 10, 2022, 9:47 a.m. UTC | #2
Excerpts from Joel Stanley's message of May 3, 2022 5:47 pm:
> On Wed, 20 Apr 2022 at 06:50, Nicholas Piggin <npiggin@gmail.com> wrote:
>>
>> POWER10 is working well with sbefifo (modulo the start SBE command
>> being buggy with stop states -- make sure you use powersave=off when
>> testing this, until those can be fixed). POWER9 similarly works well,
>> with the exception of breakpoints causing PSI interrupt storm.
>>
>> gdbserver itself was due for a bit of attention so there's a bunch of
>> improvements and fixes.
>>
>> Multi-threaded debugging is implemented later in the series using the
>> gdb "all-stop" threads model (all target threads are stopped if any is
>> stopped).
>>
>> Since v1:
>> - Made changes suggested by Joel (thanks).
>> - Made a generated target, split out the regen of the stale
>>   gdb_parser_precompile.c into that patch.
>> - Make the double-ctrl-C really immediately kill.
>> - Implemented multi-threaded debugging.
>> - A few more smaller improvements (put_mem handling, breakpoint
>>   command handling, returning more registers).
>> - Redudce round trips further by returning registers with stop reason.
>> - POWER9 support as well.
>> - Proper SPATTN / attn detection and clearing for POWER9/10.
> 
> Looking good. Unless there's things you want to fix on the first go,
> I'll merge these and you can send any improvements as follow up
> patches?

Thanks for the review, sorry it took so long to get around to replying.

You raised some good points but if I can address them incrementally
might be easier.

Thanks,
Nick
Joel Stanley May 17, 2022, 8 a.m. UTC | #3
On Tue, 10 May 2022 at 09:47, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Excerpts from Joel Stanley's message of May 3, 2022 5:47 pm:
> > On Wed, 20 Apr 2022 at 06:50, Nicholas Piggin <npiggin@gmail.com> wrote:
> >>
> >> POWER10 is working well with sbefifo (modulo the start SBE command
> >> being buggy with stop states -- make sure you use powersave=off when
> >> testing this, until those can be fixed). POWER9 similarly works well,
> >> with the exception of breakpoints causing PSI interrupt storm.
> >>
> >> gdbserver itself was due for a bit of attention so there's a bunch of
> >> improvements and fixes.
> >>
> >> Multi-threaded debugging is implemented later in the series using the
> >> gdb "all-stop" threads model (all target threads are stopped if any is
> >> stopped).
> >>
> >> Since v1:
> >> - Made changes suggested by Joel (thanks).
> >> - Made a generated target, split out the regen of the stale
> >>   gdb_parser_precompile.c into that patch.
> >> - Make the double-ctrl-C really immediately kill.
> >> - Implemented multi-threaded debugging.
> >> - A few more smaller improvements (put_mem handling, breakpoint
> >>   command handling, returning more registers).
> >> - Redudce round trips further by returning registers with stop reason.
> >> - POWER9 support as well.
> >> - Proper SPATTN / attn detection and clearing for POWER9/10.
> >
> > Looking good. Unless there's things you want to fix on the first go,
> > I'll merge these and you can send any improvements as follow up
> > patches?
>
> Thanks for the review, sorry it took so long to get around to replying.
>
> You raised some good points but if I can address them incrementally
> might be easier.

I've merged them. I'll do a bit more testing before pushing them out.

Thanks for all the hard work.

Cheers,

Joel