From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 84BA23858D35 for ; Tue, 2 Nov 2021 16:26:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 84BA23858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A60B61EDDB; Tue, 2 Nov 2021 12:26:22 -0400 (EDT) Subject: Re: [PATCH][gdb/tdep, rs6000] Don't skip system call in skip_prologue To: Tom de Vries , gdb-patches@sourceware.org Cc: Ulrich Weigand References: <20211102113302.GA7990@delia.home> From: Simon Marchi Message-ID: <79e1d5a7-1f41-9bb4-85b2-433c282a8254@simark.ca> Date: Tue, 2 Nov 2021 12:26:22 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211102113302.GA7990@delia.home> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2021 16:26:25 -0000 On 2021-11-02 7:33 a.m., Tom de Vries via Gdb-patches wrote: > Hi, > > I ran into a case where a breakpoint on _exit never triggered, because it was > set past the end of the _exit prologue, past the end of the exit_group system > call (which does not return). > > Fix this by treating system calls the same as branches in skip_prologue: > by default, don't skip. > > Tested on ppc64le-linux, on a power 8 machine. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527 > > Any comments? > > Thanks, > - Tom > > [gdb/tdep, rs6000] Don't skip system call in skip_prologue > > --- > gdb/rs6000-tdep.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c > index 78b4fd1a913..4830ed22593 100644 > --- a/gdb/rs6000-tdep.c > +++ b/gdb/rs6000-tdep.c > @@ -2137,6 +2137,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, > /* Never skip branches. */ > break; > > + /* Test based on opcode and mask values of > + powerpc_opcodes[svc..svcla] in opcodes/ppc-opc.c. */ > + if ((op & 0xffff0000) == 0x44000000) > + /* Never skip system calls. */ > + break; > + > if (num_skip_non_prologue_insns++ > max_skip_non_prologue_insns) > /* Do not scan too many insns, scanning insns is expensive with > remote targets. */ > The explanation makes sense, but I think a powerpc maintainer should ack the patch. And I think it would be useful to paste the "disassembly /r" of the _exit function in the commit message, showing where the breakpoint used to be placed, and where it is placed now. Simon