[Crash-utility] [PATCH] symbol: fix offset print for function pointers that return pointers
HAGIO KAZUHITO(萩尾 一仁)
k-hagio-ab at nec.com
Fri Apr 2 07:02:54 UTC 2021
-----Original Message-----
> In the show_member_offset() function, when trying to handle function
> pointers, the case for "(*" is handled. However, if the function
> pointer returns a pointer or a pointer to a pointer, then the
> condition is unhandled. This results in the offset not being printed.
>
> Fix by first checking if the member is potentially a function pointer,
> then checking if it returns a pointer or a pointer to a pointer.
>
> Signed-off-by: John Pittman <jpittman at redhat.com>
Good catch... I've confirmed that the patch works as expected with RHEL7's
struct offload_callbacks:
crash> struct -o offload_callbacks
struct offload_callbacks {
[0] struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
[8] struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
[16] int (*gro_complete)(struct sk_buff *, int);
}
SIZE: 24
Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>
Thanks,
Kazu
> ---
> symbols.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/symbols.c b/symbols.c
> index a2d5c6c..5d7da6e 100644
> --- a/symbols.c
> +++ b/symbols.c
> @@ -8356,8 +8356,15 @@ show_member_offset(FILE *ofp, struct datatype_member *dm, char *inbuf)
> }
> } else if (c) {
> for (i = 0; i < c; i++) {
> - if (STRNEQ(arglist[i], "(*")) {
> - target = arglist[i]+2;
> + if (strstr(inbuf, "(*")) {
> + if (STRNEQ(arglist[i], "(*"))
> + target = arglist[i]+2;
> + else if (STRNEQ(arglist[i], "*(*"))
> + target = arglist[i]+3;
> + else if (STRNEQ(arglist[i], "**(*"))
> + target = arglist[i]+4;
> + else
> + continue;
> if (!(t1 = strstr(target, ")")))
> continue;
> *t1 = NULLCHAR;
> --
> 2.17.2
More information about the Crash-utility
mailing list