From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by sourceware.org (Postfix) with ESMTPS id 5BB373833011 for ; Thu, 8 Jul 2021 12:34:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BB373833011 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f45.google.com with SMTP id a13so7313735wrf.10 for ; Thu, 08 Jul 2021 05:34:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2qv2PsSn0+8ISAhrcbVdITCY7qGo8YesXHMNYvoGeQY=; b=YKqaV1D62HgakExXXz1HcMOxD6t8yAebiPxx8NCn8XIeJnzgsvpjowBcTW6ByLThHW BtpdoaK82+2F0qYONWn05zBPgxmdUEqyaA71dyx9aBbPCYxmbWKDtzeLuIQNqF1TZjR3 qi7gvJLDaprjpnyfY6dpMdPMp6W031O5vWqrgcU0ftiY1+oiyuMrh5O/WUKfOgtc0G0F X5nuc2WOhb7oOqflY/gO84y0lEGTjQg6jBtL4PJyQArNi8uqB5vB9jEuUa1feJb9uv8t BvRXyrVuA2qqtODGPIvPAy4sZeabhMJZrRjJPeU2W1uwGqIuQNAXvGeXU5Rf2TinjuUu DzBg== X-Gm-Message-State: AOAM531dJTrZfzauGmLpbt+g3hmsRsTDLtPo8scD6GpWzhatMwxbPgEy z20zFInjFB4fCqgjtRzDqi2F4abDTzII3g== X-Google-Smtp-Source: ABdhPJwVqp6bnO5xXAo1jOLqwnXJfnZQqmRmT+Zuuf62Xz25NwtaHNpcfzqGAOIyJQVBKYgg09+cKA== X-Received: by 2002:adf:dec4:: with SMTP id i4mr2978385wrn.191.1625747693874; Thu, 08 Jul 2021 05:34:53 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:46bc:d03b:7b3a:2227? ([2001:8a0:f932:6a00:46bc:d03b:7b3a:2227]) by smtp.gmail.com with ESMTPSA id 204sm1971614wma.30.2021.07.08.05.34.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jul 2021 05:34:53 -0700 (PDT) Subject: Re: [PATCH v3 2/2] gdb: Support stepping out from signal handler on riscv*-linux From: Pedro Alves To: Lancelot SIX , gdb-patches@sourceware.org References: <20210707003043.447755-1-lsix@lancelotsix.com> <20210707003043.447755-3-lsix@lancelotsix.com> <20210708114902.6zeicvsp4kunlyed@ubuntu.lan> <20210708121135.kfup4tj4ewjh55mr@ubuntu.lan> Message-ID: <494f4cab-73c9-794f-1ae0-41e1cf7018c0@palves.net> Date: Thu, 8 Jul 2021 13:34:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210708121135.kfup4tj4ewjh55mr@ubuntu.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Thu, 08 Jul 2021 12:35:02 -0000 On 2021-07-08 1:11 p.m., Lancelot SIX wrote: > On Thu, Jul 08, 2021 at 11:49:02AM +0000, Lancelot SIX via Gdb-patches wrote: >>>> @@ -3826,6 +3831,11 @@ riscv_next_pc (struct regcache *regcache, CORE_ADDR pc) >>>> if (src1 >= src2) >>>> next_pc = pc + insn.imm_signed (); >>>> } >>>> + else if (insn.opcode () == riscv_insn::ECALL) >>>> + { >>>> + if (tdep->syscall_next_pc != nullptr) >>>> + next_pc = tdep->syscall_next_pc (get_current_frame ()); >>> >>> >>> else >>> next_pc += 4; >>> >>> ? >> >> OK, I’ll change that. > > Actually, no. I was a bit fast reading your comment and thought we > where in the riscv_syscall_nexc_pc function. > > The function is currently implemented as: > > static CORE_ADDR > riscv_next_pc (struct regcache *regcache, CORE_ADDR pc) > { > struct riscv_insn insn; > CORE_ADDR next_pc > insn.decode (gdbarch, pc); > next_pc = pc + insn.length (); // <--- The default case is already handled here > > /* a bunch of ifs that can assign a new value to next_pc. */ > if (insn.opcode() == …) > next_pc = … > else if (insn.opcode() == …) > next_pc = … > […] > > return next_pc; > } > > To make it clearer, the 'next_pc = pc + insn.length ();' statement could > be the one to go in a final “catchall” else where you proposed to add > the '+= 4' (note that when using the compressed instruction set, > instructions can have a size of 2 bytes). Ah, OK, sorry, I should have looked at the code instead of assuming. Thanks for double checking.