From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47505 invoked by alias); 3 Aug 2015 18:23:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 47492 invoked by uid 89); 3 Aug 2015 18:23:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Aug 2015 18:23:33 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1ZMKOY-0001Ze-HZ from Sandra_Loosemore@mentor.com ; Mon, 03 Aug 2015 11:23:30 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Mon, 3 Aug 2015 11:23:30 -0700 Message-ID: <55BFB12D.9010105@codesourcery.com> Date: Mon, 03 Aug 2015 18:23:00 -0000 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Yao Qi CC: Subject: Re: [patch, nios2] Nios II R2 support for GDB References: <55B91CAD.8030306@codesourcery.com> <86egjkeal0.fsf@gmail.com> In-Reply-To: <86egjkeal0.fsf@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-08/txt/msg00046.txt.bz2 On 08/03/2015 08:00 AM, Yao Qi wrote: > Sandra Loosemore writes: > > Hi Sandra, > The patch looks good to me. Some comments below... Thanks for the review! You have sharp eyes to pick up those extra trailing whitespace problems. >> static CORE_ADDR >> -nios2_linux_syscall_next_pc (struct frame_info *frame) >> +nios2_linux_syscall_next_pc (struct frame_info *frame, >> + const struct nios2_opcode *op) >> { >> CORE_ADDR pc = get_frame_pc (frame); >> ULONGEST syscall_nr = get_frame_register_unsigned (frame, NIOS2_R2_REGNUM); >> @@ -182,7 +200,7 @@ nios2_linux_syscall_next_pc (struct frame_info *frame) >> if (syscall_nr == 139 /* rt_sigreturn */) >> return frame_unwind_caller_pc (frame); >> >> - return pc + NIOS2_OPCODE_SIZE; >> + return pc + op->size; > > Nit: Can we get the size of opcode without OP here? We can get the > gdbarch of FRAME by frame_unwind_arch, we can tell it is R1 or R2, and > get to know the size of the instruction? The arch alone is not enough to set the size of the break instruction; R2 has both 16-bit and 32-bit variants. I suppose it might be that the future R2 Linux support will be implemented in such a way as to always use the 32-bit variant, but in the general case for R2 you have to disassemble an instruction to find out how long it is. And the only caller of this hook has just done that already and put the result in the OP parameter; it seems better not to duplicate that code in another file when the information is already right there. -Sandra