[PATCH] makedumpfile/eppic: Properly resolve structure members

Aravinda Prasad aravinda at linux.vnet.ibm.com
Thu Feb 27 01:02:20 EST 2014


makedumpfile/eppic was not able to resolve member of the
structure in cases such as:

struct abc
{
	...
	...
	struct xyz
	...
}

and eppic script:

sample()
{
	struct abc *a;
	struct xyz *x;

	x->member;
}

would fail to resolve "member" of structure xyz. However
it works if "struct abc *a;" line is removed from eppic
script. This patch fixes this issue.

Signed-off-by: Aravinda Prasad <aravinda at linux.vnet.ibm.com>
---
 dwarf_info.c      |    2 +-
 extension_eppic.c |   17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dwarf_info.c b/dwarf_info.c
index c5752c9..b7012b2 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -1468,7 +1468,7 @@ get_die_attr_type(unsigned long long die_off, int *type_flag,
 {
 	Dwarf_Die result;
 
-	if (!die_attr_off)
+	if (!die_attr_off || !die_off)
 		return FALSE;
 
 	if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
diff --git a/extension_eppic.c b/extension_eppic.c
index 7e045c9..20d996d 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -24,6 +24,8 @@
 #include "makedumpfile.h"
 #include "extension_eppic.h"
 
+static int apigetctype(int, char *, type_t *);
+
 /*
  * Most of the functions included in this file performs similar
  * functionality as in the applications/crash/eppic.c file part of
@@ -183,7 +185,15 @@ drilldown(ull offset, type_t *t)
 			goto label;
 		case DW_TAG_structure_type:
 			eppic_type_mkstruct(t);
-			goto label;
+label:
+			eppic_type_setsize(t, GET_DIE_LENGTH(t_die_off, TRUE));
+			eppic_type_setidx(t, (ull)t_die_off);
+			tstr = GET_DIE_NAME(t_die_off);
+			/* Drill down further */
+			if (tstr)
+				apigetctype(V_STRUCT, tstr, t);
+			die_off = 0;
+			break;
 		/* Unknown TAG ? */
 		default:
 			die_off = t_die_off;
@@ -191,11 +201,6 @@ drilldown(ull offset, type_t *t)
 		}
 	}
 
-label:
-	eppic_type_setsize(t, GET_DIE_LENGTH(t_die_off, TRUE));
-	eppic_type_setidx(t, (ull)t_die_off);
-	tstr = GET_DIE_NAME(t_die_off);
-
 out:
 	eppic_setupidx(t, ref, nidx, idxlst);
 	if (fctflg)




More information about the kexec mailing list