From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13022 invoked by alias); 12 Feb 2011 22:32:40 -0000 Received: (qmail 13005 invoked by uid 22791); 12 Feb 2011 22:32:39 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 12 Feb 2011 22:32:34 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id p1CMTsWt006081; Sat, 12 Feb 2011 23:29:54 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id p1CMTqvN031897; Sat, 12 Feb 2011 23:29:52 +0100 (CET) Date: Sat, 12 Feb 2011 22:32:00 -0000 Message-Id: <201102122229.p1CMTqvN031897@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: ddaney@caviumnetworks.com CC: froydnj@codesourcery.com, gdb-patches@sourceware.org In-reply-to: <4D3DC1CC.6020906@caviumnetworks.com> (message from David Daney on Mon, 24 Jan 2011 10:15:40 -0800) Subject: Re: [Patch] Add mips*-linux* catch syscall support. References: <4D39E2DC.6060907@caviumnetworks.com> <20110122150559.GY6247@codesourcery.com> <4D3DC1CC.6020906@caviumnetworks.com> 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 X-SW-Source: 2011-02/txt/msg00240.txt.bz2 > Date: Mon, 24 Jan 2011 10:15:40 -0800 > From: David Daney > > On 01/22/2011 07:06 AM, Nathan Froyd wrote: > > On Fri, Jan 21, 2011 at 11:47:40AM -0800, David Daney wrote: > >> Index: gdb/mips-linux-tdep.c > >> =================================================================== > >> @@ -1206,6 +1207,40 @@ mips_linux_syscall_next_pc (struct frame > >> > >> return pc + 4; > >> } > >> +/* Return the current system call's number present in the > >> + v0 register. When the function fails, it returns -1. */ > >> +static LONGEST > >> +mips_linux_get_syscall_number (struct gdbarch *gdbarch, > >> + ptid_t ptid) > >> +{ > >> + buf = (gdb_byte *) xmalloc (regsize * sizeof (gdb_byte)); > > > > Why not just use alloca or XALLOCAVEC here? > > > > Because I copied the code from PPC, and that is what was done there. > > Since we know that the maximum size is 8 bytes, I could just allocate a > fixed size array on the stack. That would simplify things quite a bit. That's typically what I do for code that supports both 32-bit and 64-bit registers in the GDB targets I (sort of) maintain (i386/amd64, sparc/sparc64).