corefile.c: fix -Wpointer-sign
authorPedro Alves <palves@redhat.com>
Thu, 7 Mar 2013 23:36:01 +0000 (23:36 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 7 Mar 2013 23:36:01 +0000 (23:36 +0000)
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" corefile.o -k 2>&1 1>/dev/null
../../src/gdb/corefile.c: In function ‘read_memory_string’:
../../src/gdb/corefile.c:334:7: error: pointer targets in passing argument 2 of ‘read_memory’ differ in signedness [-Werror=pointer-sign]
../../src/gdb/corefile.c:217:1: note: expected ‘gdb_byte *’ but argument is of type ‘char *’

Functions that take or return ascii-ish string arguments usually use
char* for parameters/return.  That means that at points we call into
target methods that work with binary blobs, we need casts to
gdb_byte*.

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

* corefile.c (read_memory_string): Cast pointer to gdb_byte* in
call.

gdb/ChangeLog
gdb/corefile.c

index 87ffb54a42f176c6262aa44a52bcc11714ef9218..29203fe3ff7978c53eda4d241a4c54a9cbbdc03b 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-07  Pedro Alves  <palves@redhat.com>
+
+       * corefile.c (read_memory_string): Cast pointer to gdb_byte* in
+       call.
+
 2013-03-07  Keith Seitz  <keiths@redhat.com>
 
        * breakpoint.c (catch_syscall_split_args): Use skip_spaces.
index b268d4cbc05b5fffa94d9a23d824f935e68f3fe3..9c795b855808c873b99026315c4f4024cd15016e 100644 (file)
@@ -331,7 +331,7 @@ read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
       cnt = max_len - (cp - buffer);
       if (cnt > 8)
        cnt = 8;
-      read_memory (memaddr + (int) (cp - buffer), cp, cnt);
+      read_memory (memaddr + (int) (cp - buffer), (gdb_byte *) cp, cnt);
       for (i = 0; i < cnt && *cp; i++, cp++)
        ;                       /* null body */
 
This page took 0.025958 seconds and 4 git commands to generate.