Re: [committed] Fix gcore crashes on s390

Mark Kettenis
2006-05-06T08:26:02Z

> Date: Fri, 05 May 2006 18:32:05 -0700 (PDT)
> From: "David S. Miller" <davem@davemloft.net>
>
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> Date: Sat, 6 May 2006 03:18:51 +0200 (CEST)
>
> > since the switch of gcore to use regset_from_core_section, it
> > crashes on s390, because the regsets we're providing have a
> > NULL collect_regset function. Fixed by the patch below.
> >
> > Tested on s390-ibm-linux and s390x-ibm-linux.
> > Committed to mainline.
>
> Thanks for catching and fixing this.
>
> Hmmm... is this a common omission?

Yes, targets are allowed to not implement the collect_regset functions
if they only implement reading core dumps and don't need it for
something else (like writing core dumps with gcore or fiddling with
threads). All Linux targets now fall in the second category, but some
probably think they fall in the first. So either we should:

1. Deal gracefully with the collect_regset function pointer being
NULL.

2. Put in a gdb_assert() to check it's not null before it's used.

I'm thinking that we should try option #2 for a while to get people to
implement the functions for the other Linux targets too, just like
Ulrich did for s390.

Mark