[PATCH] arc: Add support for Linux coredump files
Shahab Vahedi
shahab.vahedi@gmail.com
Thu Oct 1 13:30:42 GMT 2020
Hi Simon,
On Wed, Sep 16, 2020 at 04:21:43PM -0400, Simon Marchi wrote:
> On 2020-08-27 7:27 a.m., Shahab Vahedi via Gdb-patches wrote:
> > +void
> > +arc_linux_supply_gregset (const struct regset *regset,
> > + struct regcache *regcache,
> > + int regnum, const void *gregs, size_t size)
> > +{
> > + gdb_static_assert (ARC_LAST_REGNUM
> > + <= ARRAY_SIZE (arc_linux_core_reg_offsets));
>
> Can you explain why this is <= and not < ? I'm not saying it's wrong,
> but it looks unusual. If ARC_LAST_REGNUM was 2 (meaning there are 3
> registers: 0, 1 and 2), then having an offsets array with size 2 would
> be bad, would it? Or maybe I'm just confused.
You're absolutely right! Not only this question made me fix the assert
here, but also to revisit it everywhere. In the end, it resulted in
finding a "for loop" that was not looping the whole data set. All have
been mentioned/fixed in the next patch v2 [1].
[1] [PATCH v2] arc: Add support for Linux coredump files
https://sourceware.org/pipermail/gdb-patches/2020-September/172199.html
Cheers,
Shahab
More information about the Gdb-patches
mailing list