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.


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.

I will test that and generate a revised patch.

Thanks,
David Daney


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