From patchwork Mon Jan 13 17:42:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 182816 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp4567497och; Mon, 13 Jan 2020 09:44:44 -0800 (PST) X-Google-Smtp-Source: APXvYqy7hC7VtzUwH6/tAWd+gKehbz6QuA0lGyE9I2iNK8TlV7yfFS1GG2xy9szqTrjH6ADvvOrj X-Received: by 2002:a9d:7d81:: with SMTP id j1mr14203416otn.267.1578937376386; Mon, 13 Jan 2020 09:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578937376; cv=none; d=google.com; s=arc-20160816; b=F4rHkeD2e6qkwoXGaDOp3G/Z55Rb5Y4qE1MKKVqST4XRMqU2oZpKVGnOX/VArVf0n0 32Bv58yR2jrlY/OE3ldLv7gPjWwWQm03PCgCol+lNfRaetJL/AYcY3iy5pD1JOsQUtyp tJRqgwSKRx6uScIMj1pbuwppopBItMAJYOmGpLOZNw2hsbu2q89njLdj4lmVzxG5MhIy NaWDvoyPKIkz5R51/oHjK/laEbiV0PVouFk3LJEKDKOlkhyiR+X8P03Gx+AU7eH/dhlU wGW4DVmeOiF338e2OijyIKoDXLsndAdZwUVDRaprAmfTJ8d7cB6V1xBePq/0gUBiWdI8 g6rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=WSP95p2DucRj5SZ1QrCZ7ceX1EaFNO2wEQzi1xl36m4=; b=roBqC0Ov8qDeSZMUVCg6HsuRqC2QZlx7nHln9FeihUmZXJ7LXIbJYjwXhHO1l+Rc8+ S1fiJb592v/bGqZDoQf34Eyz/NGrqNOhpdWJqn4Ip8eM2LlLiNdQabING0DMj6+EX34l WSCHzPgpo/Vrw+ajM2HkwIgdlXVG2MEKB+JbDRHnARR4yhvuy9iwpnwAc/xk3zv5Rlis nNO+NVyDPBuum+SM9uyxOuPw4ov/Xi5dOew55tGxByXE4/jSydPRduxA7XkF0murRdWu wNCBa88CtuylCkn0Pxspjmo5uQiKWejUST3P6EAwObzkMrI4j8MW6bOIZQtQWwhqlMX4 lOTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wWoDAVnW; dkim=pass header.i=@linaro.org header.s=google header.b=O2kIXsKj; spf=pass (google.com: domain of gdb-patches-return-163025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gdb-patches-return-163025-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u8si6842433otq.262.2020.01.13.09.42.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jan 2020 09:42:56 -0800 (PST) Received-SPF: pass (google.com: domain of gdb-patches-return-163025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wWoDAVnW; dkim=pass header.i=@linaro.org header.s=google header.b=O2kIXsKj; spf=pass (google.com: domain of gdb-patches-return-163025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gdb-patches-return-163025-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=DO/NsRCHHIL1fbBfSOhgi/71dqu447WqQceXttE8m139QkMmezNY3 XkyW3xiInJL4TrFFekDnQPCpve2s2ilEmpdNpAsO1VqK1srll2PJSp721kb9f882 gdnEdUaVe3fFajL2WlzLf/NW2dlpTNp8QgCgf6+hPul97A2VL/Ojh0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=cHBJXu1lQo493GM8nWXGWM7dpqA=; b=wWoDAVnWgn3pA0CCDQR6KddNHnth ssGGUQwcr2oFEp8WgT3ijjr+GMaloI2/4PwCN5Dh/a6wzxEu+VisPFS+dQiTwSG9 7HK2Kjya6sSxHwzytBTRQeAm1Mt6EiettQ0LqvCEdaecwiVFLt5Hb+1+Ph00U6lo biqR5THj/Oub3Lw= Received: (qmail 33452 invoked by alias); 13 Jan 2020 17:42:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 33442 invoked by uid 89); 13 Jan 2020 17:42:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Condition X-HELO: mail-qk1-f179.google.com Received: from mail-qk1-f179.google.com (HELO mail-qk1-f179.google.com) (209.85.222.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Jan 2020 17:42:48 +0000 Received: by mail-qk1-f179.google.com with SMTP id z76so9308691qka.2 for ; Mon, 13 Jan 2020 09:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WSP95p2DucRj5SZ1QrCZ7ceX1EaFNO2wEQzi1xl36m4=; b=O2kIXsKjG6D0KHxl9sG3zEpnlHyZOsj0w+WZra2ycO3bdNzypGM1RZJgMCKCGqv0PB Q27U7tCW0JS9Qn68MPRyP/g6hx+xDnP4h2PtzueBYP6RUb8y2ZCM+b9NNw1uD3wOBnnB A/8TxBemJnFdCO+QJUZmGPEUmDaRFbR9ken1pW5GfosO6eRXdGk0mHmEo5RdZq13I8GY Q641maByV01Ra36Jzr6sdwkyDqg6ft6P6HSJTEXGiCPB06xZZJ3vl7bBVC22iSM/rez4 H6zhZbtb4ZEn8Fr2DnlNTgXzfian/1+IK3N9N6r3pOCkt2AbchP1Y7dBfgyokLy5k5f9 ErVQ== Return-Path: Received: from localhost.localdomain ([179.183.9.215]) by smtp.gmail.com with ESMTPSA id s27sm5247049qkm.97.2020.01.13.09.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 09:42:45 -0800 (PST) From: Luis Machado To: gdb-patches@sourceware.org Cc: alan.hayward@arm.com Subject: [PATCH, v2][AArch64] Add more debugging output to aarch64_displaced_step_fixup Date: Mon, 13 Jan 2020 14:42:37 -0300 Message-Id: <20200113174239.7819-1-luis.machado@linaro.org> X-IsSubscribed: yes New in v2: - Fixed misc comments from review. -- While debugging the step-over-syscall problem, i wanted to see a bit more debugging output to try to determine the root cause. This patch does this. gdb/ChangeLog: 2020-01-13 Luis Machado * aarch64-tdep.c (aarch64_displaced_step_fixup): Add more debugging output. --- gdb/aarch64-tdep.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 6a9d34dc67..29b712c155 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3037,8 +3037,16 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, regcache_cooked_read_unsigned (regs, AARCH64_PC_REGNUM, &pc); + if (debug_displaced) + debug_printf ("Displaced: PC after stepping: %s (was %s).\n", + paddress (gdbarch, pc), paddress (gdbarch, to)); + if (dsc->cond) { + if (debug_displaced) + debug_printf ("Displaced: [Conditional] pc_adjust before: %d\n", + dsc->pc_adjust); + if (pc - to == 8) { /* Condition is true. */ @@ -3050,8 +3058,18 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, } else gdb_assert_not_reached ("Unexpected PC value after displaced stepping"); + + if (debug_displaced) + debug_printf ("Displaced: [Conditional] pc_adjust after: %d\n", + dsc->pc_adjust); } + if (debug_displaced) + debug_printf ("Displaced: %s PC by %d\n", + dsc->pc_adjust? "adjusting" : "not adjusting", + dsc->pc_adjust); + + if (dsc->pc_adjust != 0) { /* Make sure the previous instruction was executed (that is, the PC @@ -3059,11 +3077,16 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, offset. Otherwise we may skip an instruction before its execution took place. */ if ((pc - to) == 0) - dsc->pc_adjust = 0; + { + if (debug_displaced) + debug_printf ("Displaced: PC did not move. Discarding PC " + "adjustment.\n"); + dsc->pc_adjust = 0; + } if (debug_displaced) { - debug_printf ("displaced: fixup: set PC to %s:%d\n", + debug_printf ("Displaced: fixup: set PC to %s:%d\n", paddress (gdbarch, from), dsc->pc_adjust); } regcache_cooked_write_unsigned (regs, AARCH64_PC_REGNUM,