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] nat/linux-ptrace.c: add missing gdb_byte* cast


On 2017-06-18 23:18, Thomas Petazzoni wrote:
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): fix cast to
          gdb_byte*, needed for C++ build.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thanks for the patch! I pushed it with minor changes (formatting & ChangeLog).

Simon


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