Re: [PATCH] gdb: use std::vector instead of alloca in core_target::get_core_register_section

Simon Marchi
2020-01-13T23:13:30Z

On 2020-01-13 5:04 p.m., Pedro Alves wrote:
> On 1/13/20 8:02 PM, Simon Marchi wrote:
>> On 2020-01-13 2:40 p.m., Pedro Alves wrote:
>>> On 1/12/20 8:17 PM, Simon Marchi wrote:
>>>> - contents = (char *) alloca (size);
>>>> - if (! bfd_get_section_contents (core_bfd, section, contents,
>>>> + std::vector<char> contents (size);
>>>> + if (! bfd_get_section_contents (core_bfd, section, contents.data (),
>>>> (file_ptr) 0, size))
>>>> {
>>>
>>> gdb::byte_vector
>>
>> I used std::vector<char> because the original code also used char, and
>> m_core_vec->core_read_registers also accepts a char * (although I
>> could/should have used gdb::char_vector anyway). However, gdb_byte
>> probably makes more sense here. I would push the patch below as a fixup
>> if it looks good to you.
>
> It does LGTM, thanks!
>
> Pedro Alves
>

Thanks, it is now pushed.

Simon