Skip to contentSkip to conversation

makedumpfile/eppic: Properly resolve structure members

PATCH In review Aravinda Prasad 2 participants 2 messages Feb 27, 2014 – Mar 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 makedumpfile/eppic: Properly resolve structure members

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.

---
 dwarf_info.c      |    2 +-
 extension_eppic.c |   17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)
dwarf_info.c +1 -1
index c5752c9..b7012b2 100644
@@ -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)) {
extension_eppic.c +11 -6
index 7e045c9..20d996d 100644
@@ -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)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 21 lines

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;
}
Quoted 5 lines

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.

Thanks, I'll merge this patch into makedumpfile-1.5.6.

Atsushi Kumagai

Quoted 58 lines

---
dwarf_info.c | 2 +-
extension_eppic.c | 17 +++++++++++------

2 files changed, 12 insertions(+), 7 deletions(-)
dwarf_info.c +1 -1
index c5752c9..b7012b2 100644
@@ -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)) {
extension_eppic.c +11 -6
index 7e045c9..20d996d 100644
@@ -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:

Quoted 2 lines
	eppic_setupidx(t, ref, nidx, idxlst);
	if (fctflg)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec