Re: [PATCH] Make target_read_alloc & al return vectors

Simon Marchi
2018-07-16T18:02:45Z

On 2018-07-07 11:10 AM, Simon Marchi wrote:
> On 2018-07-07 04:54 AM, Andreas Schwab wrote:
>> ../../gdb/ia64-tdep.c: In function ‘LONGEST getunwind_table(gdb_byte**)’:
>> ../../gdb/ia64-tdep.c:2664:16: error: too many arguments to function ‘gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > target_read_alloc(target_ops*, target_object, const char*)’
>> NULL, buf_p);
>> ^
>> In file included from ../../gdb/inferior.h:41:0,
>> from ../../gdb/ia64-tdep.c:21:
>> ../../gdb/target.h:341:40: note: declared here
>> extern gdb::optional<gdb::byte_vector> target_read_alloc
>> ^
>> ../../gdb/ia64-tdep.c:2663:5: error: cannot convert ‘gdb::optional<std::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >’ to ‘LONGEST {aka long int}’ in assignment
>> x = target_read_alloc (current_top_target (), TARGET_OBJECT_UNWIND_TABLE,
>> ^
>>
>> Andreas.
>>
>
> Hi Andreas,
>
> I have been unable to build libunwind for ia64 before (using the 1.2
> branch), that's why I missed it. Now I tried to build the 1.1 and it
> works fine.
>
> I fixed up the call to target_read_alloc to the best of my knowledge,
> with as little changes to the code as possible. However, I can't test
> the result more than build it. Can you please review the patch below?
>
> Just to confirm, do you also see errors later in the build, like:
>
> In file included from /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:39:
> /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
> static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
> ^~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
> #define STRINGIFY_1(x) #x
> ^
> ?
>
> ----
>
> From efd663c4d54b64f394d51faabc74f249d0bf32a7 Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Date: Sat, 7 Jul 2018 10:55:14 -0400
> Subject: [PATCH] Fix compilation error in ia64-tdep.c with libunwind-ia64
>
> Commit
>
> 9018be22e022 ("Make target_read_alloc & al return vectors")
>
> failed to update the code in ia64-tdep.c, for HAVE_LIBUNWIND_IA64_H.
> This patch fixes that.

I pushed this patch.

Simon