[PATCHv2 4/9] bfd/riscv: prepare to handle bare metal core dump creation
Jim Wilson
jimw@sifive.com
Wed Feb 10 20:57:10 GMT 2021
On Wed, Jan 20, 2021 at 12:24 PM Andrew Burgess <andrew.burgess@embecosm.com>
wrote:
> bfd/ChangeLog:
>
> * elfnn-riscv.c (riscv_write_core_note): New function.
> (elf_backend_write_core_note): Define.
>
This looks OK.
In the PRPSINFO code you are using hardwired constants in the strncpy
calls. Maybe you can compute them from macros instead to make sure that we
don't end up with problems later if type sizes change?
>
> + strncpy (data + PRPSINFO_OFFSET_PR_FNAME, va_arg (ap, const char
> *), 16);
>
Maybe the 16 can be PRPSINFO_OFFSET_PR_PID.
>
> + strncpy (data + PRPSINFO_OFFSET_PR_PSARGS, va_arg (ap, const char
> *), 80);
>
Maybe the 80 can be PRPSINFO_SIZE - PRPSINFO_OFFSET_PR_PSARGS.
it looks like you already did something similar with the memcpy call in the
PRSTATUS code so that looks OK.
Jim
More information about the Binutils
mailing list