From patchwork Sun Dec 17 18:11:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 24981 Received: (qmail 63392 invoked by alias); 17 Dec 2017 18:11:38 -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 63376 invoked by uid 89); 17 Dec 2017 18:11:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*rth X-HELO: mail-it0-f52.google.com Received: from mail-it0-f52.google.com (HELO mail-it0-f52.google.com) (209.85.214.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Dec 2017 18:11:36 +0000 Received: by mail-it0-f52.google.com with SMTP id m11so3230257iti.1 for ; Sun, 17 Dec 2017 10:11:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=a6yBpwVWC27qqFebE7bx0rKPTkRGSc25NdU2YSwCqfA=; b=M4qzrMqza5XjJ701QMYWtzkfnfy2Gi/8xKvza7WEnHWNzyPx0z/jYad9l7I+7C3JVW ds7aBwBl/5zmH1Wo5AGuvzm8X0z7aSUvUbk60vW5zddrU/KgGtc1HFsfnconMsT0WZ/v tMEBRKxvM/ccrYJwBHvI9H7pA7O9r8uhVCDsafX3DH/BsdI66NVdCQThTVBt2tTAspOr fyseDPaINAICKy+I0gzYV06QHnoX+0vIrgZCDTxLloV1cA2sERvn29gB+uhYUM8pJeJV 2GTOdC4xSnzaj0F7ybRNnyCk83x+jIUKhDr/N1Ya0Qf4QZq9oz434+wP9FsDSQcIHFAZ 8R+Q== X-Gm-Message-State: AKGB3mI+lzsiMQuW9+3iDUcTeHuNyyvRDxEBdA4Y6dOQ2SRERbHR24PK zOHnwJL3Tcpo/23ndYbPznORqAU1Kryir06d1hs= X-Google-Smtp-Source: ACJfBouVHczFkYIq0tP08ul1U8VGJRXtzffnqivVKZAi4Yae9Vv9ohm3oAfEaVrJYyMsln89HlFpzYRhfKSJFURFhVk= X-Received: by 10.36.73.210 with SMTP id e79mr16038743itd.78.1513534294509; Sun, 17 Dec 2017 10:11:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.43.85 with HTTP; Sun, 17 Dec 2017 10:11:33 -0800 (PST) In-Reply-To: References: From: Uros Bizjak Date: Sun, 17 Dec 2017 19:11:33 +0100 Message-ID: Subject: Re: [PATCH]: Fix PR19061, gdb hangs/spins-on-cpu when debugging any program on Alpha To: Pedro Alves Cc: gdb-patches@sourceware.org, Richard Henderson , Tobias Klausmann On Fri, Dec 15, 2017 at 7:21 PM, Pedro Alves wrote: > On 12/15/2017 12:11 PM, Uros Bizjak wrote: >> >> Please note that I have no commit access, so if approved, please >> commit the patch to the source repository for me. > > Merged. Thanks! Attached, please find a patch for gdb-8.0 branch. The patch is tested in the same way as the patch for mainline, with native alphaev68-linux-gnu build and tests and with gcc's guality.exp and simulate-thread.exp testcases. Uros. --- alpha-tdep.c 2017-12-14 15:56:48.955960647 +0100 +++ alpha-tdep.c.ub 2017-12-14 15:56:33.751806965 +0100 @@ -766,10 +766,8 @@ the sequence. */ static VEC (CORE_ADDR) * -alpha_deal_with_atomic_sequence (struct regcache *regcache) +alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); - CORE_ADDR pc = regcache_read_pc (regcache); CORE_ADDR breaks[2] = {-1, -1}; CORE_ADDR loc = pc; CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */ @@ -1721,12 +1719,17 @@ alpha_software_single_step (struct regcache *regcache) { struct gdbarch *gdbarch = get_regcache_arch (regcache); - CORE_ADDR pc; - VEC (CORE_ADDR) *next_pcs = NULL; + CORE_ADDR pc, next_pc; + VEC (CORE_ADDR) *next_pcs; pc = regcache_read_pc (regcache); + next_pcs = alpha_deal_with_atomic_sequence (gdbarch, pc); + if (next_pcs != NULL) + return next_pcs; + + next_pc = alpha_next_pc (regcache, pc); - VEC_safe_push (CORE_ADDR, next_pcs, alpha_next_pc (regcache, pc)); + VEC_safe_push (CORE_ADDR, next_pcs, next_pc); return next_pcs; } @@ -1826,7 +1829,7 @@ set_gdbarch_cannot_step_breakpoint (gdbarch, 1); /* Handles single stepping of atomic sequences. */ - set_gdbarch_software_single_step (gdbarch, alpha_deal_with_atomic_sequence); + set_gdbarch_software_single_step (gdbarch, alpha_software_single_step); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch);