[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Error out on DW_AT_location with invalid encoding
On Thu, 2019-03-07 at 09:59 +0100, Tom de Vries wrote:
> On 07-03-19 09:27, Jakub Jelinek wrote:
> > Is it worth bothering with that then? Shouldn't just gdb be fixed?
> > Or is it intentional that the test tests how it deals with invalid DWARF?
> >
>
> I'm not sure if the test-case should be fixed. Gdb testcases are known
> to contain invalid dwarf, although indeed in this case the test-case is
> just to test handling of DW_TAG_restrict_type, not invalid dwarf.
>
> > I mean, dwz has over hundred asserts and many of them will fail if fed
> > complete garbage. Do we want to turn them all into errors?
>
> I'd propose we just fix the ones that show up with gdb testsuite (which
> are just a couple), because it's a known way to test dwz.
Jakub is right that there are a lot of asserts in the code (128 at the
moment). But I do think it makes sense to clean them all up eventually.
Keep asserts just for internal data invariants but turn anything that
checks ELF/DWARF input into a normal error check. Unfortunately there
will always be bad DWARF out there, intentionally or by accident. An
assert is a terrible way to report an error when dwz is used in some
toolchain to process all files IMHO.
Cheers,
Mark