From patchwork Mon Dec 30 16:25:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 37128 Received: (qmail 121066 invoked by alias); 30 Dec 2019 16:25:52 -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 121009 invoked by uid 89); 30 Dec 2019 16:25:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=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= X-HELO: mail-pl1-f195.google.com Received: from mail-pl1-f195.google.com (HELO mail-pl1-f195.google.com) (209.85.214.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Dec 2019 16:25:50 +0000 Received: by mail-pl1-f195.google.com with SMTP id p27so14810579pli.10 for ; Mon, 30 Dec 2019 08:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=73eCSAP8+WvXzHo751Y2G7ZHg//NC0xYx6BWgP1X780=; b=blavW6g3bDWWjtlJmAGv0C/L7ektANoqZZpQaARFs4Bu0QA3GWgdZgE8jWCAvNJggP tzZ4Yuq0at12eML2bcWnXOGz5EhlVZL5cij/XRrwk5c6SvzH52JVK4yqG7YOw/av9GO8 TVMj7dYK2ZBon8Lq0TF4BimTOZkA6QIPnOUKcW1V0/DWRsC7J5rMD3qZiVGtObyZAtdj DZif+zUBeBQX9CNsseLaypXIOHfz1IrAUxJUwT0oge7wHJ8IDW9AWOz6dTa2M8nPmbG0 2txxFu8OFyl2+ZoM/B51+KD9ZiJN7DbVONofkwLf9cKuhfKLwVPsgtkWHS1wNpQ/90id dpdg== Return-Path: Received: from localhost.localdomain ([191.251.164.209]) by smtp.gmail.com with ESMTPSA id p24sm52397369pff.69.2019.12.30.08.25.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 08:25:48 -0800 (PST) From: Luis Machado To: gdb-patches@sourceware.org Subject: [PATCH 2/2] [AArch64] Add more debugging output to aarch64_displaced_step_fixup Date: Mon, 30 Dec 2019 13:25:35 -0300 Message-Id: <20191230162535.21211-2-luis.machado@linaro.org> In-Reply-To: <20191230162535.21211-1-luis.machado@linaro.org> References: <20191230162535.21211-1-luis.machado@linaro.org> X-IsSubscribed: yes 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: 2019-12-30 Luis Machado * aarch64-tdep.c (aarch64_displaced_step_fixup): Add more debugging output. Signed-off-by: Luis Machado --- gdb/aarch64-tdep.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index a639b753cd..2d6c5a4bcb 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3058,8 +3058,16 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, /* Fetch the current PC, after the displaced execution took place. */ 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. */ @@ -3072,8 +3080,17 @@ 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->should_adjust_pc? "adjusting" : "not adjusting", + dsc->pc_adjust); + if (dsc->should_adjust_pc) { @@ -3082,7 +3099,12 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, and the instruction after the syscall instruction. Make sure we don't adjust the PC when we did not really move. */ 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) {