From patchwork Tue May 31 09:14:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637262 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=DZwLb5hb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67Y3J3kz9s1l for ; Tue, 31 May 2022 19:15:21 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67Y2DYwz3bkQ for ; Tue, 31 May 2022 19:15:21 +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=DZwLb5hb; 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::42f; helo=mail-pf1-x42f.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=DZwLb5hb; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 4LC67N3d3tz3bbj for ; Tue, 31 May 2022 19:15:12 +1000 (AEST) Received: by mail-pf1-x42f.google.com with SMTP id p8so12649872pfh.8 for ; Tue, 31 May 2022 02:15:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=5VnWbsmwNLTh3Rc/F6QlRxdGIpwBR0WDhPojTC/5+M8=; b=DZwLb5hbgrOMdgd23cy0qgxGHdON9bN1BMHDG3iJ4oL9Zgk3CxB5t9nAMxzee1ZVr7 QCMX756xHanzgvEnUQvutQ0vEVfdZT0EMwxJ9Ik9S5uQYQi2RKnt/U31UcZmDFgM41gA d1UMIydtv35ksrHhrpy0rEj3BKIM+PKYOc+SSAGsl66NAEDwHoeYJZtjnNg39z6w0IUl fI+GLvHA4vTDW6KnwffynV093NPefB06oZ9IenyMLNmJ6FwU+U9qlFpujUsjZC8dt432 x51Px4Cd/fBofJOT8dHhXnKUlVMD57tAweQJz1fUikKJ1IvsZk3WEXq/+DT5hoZL36TX k+fQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5VnWbsmwNLTh3Rc/F6QlRxdGIpwBR0WDhPojTC/5+M8=; b=oMByU3QA1dEIuf5z21+v/nHDRl4kSAUYyp6nLJMaziuKao4qrEKjLXLIus9eJt3l5z wi1S4Am40TwUSv+Gv0oLwfBrkJsoPND8k0Ajwa9nOhfJq0ATNmttmNK9/G3sfZeMN/IG DfC1fE2dB5Jvjcek4gU07ax5fBJrn6HxfycQfXShDxj4H3yxZ10shjF2F7JduXLGsDPZ ZFcW+eRLWaoiIbxpRwXoiBR9cPOSg0vcqhNq+vQ3gwi2Fl56WljblfPhxOkmWL5aBg5i o1QXGjw/vfBio0Ia/U59IF+javjCw422KTyjEF4NUf75INJSi5dWe0YrQ4cMbWLpgZSk YLlA== X-Gm-Message-State: AOAM531/KaD6RR4T97DCH6gsAHGqxEIPziVFjaNe7AVZ5AEW1UYcbcud IkaL/+eHMqvVwwnwq3XNTd2o6rAWcSCRiQ== X-Google-Smtp-Source: ABdhPJwiqiAAB+PSBRUQenmdogTDMoBr46F3un2an5hMVbURY+PpwTboIuGmbbdfSC2rl3v+u0vTSw== X-Received: by 2002:a05:6a00:c85:b0:518:b4a7:cce1 with SMTP id a5-20020a056a000c8500b00518b4a7cce1mr38795449pfv.66.1653988510181; Tue, 31 May 2022 02:15:10 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:09 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:50 +1000 Message-Id: <20220531091457.2208488-4-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 03/10] gdbserver: use TRAP for step stop reason 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" gdb expects single step to provide the TRAP stop reason, otherwise it considers it an unknown / other stop. This makes it print odd thread stop messages when single stepping, and it also causes it to break unexpectedly when continuing threads that had hit a breakpoint because it steps those threads over the breakpoint address before continuing, and that step causes it to break again unless the stop reason is TRAP. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index 2d579a4a..29845762 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -66,6 +66,7 @@ struct gdb_thread { bool attn_set; bool initial_stopped; bool stop_attn; + bool stop_sstep; bool stop_ctrlc; }; @@ -208,7 +209,7 @@ static void send_stop_for_thread(struct pdbg_target *target) int sig; int i; - if (gdb_thread->stop_attn) + if (gdb_thread->stop_attn || gdb_thread->stop_sstep) sig = 5; /* TRAP */ else if (gdb_thread->stop_ctrlc) sig = 2; /* INT */ @@ -853,8 +854,9 @@ static void v_conts(uint64_t *stack, void *priv) thread_step(thread_target, 1); - gdb_thread->stop_ctrlc = false; gdb_thread->stop_attn = false; + gdb_thread->stop_sstep = true; + gdb_thread->stop_ctrlc = false; send_stop_for_thread(thread_target); } @@ -901,6 +903,7 @@ static void start_all(void) gdb_thread = thread->gdbserver_priv; gdb_thread->stop_attn = false; + gdb_thread->stop_sstep = false; gdb_thread->stop_ctrlc = false; }