linux-record.c:record_linux_system_call: fix -Wpointer-sign
authorPedro Alves <palves@redhat.com>
Thu, 7 Mar 2013 18:29:05 +0000 (18:29 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 7 Mar 2013 18:29:05 +0000 (18:29 +0000)
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" linux-record.o 2>&1 1>/dev/null
...
../../src/gdb/linux-record.c: In function ‘record_linux_system_call’:
../../src/gdb/linux-record.c:1152:9: error: pointer targets in passing argument 3 of ‘regcache_raw_read_signed’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/linux-record.c:23:0:
../../src/gdb/regcache.h:76:3: note: expected ‘long int *’ but argument is of type ‘long unsigned int *’
../../src/gdb/linux-record.c:1186:13: error: pointer targets in passing argument 3 of ‘regcache_raw_read_signed’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/linux-record.c:23:0:
../../src/gdb/regcache.h:76:3: note: expected ‘long int *’ but argument is of type ‘long unsigned int *’

I believe the read_signed calls are correct, and the variables are in
the wrong.

Tested on x86_64 Fedora 17.

gdb/
2013-03-07  Pedro Alves  <palves@redhat.com>

* linux-record.c (record_linux_system_call) <gdb_sys_msgrcv,
RECORD_MSGRCV>: Pass a signed variable to
regcache_raw_read_signed, instead of an unsigned one.

gdb/ChangeLog
gdb/linux-record.c

index 59225c4a6fa73d853ed0ff0a573f9db8982df069..3b78b087ee65e10036348e116fc7d59579420696 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-07  Pedro Alves  <palves@redhat.com>
+
+       * linux-record.c (record_linux_system_call) <gdb_sys_msgrcv,
+       RECORD_MSGRCV>: Pass a signed variable to
+       regcache_raw_read_signed, instead of an unsigned one.
+
 2013-03-07  Pedro Alves  <palves@redhat.com>
 
        * remote-notif.c (notif_debug): Change type to int.
index 5a9ec99a87c718775dda41dce6e98fc3ae234d8d..c7697000b833a5cd63893303a82d0f43f27ada83 100644 (file)
@@ -1148,10 +1148,11 @@ Do you want to stop the program?"),
     case gdb_sys_msgrcv:
       {
         ULONGEST msgp;
+        LONGEST l;
 
-        regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest);
+        regcache_raw_read_signed (regcache, tdep->arg3, &l);
         regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
-        tmpint = (int) tmpulongest + tdep->size_long;
+        tmpint = l + tdep->size_long;
         if (record_arch_list_add_mem ((CORE_ADDR) msgp, tmpint))
           return -1;
       }
@@ -1180,7 +1181,7 @@ Do you want to stop the program?"),
           break;
         case RECORD_MSGRCV:
           {
-            ULONGEST second;
+            LONGEST second;
             ULONGEST ptr;
 
             regcache_raw_read_signed (regcache, tdep->arg3, &second);
This page took 0.028643 seconds and 4 git commands to generate.