On Thu, Jan 13, 2022 at 1:22 PM Peter Maydell <peter.maydell@linaro.org> wrote:
On Sun, 9 Jan 2022 at 16:48, Warner Losh <imp@bsdimp.com> wrote:
>
> Returns 1 for signals that cause core files.
>
> Signed-off-by: Stacey Son <sson@FreeBSD.org>
> Signed-off-by: Kyle Evans <kevans@freebsd.org>
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>  bsd-user/signal.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> index a6e07277fb2..824535be8b8 100644
> --- a/bsd-user/signal.c
> +++ b/bsd-user/signal.c
> @@ -92,6 +92,23 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
>      }
>  }
>
> +/* Returns 1 if given signal should dump core if not handled. */
> +static int core_dump_signal(int sig)
> +{
> +    switch (sig) {
> +    case TARGET_SIGABRT:
> +    case TARGET_SIGFPE:
> +    case TARGET_SIGILL:
> +    case TARGET_SIGQUIT:
> +    case TARGET_SIGSEGV:
> +    case TARGET_SIGTRAP:
> +    case TARGET_SIGBUS:
> +        return 1;
> +    default:
> +        return 0;
> +    }
> +}

Code is fine, but since this is a static function with no callers
the compiler is going to emit a warning about that. It's a small
function, so the easiest thing is just to squash this into the
following patch which is what adds the code that calls it.

Sure thing. I'm still trying to get a feel for right-sizing the chunking...
Since the warning didn't fail the compile, I thought it would be OK,
but can easily fold this in with the first patch to use it.

Warner