[v4,12/14] add linux_infcall_mmap

Message ID 87egs1t44k.fsf@codesourcery.com
State New, archived
Headers

Commit Message

Yao Qi Dec. 15, 2014, 1:49 p.m. UTC
  Ulrich Weigand <uweigand@de.ibm.com> writes:

> /home/uweigand/dailybuild/spu-tc-2014-12-13/binutils-gdb-head/binutils-gdb/gdb/linux-tdep.c:
> In function 'linux_infcall_mmap':
> /home/uweigand/dailybuild/spu-tc-2014-12-13/binutils-gdb-head/binutils-gdb/gdb/linux-tdep.c:1945:
> error: expected identifier before numeric constant
>
> on my RHEL 5 build system, presumably because ARG_MAX is defined 
> (to a numeric constant) by a system header.
>
> Can we give those more distinctive names?

I got the same problem.  Patch below unblocks the build.
  

Comments

Jan Kratochvil Dec. 15, 2014, 4:47 p.m. UTC | #1
On Mon, 15 Dec 2014 14:49:15 +0100, Yao Qi wrote:
> I got the same problem.  Patch below unblocks the build.

I am sure fine with this patch.


Thanks,
Jan
  
Yao Qi Dec. 16, 2014, 5:26 a.m. UTC | #2
Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> I am sure fine with this patch.

Patch is pushed in.
  

Patch

diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 485f5ca..6b5e475 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1942,9 +1942,9 @@  linux_infcall_mmap (CORE_ADDR size, unsigned prot)
   CORE_ADDR retval;
   enum
     {
-      ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, ARG_MAX
+      ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, ARG_LAST
     };
-  struct value *arg[ARG_MAX];
+  struct value *arg[ARG_LAST];
 
   arg[ARG_ADDR] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr,
 				      0);
@@ -1961,7 +1961,7 @@  linux_infcall_mmap (CORE_ADDR size, unsigned prot)
   arg[ARG_FD] = value_from_longest (builtin_type (gdbarch)->builtin_int, -1);
   arg[ARG_OFFSET] = value_from_longest (builtin_type (gdbarch)->builtin_int64,
 					0);
-  addr_val = call_function_by_hand (mmap_val, ARG_MAX, arg);
+  addr_val = call_function_by_hand (mmap_val, ARG_LAST, arg);
   retval = value_as_address (addr_val);
   if (retval == (CORE_ADDR) -1)
     error (_("Failed inferior mmap call for %s bytes, errno is changed."),