This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Add mips*-linux* catch syscall support.


> Date: Mon, 24 Jan 2011 10:15:40 -0800
> From: David Daney <ddaney@caviumnetworks.com>
> 
> 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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]