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: 37352 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(-) 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,