From patchwork Wed Apr 20 06:49:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1619327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=K3A2ZHEY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KjrsV0lKRz9sG0 for ; Wed, 20 Apr 2022 16:50:38 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KjrsS35tHz2ymb for ; Wed, 20 Apr 2022 16:50:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=K3A2ZHEY; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=K3A2ZHEY; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KjrsL58P8z2yP9 for ; Wed, 20 Apr 2022 16:50:28 +1000 (AEST) Received: by mail-pj1-x1036.google.com with SMTP id n11-20020a17090a73cb00b001d1d3a7116bso3201695pjk.0 for ; Tue, 19 Apr 2022 23:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M2tQr07ZBKzFs/UIona7ci6N3mPG1p0LXNOWu2zR26Y=; b=K3A2ZHEYIBfN85taZoY2k1mYzo5kCFzASI61+v4/JDuRb2LT+MveyYkCWtfZIQj+1D JAXTKmsfBQYMSIwsv9jyTDUPLJFteGSIdS51wtwcq7Um5BF19wyiQn4e34xxR93QHNq9 Lpr8ms/+UBlAdPh4iBzjQfSxMmH+kBBgCbB4AHHkQBkAlTbE3w/CsUeSz+XbWLKCnTVI GIn3InhpS5qObpR0XtLiCmjWc6FPA/1+tY9i5FcjnfE838Vk3PVSQzHt1kLvna/chjr/ WaPhvGqsoVhWvPZfvIEO8+nEqQy9MAYE27WWwEKO/dyr+t+4V+0Cs96xez1cjmmy8hqH +VlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M2tQr07ZBKzFs/UIona7ci6N3mPG1p0LXNOWu2zR26Y=; b=KFML6L1Xzq3yI3irRiPFSJ9WsXYkcDC02LOBBuPVgCxOAXIH/swSDuKod9UCSxbeuX z6nyvjk5yoqxK0Y2ukCw8raTFo8wmUAwoJbceAcyGsrJX/M5DZsD4bycQk5oEqa6Vyz9 9jDHS/PhfS0vUExIv1mzMOZ9I9h36U0Bs/O1LYv7UgcJlLeYWAZi450CcIZOHRoH4M2o /Zj8dkMKVBzKBmHmhB3ah5PXmJShAiS7V99lYrzKCDF4fZUGilohGfY2d2omtuZQePbH KwZNTXKhCycXI0NfaYqVIz0wfZypkafZLNfMdYc0XhnYHhB63n+pLAMb2xx7msvWaRCR mh6Q== X-Gm-Message-State: AOAM532Hr6DjzCvV4e+HIhxFRZaB9iTJ/Zwhp1WZwFOgwuRwOatCj2CP 4B6xOhJlR9rv9ck3j+UtjV8p/Ffr23U26A== X-Google-Smtp-Source: ABdhPJyvI8nD0cpohlHi0AOaMFJv54YZe9LEfcKdT7pxwDRzD0tHm6FouPz2TkV4+tcP/E7v1mjDMw== X-Received: by 2002:a17:90a:3e48:b0:1cd:34ec:c72f with SMTP id t8-20020a17090a3e4800b001cd34ecc72fmr2752762pjm.65.1650437423433; Tue, 19 Apr 2022 23:50:23 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([203.221.203.144]) by smtp.gmail.com with ESMTPSA id x20-20020aa79574000000b005061f4782c5sm18481235pfq.183.2022.04.19.23.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 23:50:22 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Wed, 20 Apr 2022 16:49:34 +1000 Message-Id: <20220420065013.222816-1-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 00/39] gdbserver multi-threaded debugging and POWER9/10 support X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" 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 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(-)