Re: [patch] Fix crash on NULL function's TYPE_FIELD_TYPE

Jan Kratochvil
2010-03-31T18:14:49Z

On Tue, 30 Mar 2010 19:00:34 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> 2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
> Jan> Fix crash on reading wrong function declaration DWARF.
> Jan> * dwarf2read.c (read_subroutine_type): New variable void_type.
> Jan> Pre-fill all TYPE_FIELD_TYPEs. Move nparams and iparams initialization
> Jan> more close to their use.
>
> Jan> 2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
> Jan> * gdb.dwarf2/dw2-bad-parameter-type.exp,
> Jan> gdb.dwarf2/dw2-bad-parameter-type.S: New.
[..]
> This is ok.

Checked in:
http://sourceware.org/ml/gdb-cvs/2010-03/msg00302.html

> I'm not super happy about this change, since it seems so ad hoc. Is it
> really only the field type that must be set? Or are there other things
> as well? But at the same time it is hard to see what else we could do.

This function read_subroutine_type really only sets TYPE_FIELD_TYPE.

It also determines the boolean TYPE_FIELD_ARTIFICIAL but it is apparent it can
be set either way and nobody cares much after reading debug info has errored
out.

I understand calling error during debug info reading is very fragile operation
but whether there are / are not bugs in other code regarding such error
recovery / cleanup is outside of the scope of this patch as it can equally
affect also other read_*_type functions IMO.

Thanks,
Jan