[Crash-utility] [PATCH] symbol: fix offset print for function pointers that return pointers

John Pittman jpittman at redhat.com
Fri Mar 26 16:56:15 UTC 2021


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>
---
 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