55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
From 8dfc228b29aebba2a9bc59944490aae697f79461 Mon Sep 17 00:00:00 2001
|
|
From: John Pittman <jpittman@redhat.com>
|
|
Date: Fri, 26 Mar 2021 12:56:15 -0400
|
|
Subject: [PATCH 11/11] symbols: fix offset print for function pointers that
|
|
return pointers
|
|
|
|
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,
|
|
for example:
|
|
|
|
crash> struct -o offload_callbacks
|
|
struct offload_callbacks {
|
|
struct sk_buff *(*gso_segment)(struct sk_buff *, netdev_features_t);
|
|
struct sk_buff **(*gro_receive)(struct sk_buff **, struct sk_buff *);
|
|
[16] int (*gro_complete)(struct sk_buff *, int);
|
|
}
|
|
|
|
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.
|
|
|
|
[ kh: added the example output above ]
|
|
|
|
Signed-off-by: John Pittman <jpittman@redhat.com>
|
|
---
|
|
symbols.c | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/symbols.c b/symbols.c
|
|
index a2d5c6c6178f..5d7da6e954bc 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.29.2
|
|
|