]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
nat/linux-ptrace.c: add missing gdb_byte* cast
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 18 Jun 2017 21:28:56 +0000 (23:28 +0200)
committerSimon Marchi <simon.marchi@ericsson.com>
Sun, 18 Jun 2017 21:29:03 +0000 (23:29 +0200)
On noMMU platforms, the following code gets compiled:

  child_stack = xmalloc (STACK_SIZE * 4);

Where child_stack is a gdb_byte*, and xmalloc() returns a void*. While
the lack of cast is valid in C, it is not in C++, causing the
following build failure:

../nat/linux-ptrace.c: In function 'int linux_fork_to_function(gdb_byte*, int (*)(void*))':
../nat/linux-ptrace.c:273:29: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive]
       child_stack = xmalloc (STACK_SIZE * 4);

Therefore, this commit adds the appropriate cast.

gdb/ChangeLog:

* nat/linux-ptrace.c (linux_fork_to_function): Add cast to
gdb_byte*.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
gdb/ChangeLog
gdb/nat/linux-ptrace.c

index 85ee3cfc0fac2c8849cd41b927901a263ef7b697..1bbcb711b0be9f3e3e0e9b8c93603deb5859e498 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-18  Thomas Petazzoni  <thomas.petazzoni@free-electrons.com>
+
+       * nat/linux-ptrace.c (linux_fork_to_function): Add cast to
+       gdb_byte*.
+
 2017-06-17  Simon Marchi  <simon.marchi@ericsson.com>
 
        * nat/fork-inferior.h (trace_start_error): Add ATTRIBUTE_PRINTF.
index 3265b160749b3b635676b423ec1298a26627d78f..438177fa76220a7d61654a0711157f883cf5c388 100644 (file)
@@ -272,7 +272,7 @@ linux_fork_to_function (gdb_byte *child_stack, int (*function) (void *))
 #define STACK_SIZE 4096
 
     if (child_stack == NULL)
-      child_stack = xmalloc (STACK_SIZE * 4);
+      child_stack = (gdb_byte *) xmalloc (STACK_SIZE * 4);
 
     /* Use CLONE_VM instead of fork, to support uClinux (no MMU).  */
 #ifdef __ia64__