[PATCH]: gcore extension, anonymous union in inode struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Crash people,

The gcore extension fails on the 3.4 kernel I'm using. It attempts to
find the offset of a member within the inode struct, but the member is
part of an anonymous union. This patch fixes the problem for me.

Regards,
Per
diff --git a/gcore.c b/gcore.c
index 6b89f18..67f1832 100644
--- a/gcore.c
+++ b/gcore.c
@@ -349,6 +349,8 @@ static void gcore_offset_table_init(void)
 	GCORE_MEMBER_OFFSET_INIT(desc_struct_base2, "desc_struct", "base2");
 	GCORE_MEMBER_OFFSET_INIT(fpu_state, "fpu", "state");
 	GCORE_MEMBER_OFFSET_INIT(inode_i_nlink, "inode", "i_nlink");
+	if (GCORE_INVALID_MEMBER(inode_i_nlink))
+		GCORE_ANON_MEMBER_OFFSET_INIT(inode_i_nlink, "inode", "i_nlink");
 	GCORE_MEMBER_OFFSET_INIT(nsproxy_pid_ns, "nsproxy", "pid_ns");
 	GCORE_MEMBER_OFFSET_INIT(mm_struct_arg_start, "mm_struct", "arg_start");
 	GCORE_MEMBER_OFFSET_INIT(mm_struct_arg_end, "mm_struct", "arg_end");
diff --git a/libgcore/gcore_defs.h b/libgcore/gcore_defs.h
index 9341984..1757541 100644
--- a/libgcore/gcore_defs.h
+++ b/libgcore/gcore_defs.h
@@ -938,6 +938,12 @@ struct gcore_size_table
 #define GCORE_MEMBER_SIZE_INIT(X, Y, Z) (GCORE_ASSIGN_SIZE(X) = MEMBER_SIZE(Y, Z))
 #define GCORE_STRUCT_SIZE_INIT(X, Y) (GCORE_ASSIGN_SIZE(X) = STRUCT_SIZE(Y))
 
+#define GCORE_INVALID_MEMBER(X)  (gcore_offset_table.X == INVALID_OFFSET)
+
+#define GCORE_ANON_MEMBER_OFFSET_REQUEST ((struct datatype_member *)(-2))
+#define GCORE_ANON_MEMBER_OFFSET(X,Y)    datatype_info((X), (Y), GCORE_ANON_MEMBER_OFFSET_REQUEST)
+#define GCORE_ANON_MEMBER_OFFSET_INIT(X, Y, Z) (GCORE_ASSIGN_OFFSET(X) = ANON_MEMBER_OFFSET(Y, Z))
+
 extern struct gcore_offset_table gcore_offset_table;
 extern struct gcore_size_table gcore_size_table;
 
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux