* [PATCH] makedumpfile: Add support to module data structures
@ 2013-11-08 5:21 Aruna Balakrishnaiah
0 siblings, 0 replies; 5+ messages in thread
From: Aruna Balakrishnaiah @ 2013-11-08 5:21 UTC (permalink / raw)
To: kumagai-atsushi, kexec; +Cc: aravinda
Current version of makedumpfile/eppic integration patches works only for
data structures in vmlinux. This patch adds support to module data structures.
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
erase_info.c | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
erase_info.h | 10 ++-
extension_eppic.c | 11 ++--
extension_eppic.h | 4 +
4 files changed, 176 insertions(+), 12 deletions(-)
diff --git a/erase_info.c b/erase_info.c
index f8f52d6..aeda9dd 100644
--- a/erase_info.c
+++ b/erase_info.c
@@ -27,13 +27,13 @@ struct erase_info *erase_info = NULL;
unsigned long num_erase_info = 1; /* Node 0 is unused. */
struct call_back eppic_cb = {
- &get_domain,
+ &get_domain_all,
&readmem,
&get_die_attr_type,
&get_die_name,
&get_die_offset,
&get_die_length,
- &get_die_member,
+ &get_die_member_all,
&get_die_nfields,
&get_symbol_addr_all,
&update_filter_info_raw
@@ -1950,6 +1950,165 @@ get_symbol_addr_all(char *name) {
}
+/*
+ * Search for domain in modules as well as vmlinux
+ */
+long
+get_domain_all(char *symname, int cmd, unsigned long long *die) {
+
+ short vmlinux_searched = 0;
+ long size = 0;
+ unsigned int i, current_mod;
+ struct module_info *modules;
+
+ /* Search in vmlinux if debuginfo is set to vmlinux */
+ if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
+ size = get_domain(symname, cmd, die);
+ if (size > 0 && die)
+ return size;
+
+ vmlinux_searched = 1;
+ }
+
+ /*
+ * Proceed the search in modules. Try in the module
+ * which resulted in a hit in the previous search
+ */
+
+ modules = mod_st.modules;
+ current_mod = mod_st.current_mod;
+
+ if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
+ if (!set_dwarf_debuginfo(modules[current_mod].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Cannot set to current module %s\n",
+ modules[current_mod].name);
+ return NOT_FOUND_SYMBOL;
+ }
+ }
+
+ size = get_domain(symname, cmd, die);
+ if (size > 0 && die)
+ return size;
+
+ /* Search in all modules */
+ for (i = 0; i < mod_st.num_modules; i++) {
+
+ /* Already searched. Skip */
+ if (i == current_mod)
+ continue;
+
+ if (!set_dwarf_debuginfo(modules[i].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Skipping Module section %s\n", modules[i].name);
+ continue;
+ }
+
+ size = get_domain(symname, cmd, die);
+
+ if (size <= 0 || !die)
+ continue;
+
+ /*
+ * Domain found. Set the current_mod to this module index, a
+ * minor optimization for fast lookup next time
+ */
+ mod_st.current_mod = i;
+ return size;
+ }
+
+ /* Domain not found in any module. Set debuginfo back to vmlinux */
+ set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
+ info->fd_vmlinux);
+
+ if (!vmlinux_searched)
+ return get_domain(symname, cmd, die);
+ else
+ return NOT_FOUND_STRUCTURE;
+}
+
+/*
+ * Search for die member in modules as well as vmlinux
+ */
+int
+get_die_member_all(unsigned long long die_off, int index, long *offset,
+ char **name, int *nbits, int *fbits, unsigned long long *m_die)
+{
+ short vmlinux_searched = 0;
+ long size = -1;
+ unsigned int i, current_mod;
+ struct module_info *modules;
+
+ /* Search in vmlinux if debuginfo is set to vmlinux */
+ if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
+ size = get_die_member(die_off, index, offset, name,
+ nbits, fbits, m_die);
+ if (size >= 0)
+ return size;
+
+ vmlinux_searched = 1;
+ }
+
+ /*
+ * Proceed the search in modules. Try in the module
+ * which resulted in a hit in the previous search
+ */
+
+ modules = mod_st.modules;
+ current_mod = mod_st.current_mod;
+
+ if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
+ if (!set_dwarf_debuginfo(modules[current_mod].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Cannot set to current module %s\n",
+ modules[current_mod].name);
+ return NOT_FOUND_SYMBOL;
+ }
+ }
+
+ size = get_die_member(die_off, index, offset, name,
+ nbits, fbits, m_die);
+ if (size >= 0)
+ return size;
+
+ /* Search in all modules */
+ for (i = 0; i < mod_st.num_modules; i++) {
+
+ /* Already searched. Skip */
+ if (i == current_mod)
+ continue;
+
+ if (!set_dwarf_debuginfo(modules[i].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Skipping Module section %s\n", modules[i].name);
+ continue;
+ }
+
+ size = get_die_member(die_off, index, offset, name,
+ nbits, fbits, m_die);
+
+ if (size < 0)
+ continue;
+
+ /*
+ * Die member found. Set the current_mod to this module index,
+ * a minor optimization for fast lookup next time
+ */
+ mod_st.current_mod = i;
+ return size;
+ }
+
+ /* Die member not found in any module. Set debuginfo back to vmlinux */
+ set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
+ info->fd_vmlinux);
+
+ if (!vmlinux_searched)
+ return get_die_member(die_off, index, offset, name,
+ nbits, fbits, m_die);
+ else
+ return -1;
+}
+
/* Process the eppic macro using eppic library */
static int
process_eppic_file(char *name_config)
diff --git a/erase_info.h b/erase_info.h
index ae740ce..a90fac0 100644
--- a/erase_info.h
+++ b/erase_info.h
@@ -32,9 +32,12 @@ struct erase_info {
};
unsigned long long get_symbol_addr_all(char *);
+long get_domain_all(char *, int, unsigned long long *);
+int get_die_member_all(unsigned long long die_off, int index, long *offset,
+ char **name, int *nbits, int *fbits, unsigned long long *m_die);
struct call_back {
- long (*get_domain)(char *, int, unsigned long long *);
+ long (*get_domain_all)(char *, int, unsigned long long *);
int (*readmem)(int type_addr, unsigned long long addr, void *bufptr,
size_t size);
int (*get_die_attr_type)(unsigned long long die_off, int *type_flag,
@@ -42,8 +45,9 @@ struct call_back {
char * (*get_die_name)(unsigned long long die_off);
unsigned long long (*get_die_offset)(char *sysname);
int (*get_die_length)(unsigned long long die_off, int flag);
- int (*get_die_member)(unsigned long long die_off, int index, long *offset,
- char **name, int *nbits, int *fbits, unsigned long long *m_die);
+ int (*get_die_member_all)(unsigned long long die_off, int index,
+ long *offset, char **name, int *nbits, int *fbits,
+ unsigned long long *m_die);
int (*get_die_nfields)(unsigned long long die_off);
unsigned long long (*get_symbol_addr_all)(char *symname);
int (*update_filter_info_raw)(unsigned long long, int, int);
diff --git a/extension_eppic.c b/extension_eppic.c
index d5e5ad0..7e045c9 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -236,8 +236,8 @@ apimember(char *mname, ull idx, type_t *tm, member_t *m, ull *last_index)
index = 0;
while (index < nfields) {
- size = GET_DIE_MEMBER(die_off, index, &offset, &name, &nbits,
- &fbits, &m_die);
+ size = GET_DIE_MEMBER_ALL(die_off, index, &offset, &name,
+ &nbits, &fbits, &m_die);
if (size < 0)
return NULL;
@@ -272,13 +272,14 @@ apigetctype(int ctype, char *name, type_t *tout)
switch (ctype) {
case V_TYPEDEF:
- size = GET_DOMAIN(name, DWARF_INFO_GET_DOMAIN_TYPEDEF, &die);
+ size = GET_DOMAIN_ALL(name, DWARF_INFO_GET_DOMAIN_TYPEDEF,
+ &die);
break;
case V_STRUCT:
- size = GET_DOMAIN(name, DWARF_INFO_GET_DOMAIN_STRUCT, &die);
+ size = GET_DOMAIN_ALL(name, DWARF_INFO_GET_DOMAIN_STRUCT, &die);
break;
case V_UNION:
- size = GET_DOMAIN(name, DWARF_INFO_GET_DOMAIN_UNION, &die);
+ size = GET_DOMAIN_ALL(name, DWARF_INFO_GET_DOMAIN_UNION, &die);
break;
/* TODO
* Implement for all the domains
diff --git a/extension_eppic.h b/extension_eppic.h
index caa44dc..42437f2 100644
--- a/extension_eppic.h
+++ b/extension_eppic.h
@@ -81,13 +81,13 @@ do { \
struct call_back *cb;
-#define GET_DOMAIN cb->get_domain
+#define GET_DOMAIN_ALL cb->get_domain_all
#define READMEM cb->readmem
#define GET_DIE_ATTR_TYPE cb->get_die_attr_type
#define GET_DIE_NAME cb->get_die_name
#define GET_DIE_OFFSET cb->get_die_offset
#define GET_DIE_LENGTH cb->get_die_length
-#define GET_DIE_MEMBER cb->get_die_member
+#define GET_DIE_MEMBER_ALL cb->get_die_member_all
#define GET_DIE_NFIELDS cb->get_die_nfields
#define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
#define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] makedumpfile: Add support to module data structures
@ 2014-02-27 6:19 Aruna Balakrishnaiah
2014-02-28 6:51 ` Atsushi Kumagai
0 siblings, 1 reply; 5+ messages in thread
From: Aruna Balakrishnaiah @ 2014-02-27 6:19 UTC (permalink / raw)
To: kexec; +Cc: kumagai-atsushi
When trying to refer a module data structure GET_DIE_NFIELDS
does not set the dwarf_info to the right module.
For instance:
struct ap_device {
...
struct list_head list;
...
};
struct ap_device *dev;
As a result, it was able to resolve only dev->list and it was failing to
resolve dev->list.next.
The patch takes care of handling this by introducing GET_DIE_NFIELDS_ALL
which takes care of setting the dwarf_info to the appropriate module.
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
dwarf_info.c | 8 -----
erase_info.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
erase_info.h | 3 +-
extension_eppic.c | 2 +
extension_eppic.h | 2 +
5 files changed, 83 insertions(+), 12 deletions(-)
diff --git a/dwarf_info.c b/dwarf_info.c
index 6e21b8a..268e922 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -489,7 +489,6 @@ get_die_from_offset(Dwarf_Off offset, Dwarf_Die *die)
return FALSE;
if (!dwarf_offdie(dwarf_info.dwarfd, offset, die)) {
- ERRMSG("Can't find the DIE.\n");
return FALSE;
}
@@ -1343,14 +1342,12 @@ get_die_nfields(unsigned long long die_off)
Dwarf_Die result, child, *die;
if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
- ERRMSG("Can't find the DIE.\n");
return -1;
}
die = &result;
tag = dwarf_tag(die);
if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
- ERRMSG("DIE is not of structure or union type.\n");
clean_dwfl_info();
return -1;
}
@@ -1388,14 +1385,12 @@ get_die_member(unsigned long long die_off, int index, long *offset,
return -1;
if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
- ERRMSG("Can't find the DIE.\n");
return -1;
}
die = &result;
tag = dwarf_tag(die);
if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
- ERRMSG("DIE is not of structure or union type.\n");
clean_dwfl_info();
return -1;
}
@@ -1471,7 +1466,6 @@ get_die_attr_type(unsigned long long die_off, int *type_flag,
return FALSE;
if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
- ERRMSG("Can't find the DIE.\n");
return FALSE;
}
@@ -1509,7 +1503,6 @@ get_die_name(unsigned long long die_off)
return NULL;
if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
- ERRMSG("Can't find the DIE.\n");
return NULL;
}
@@ -1554,7 +1547,6 @@ get_die_length(unsigned long long die_off, int flag)
return FALSE;
if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
- ERRMSG("Can't find the DIE.\n");
return FALSE;
}
diff --git a/erase_info.c b/erase_info.c
index a789389..e0e0f71 100644
--- a/erase_info.c
+++ b/erase_info.c
@@ -34,7 +34,7 @@ struct call_back eppic_cb = {
&get_die_offset,
&get_die_length,
&get_die_member_all,
- &get_die_nfields,
+ &get_die_nfields_all,
&get_symbol_addr_all,
&update_filter_info_raw
};
@@ -2028,6 +2028,84 @@ get_domain_all(char *symname, int cmd, unsigned long long *die) {
}
/*
+ * Search for die in modules as well as vmlinux
+ */
+int
+get_die_nfields_all(unsigned long long die_off)
+{
+ short vmlinux_searched = 0;
+ long nfields = -1;
+ unsigned int i, current_mod;
+ struct module_info *modules;
+
+ /* Search in vmlinux if debuginfo is set to vmlinux */
+ if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
+ nfields = get_die_nfields(die_off);
+ if (nfields > 0)
+ return nfields;
+
+ vmlinux_searched = 1;
+ }
+
+ /*
+ * Proceed the search in modules. Try in the module
+ * which resulted in a hit in the previous search
+ */
+
+ modules = mod_st.modules;
+ current_mod = mod_st.current_mod;
+
+ if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
+ if (!set_dwarf_debuginfo(modules[current_mod].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Cannot set to current module %s\n",
+ modules[current_mod].name);
+ return -1;
+ }
+ }
+
+ nfields = get_die_nfields(die_off);
+ if (nfields > 0)
+ return nfields;
+
+ /* Search in all modules */
+ for (i = 0; i < mod_st.num_modules; i++) {
+
+ /* Already searched. Skip */
+ if (i == current_mod)
+ continue;
+
+ if (!set_dwarf_debuginfo(modules[i].name,
+ info->system_utsname.release, NULL, -1)) {
+ ERRMSG("Skipping Module section %s\n", modules[i].name);
+ continue;
+ }
+
+ nfields = get_die_nfields(die_off);
+
+ if (nfields < 0)
+ continue;
+
+ /*
+ * Die found. Set the current_mod to this module index,
+ * a minor optimization for fast lookup next time
+ */
+ mod_st.current_mod = i;
+ return nfields;
+ }
+
+ /* Die not found in any module. Set debuginfo back to vmlinux */
+ set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
+ info->fd_vmlinux);
+
+ if (!vmlinux_searched)
+ return get_die_nfields(die_off);
+ else
+ return -1;
+
+}
+
+/*
* Search for die member in modules as well as vmlinux
*/
int
diff --git a/erase_info.h b/erase_info.h
index a90fac0..4d4957e 100644
--- a/erase_info.h
+++ b/erase_info.h
@@ -35,6 +35,7 @@ unsigned long long get_symbol_addr_all(char *);
long get_domain_all(char *, int, unsigned long long *);
int get_die_member_all(unsigned long long die_off, int index, long *offset,
char **name, int *nbits, int *fbits, unsigned long long *m_die);
+int get_die_nfields_all(unsigned long long die_off);
struct call_back {
long (*get_domain_all)(char *, int, unsigned long long *);
@@ -48,7 +49,7 @@ struct call_back {
int (*get_die_member_all)(unsigned long long die_off, int index,
long *offset, char **name, int *nbits, int *fbits,
unsigned long long *m_die);
- int (*get_die_nfields)(unsigned long long die_off);
+ int (*get_die_nfields_all)(unsigned long long die_off);
unsigned long long (*get_symbol_addr_all)(char *symname);
int (*update_filter_info_raw)(unsigned long long, int, int);
};
diff --git a/extension_eppic.c b/extension_eppic.c
index 7e045c9..bb36d5a 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -219,7 +219,7 @@ apimember(char *mname, ull idx, type_t *tm, member_t *m, ull *last_index)
ull m_die, die_off = idx;
char *name = NULL;
- nfields = GET_DIE_NFIELDS(die_off);
+ nfields = GET_DIE_NFIELDS_ALL(die_off);
/*
* GET_DIE_NFIELDS() returns < 0 if the die is not structure type
* or union type
diff --git a/extension_eppic.h b/extension_eppic.h
index 42437f2..24189ba 100644
--- a/extension_eppic.h
+++ b/extension_eppic.h
@@ -88,7 +88,7 @@ struct call_back *cb;
#define GET_DIE_OFFSET cb->get_die_offset
#define GET_DIE_LENGTH cb->get_die_length
#define GET_DIE_MEMBER_ALL cb->get_die_member_all
-#define GET_DIE_NFIELDS cb->get_die_nfields
+#define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all
#define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
#define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] makedumpfile: Add support to module data structures
2014-02-27 6:19 [PATCH] makedumpfile: Add support to module data structures Aruna Balakrishnaiah
@ 2014-02-28 6:51 ` Atsushi Kumagai
2014-02-28 7:08 ` Aruna Balakrishnaiah
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Kumagai @ 2014-02-28 6:51 UTC (permalink / raw)
To: aruna@linux.vnet.ibm.com; +Cc: kexec@lists.infradead.org
>diff --git a/dwarf_info.c b/dwarf_info.c
>index 6e21b8a..268e922 100644
>--- a/dwarf_info.c
>+++ b/dwarf_info.c
>@@ -489,7 +489,6 @@ get_die_from_offset(Dwarf_Off offset, Dwarf_Die *die)
> return FALSE;
>
> if (!dwarf_offdie(dwarf_info.dwarfd, offset, die)) {
>- ERRMSG("Can't find the DIE.\n");
> return FALSE;
> }
>
>@@ -1343,14 +1342,12 @@ get_die_nfields(unsigned long long die_off)
> Dwarf_Die result, child, *die;
>
> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>- ERRMSG("Can't find the DIE.\n");
> return -1;
> }
>
> die = &result;
> tag = dwarf_tag(die);
> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>- ERRMSG("DIE is not of structure or union type.\n");
> clean_dwfl_info();
> return -1;
> }
>@@ -1388,14 +1385,12 @@ get_die_member(unsigned long long die_off, int index, long *offset,
> return -1;
>
> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>- ERRMSG("Can't find the DIE.\n");
> return -1;
> }
>
> die = &result;
> tag = dwarf_tag(die);
> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>- ERRMSG("DIE is not of structure or union type.\n");
> clean_dwfl_info();
> return -1;
> }
>@@ -1471,7 +1466,6 @@ get_die_attr_type(unsigned long long die_off, int *type_flag,
> return FALSE;
>
> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>- ERRMSG("Can't find the DIE.\n");
> return FALSE;
> }
>
>@@ -1509,7 +1503,6 @@ get_die_name(unsigned long long die_off)
> return NULL;
>
> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>- ERRMSG("Can't find the DIE.\n");
> return NULL;
> }
>
>@@ -1554,7 +1547,6 @@ get_die_length(unsigned long long die_off, int flag)
> return FALSE;
>
> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>- ERRMSG("Can't find the DIE.\n");
> return FALSE;
> }
Why did you remove these error messages ?
This change looks unrelated to the subject, you should at least
do it separately.
Thanks
Atsushi Kumagai
>diff --git a/erase_info.c b/erase_info.c
>index a789389..e0e0f71 100644
>--- a/erase_info.c
>+++ b/erase_info.c
>@@ -34,7 +34,7 @@ struct call_back eppic_cb = {
> &get_die_offset,
> &get_die_length,
> &get_die_member_all,
>- &get_die_nfields,
>+ &get_die_nfields_all,
> &get_symbol_addr_all,
> &update_filter_info_raw
> };
>@@ -2028,6 +2028,84 @@ get_domain_all(char *symname, int cmd, unsigned long long *die) {
> }
>
> /*
>+ * Search for die in modules as well as vmlinux
>+ */
>+int
>+get_die_nfields_all(unsigned long long die_off)
>+{
>+ short vmlinux_searched = 0;
>+ long nfields = -1;
>+ unsigned int i, current_mod;
>+ struct module_info *modules;
>+
>+ /* Search in vmlinux if debuginfo is set to vmlinux */
>+ if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
>+ nfields = get_die_nfields(die_off);
>+ if (nfields > 0)
>+ return nfields;
>+
>+ vmlinux_searched = 1;
>+ }
>+
>+ /*
>+ * Proceed the search in modules. Try in the module
>+ * which resulted in a hit in the previous search
>+ */
>+
>+ modules = mod_st.modules;
>+ current_mod = mod_st.current_mod;
>+
>+ if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
>+ if (!set_dwarf_debuginfo(modules[current_mod].name,
>+ info->system_utsname.release, NULL, -1)) {
>+ ERRMSG("Cannot set to current module %s\n",
>+ modules[current_mod].name);
>+ return -1;
>+ }
>+ }
>+
>+ nfields = get_die_nfields(die_off);
>+ if (nfields > 0)
>+ return nfields;
>+
>+ /* Search in all modules */
>+ for (i = 0; i < mod_st.num_modules; i++) {
>+
>+ /* Already searched. Skip */
>+ if (i == current_mod)
>+ continue;
>+
>+ if (!set_dwarf_debuginfo(modules[i].name,
>+ info->system_utsname.release, NULL, -1)) {
>+ ERRMSG("Skipping Module section %s\n", modules[i].name);
>+ continue;
>+ }
>+
>+ nfields = get_die_nfields(die_off);
>+
>+ if (nfields < 0)
>+ continue;
>+
>+ /*
>+ * Die found. Set the current_mod to this module index,
>+ * a minor optimization for fast lookup next time
>+ */
>+ mod_st.current_mod = i;
>+ return nfields;
>+ }
>+
>+ /* Die not found in any module. Set debuginfo back to vmlinux */
>+ set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
>+ info->fd_vmlinux);
>+
>+ if (!vmlinux_searched)
>+ return get_die_nfields(die_off);
>+ else
>+ return -1;
>+
>+}
>+
>+/*
> * Search for die member in modules as well as vmlinux
> */
> int
>diff --git a/erase_info.h b/erase_info.h
>index a90fac0..4d4957e 100644
>--- a/erase_info.h
>+++ b/erase_info.h
>@@ -35,6 +35,7 @@ unsigned long long get_symbol_addr_all(char *);
> long get_domain_all(char *, int, unsigned long long *);
> int get_die_member_all(unsigned long long die_off, int index, long *offset,
> char **name, int *nbits, int *fbits, unsigned long long *m_die);
>+int get_die_nfields_all(unsigned long long die_off);
>
> struct call_back {
> long (*get_domain_all)(char *, int, unsigned long long *);
>@@ -48,7 +49,7 @@ struct call_back {
> int (*get_die_member_all)(unsigned long long die_off, int index,
> long *offset, char **name, int *nbits, int *fbits,
> unsigned long long *m_die);
>- int (*get_die_nfields)(unsigned long long die_off);
>+ int (*get_die_nfields_all)(unsigned long long die_off);
> unsigned long long (*get_symbol_addr_all)(char *symname);
> int (*update_filter_info_raw)(unsigned long long, int, int);
> };
>diff --git a/extension_eppic.c b/extension_eppic.c
>index 7e045c9..bb36d5a 100644
>--- a/extension_eppic.c
>+++ b/extension_eppic.c
>@@ -219,7 +219,7 @@ apimember(char *mname, ull idx, type_t *tm, member_t *m, ull *last_index)
> ull m_die, die_off = idx;
> char *name = NULL;
>
>- nfields = GET_DIE_NFIELDS(die_off);
>+ nfields = GET_DIE_NFIELDS_ALL(die_off);
> /*
> * GET_DIE_NFIELDS() returns < 0 if the die is not structure type
> * or union type
>diff --git a/extension_eppic.h b/extension_eppic.h
>index 42437f2..24189ba 100644
>--- a/extension_eppic.h
>+++ b/extension_eppic.h
>@@ -88,7 +88,7 @@ struct call_back *cb;
> #define GET_DIE_OFFSET cb->get_die_offset
> #define GET_DIE_LENGTH cb->get_die_length
> #define GET_DIE_MEMBER_ALL cb->get_die_member_all
>-#define GET_DIE_NFIELDS cb->get_die_nfields
>+#define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all
> #define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
> #define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
>
>
>
>_______________________________________________
>kexec mailing list
>kexec@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] makedumpfile: Add support to module data structures
2014-02-28 6:51 ` Atsushi Kumagai
@ 2014-02-28 7:08 ` Aruna Balakrishnaiah
2014-02-28 7:30 ` Atsushi Kumagai
0 siblings, 1 reply; 5+ messages in thread
From: Aruna Balakrishnaiah @ 2014-02-28 7:08 UTC (permalink / raw)
To: Atsushi Kumagai; +Cc: kexec@lists.infradead.org
On Friday 28 February 2014 12:21 PM, Atsushi Kumagai wrote:
>> diff --git a/dwarf_info.c b/dwarf_info.c
>> index 6e21b8a..268e922 100644
>> --- a/dwarf_info.c
>> +++ b/dwarf_info.c
>> @@ -489,7 +489,6 @@ get_die_from_offset(Dwarf_Off offset, Dwarf_Die *die)
>> return FALSE;
>>
>> if (!dwarf_offdie(dwarf_info.dwarfd, offset, die)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return FALSE;
>> }
>>
>> @@ -1343,14 +1342,12 @@ get_die_nfields(unsigned long long die_off)
>> Dwarf_Die result, child, *die;
>>
>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return -1;
>> }
>>
>> die = &result;
>> tag = dwarf_tag(die);
>> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>> - ERRMSG("DIE is not of structure or union type.\n");
>> clean_dwfl_info();
>> return -1;
>> }
>> @@ -1388,14 +1385,12 @@ get_die_member(unsigned long long die_off, int index, long *offset,
>> return -1;
>>
>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return -1;
>> }
>>
>> die = &result;
>> tag = dwarf_tag(die);
>> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>> - ERRMSG("DIE is not of structure or union type.\n");
>> clean_dwfl_info();
>> return -1;
>> }
>> @@ -1471,7 +1466,6 @@ get_die_attr_type(unsigned long long die_off, int *type_flag,
>> return FALSE;
>>
>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return FALSE;
>> }
>>
>> @@ -1509,7 +1503,6 @@ get_die_name(unsigned long long die_off)
>> return NULL;
>>
>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return NULL;
>> }
>>
>> @@ -1554,7 +1547,6 @@ get_die_length(unsigned long long die_off, int flag)
>> return FALSE;
>>
>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>> - ERRMSG("Can't find the DIE.\n");
>> return FALSE;
>> }
> Why did you remove these error messages ?
> This change looks unrelated to the subject, you should at least
> do it separately.
It was throwing unnecessary messages when a particular die
is not found in a module.
Since this patch takes care of setting the debug info to the right
module , removed the error messages here.
Regards,
Aruna
>
> Thanks
> Atsushi Kumagai
>
>> diff --git a/erase_info.c b/erase_info.c
>> index a789389..e0e0f71 100644
>> --- a/erase_info.c
>> +++ b/erase_info.c
>> @@ -34,7 +34,7 @@ struct call_back eppic_cb = {
>> &get_die_offset,
>> &get_die_length,
>> &get_die_member_all,
>> - &get_die_nfields,
>> + &get_die_nfields_all,
>> &get_symbol_addr_all,
>> &update_filter_info_raw
>> };
>> @@ -2028,6 +2028,84 @@ get_domain_all(char *symname, int cmd, unsigned long long *die) {
>> }
>>
>> /*
>> + * Search for die in modules as well as vmlinux
>> + */
>> +int
>> +get_die_nfields_all(unsigned long long die_off)
>> +{
>> + short vmlinux_searched = 0;
>> + long nfields = -1;
>> + unsigned int i, current_mod;
>> + struct module_info *modules;
>> +
>> + /* Search in vmlinux if debuginfo is set to vmlinux */
>> + if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
>> + nfields = get_die_nfields(die_off);
>> + if (nfields > 0)
>> + return nfields;
>> +
>> + vmlinux_searched = 1;
>> + }
>> +
>> + /*
>> + * Proceed the search in modules. Try in the module
>> + * which resulted in a hit in the previous search
>> + */
>> +
>> + modules = mod_st.modules;
>> + current_mod = mod_st.current_mod;
>> +
>> + if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
>> + if (!set_dwarf_debuginfo(modules[current_mod].name,
>> + info->system_utsname.release, NULL, -1)) {
>> + ERRMSG("Cannot set to current module %s\n",
>> + modules[current_mod].name);
>> + return -1;
>> + }
>> + }
>> +
>> + nfields = get_die_nfields(die_off);
>> + if (nfields > 0)
>> + return nfields;
>> +
>> + /* Search in all modules */
>> + for (i = 0; i < mod_st.num_modules; i++) {
>> +
>> + /* Already searched. Skip */
>> + if (i == current_mod)
>> + continue;
>> +
>> + if (!set_dwarf_debuginfo(modules[i].name,
>> + info->system_utsname.release, NULL, -1)) {
>> + ERRMSG("Skipping Module section %s\n", modules[i].name);
>> + continue;
>> + }
>> +
>> + nfields = get_die_nfields(die_off);
>> +
>> + if (nfields < 0)
>> + continue;
>> +
>> + /*
>> + * Die found. Set the current_mod to this module index,
>> + * a minor optimization for fast lookup next time
>> + */
>> + mod_st.current_mod = i;
>> + return nfields;
>> + }
>> +
>> + /* Die not found in any module. Set debuginfo back to vmlinux */
>> + set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
>> + info->fd_vmlinux);
>> +
>> + if (!vmlinux_searched)
>> + return get_die_nfields(die_off);
>> + else
>> + return -1;
>> +
>> +}
>> +
>> +/*
>> * Search for die member in modules as well as vmlinux
>> */
>> int
>> diff --git a/erase_info.h b/erase_info.h
>> index a90fac0..4d4957e 100644
>> --- a/erase_info.h
>> +++ b/erase_info.h
>> @@ -35,6 +35,7 @@ unsigned long long get_symbol_addr_all(char *);
>> long get_domain_all(char *, int, unsigned long long *);
>> int get_die_member_all(unsigned long long die_off, int index, long *offset,
>> char **name, int *nbits, int *fbits, unsigned long long *m_die);
>> +int get_die_nfields_all(unsigned long long die_off);
>>
>> struct call_back {
>> long (*get_domain_all)(char *, int, unsigned long long *);
>> @@ -48,7 +49,7 @@ struct call_back {
>> int (*get_die_member_all)(unsigned long long die_off, int index,
>> long *offset, char **name, int *nbits, int *fbits,
>> unsigned long long *m_die);
>> - int (*get_die_nfields)(unsigned long long die_off);
>> + int (*get_die_nfields_all)(unsigned long long die_off);
>> unsigned long long (*get_symbol_addr_all)(char *symname);
>> int (*update_filter_info_raw)(unsigned long long, int, int);
>> };
>> diff --git a/extension_eppic.c b/extension_eppic.c
>> index 7e045c9..bb36d5a 100644
>> --- a/extension_eppic.c
>> +++ b/extension_eppic.c
>> @@ -219,7 +219,7 @@ apimember(char *mname, ull idx, type_t *tm, member_t *m, ull *last_index)
>> ull m_die, die_off = idx;
>> char *name = NULL;
>>
>> - nfields = GET_DIE_NFIELDS(die_off);
>> + nfields = GET_DIE_NFIELDS_ALL(die_off);
>> /*
>> * GET_DIE_NFIELDS() returns < 0 if the die is not structure type
>> * or union type
>> diff --git a/extension_eppic.h b/extension_eppic.h
>> index 42437f2..24189ba 100644
>> --- a/extension_eppic.h
>> +++ b/extension_eppic.h
>> @@ -88,7 +88,7 @@ struct call_back *cb;
>> #define GET_DIE_OFFSET cb->get_die_offset
>> #define GET_DIE_LENGTH cb->get_die_length
>> #define GET_DIE_MEMBER_ALL cb->get_die_member_all
>> -#define GET_DIE_NFIELDS cb->get_die_nfields
>> +#define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all
>> #define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
>> #define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
>>
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] makedumpfile: Add support to module data structures
2014-02-28 7:08 ` Aruna Balakrishnaiah
@ 2014-02-28 7:30 ` Atsushi Kumagai
0 siblings, 0 replies; 5+ messages in thread
From: Atsushi Kumagai @ 2014-02-28 7:30 UTC (permalink / raw)
To: aruna@linux.vnet.ibm.com; +Cc: kexec@lists.infradead.org
>On Friday 28 February 2014 12:21 PM, Atsushi Kumagai wrote:
>>> diff --git a/dwarf_info.c b/dwarf_info.c
>>> index 6e21b8a..268e922 100644
>>> --- a/dwarf_info.c
>>> +++ b/dwarf_info.c
>>> @@ -489,7 +489,6 @@ get_die_from_offset(Dwarf_Off offset, Dwarf_Die *die)
>>> return FALSE;
>>>
>>> if (!dwarf_offdie(dwarf_info.dwarfd, offset, die)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return FALSE;
>>> }
>>>
>>> @@ -1343,14 +1342,12 @@ get_die_nfields(unsigned long long die_off)
>>> Dwarf_Die result, child, *die;
>>>
>>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return -1;
>>> }
>>>
>>> die = &result;
>>> tag = dwarf_tag(die);
>>> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>>> - ERRMSG("DIE is not of structure or union type.\n");
>>> clean_dwfl_info();
>>> return -1;
>>> }
>>> @@ -1388,14 +1385,12 @@ get_die_member(unsigned long long die_off, int index, long *offset,
>>> return -1;
>>>
>>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return -1;
>>> }
>>>
>>> die = &result;
>>> tag = dwarf_tag(die);
>>> if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
>>> - ERRMSG("DIE is not of structure or union type.\n");
>>> clean_dwfl_info();
>>> return -1;
>>> }
>>> @@ -1471,7 +1466,6 @@ get_die_attr_type(unsigned long long die_off, int *type_flag,
>>> return FALSE;
>>>
>>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return FALSE;
>>> }
>>>
>>> @@ -1509,7 +1503,6 @@ get_die_name(unsigned long long die_off)
>>> return NULL;
>>>
>>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return NULL;
>>> }
>>>
>>> @@ -1554,7 +1547,6 @@ get_die_length(unsigned long long die_off, int flag)
>>> return FALSE;
>>>
>>> if (!get_die_from_offset((Dwarf_Off) die_off, &result)) {
>>> - ERRMSG("Can't find the DIE.\n");
>>> return FALSE;
>>> }
>> Why did you remove these error messages ?
>> This change looks unrelated to the subject, you should at least
>> do it separately.
>
>It was throwing unnecessary messages when a particular die
>is not found in a module.
>
>Since this patch takes care of setting the debug info to the right
>module , removed the error messages here.
>
>Regards,
>Aruna
Thanks, I understand. I misunderstood that these changed functions are
old common utility, but in fact they are introduced for eppic.
So there is no problem.
Acked-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
>
>>
>> Thanks
>> Atsushi Kumagai
>>
>>> diff --git a/erase_info.c b/erase_info.c
>>> index a789389..e0e0f71 100644
>>> --- a/erase_info.c
>>> +++ b/erase_info.c
>>> @@ -34,7 +34,7 @@ struct call_back eppic_cb = {
>>> &get_die_offset,
>>> &get_die_length,
>>> &get_die_member_all,
>>> - &get_die_nfields,
>>> + &get_die_nfields_all,
>>> &get_symbol_addr_all,
>>> &update_filter_info_raw
>>> };
>>> @@ -2028,6 +2028,84 @@ get_domain_all(char *symname, int cmd, unsigned long long *die) {
>>> }
>>>
>>> /*
>>> + * Search for die in modules as well as vmlinux
>>> + */
>>> +int
>>> +get_die_nfields_all(unsigned long long die_off)
>>> +{
>>> + short vmlinux_searched = 0;
>>> + long nfields = -1;
>>> + unsigned int i, current_mod;
>>> + struct module_info *modules;
>>> +
>>> + /* Search in vmlinux if debuginfo is set to vmlinux */
>>> + if (!strcmp(get_dwarf_module_name(), "vmlinux")) {
>>> + nfields = get_die_nfields(die_off);
>>> + if (nfields > 0)
>>> + return nfields;
>>> +
>>> + vmlinux_searched = 1;
>>> + }
>>> +
>>> + /*
>>> + * Proceed the search in modules. Try in the module
>>> + * which resulted in a hit in the previous search
>>> + */
>>> +
>>> + modules = mod_st.modules;
>>> + current_mod = mod_st.current_mod;
>>> +
>>> + if (strcmp(get_dwarf_module_name(), modules[current_mod].name)) {
>>> + if (!set_dwarf_debuginfo(modules[current_mod].name,
>>> + info->system_utsname.release, NULL, -1)) {
>>> + ERRMSG("Cannot set to current module %s\n",
>>> + modules[current_mod].name);
>>> + return -1;
>>> + }
>>> + }
>>> +
>>> + nfields = get_die_nfields(die_off);
>>> + if (nfields > 0)
>>> + return nfields;
>>> +
>>> + /* Search in all modules */
>>> + for (i = 0; i < mod_st.num_modules; i++) {
>>> +
>>> + /* Already searched. Skip */
>>> + if (i == current_mod)
>>> + continue;
>>> +
>>> + if (!set_dwarf_debuginfo(modules[i].name,
>>> + info->system_utsname.release, NULL, -1)) {
>>> + ERRMSG("Skipping Module section %s\n", modules[i].name);
>>> + continue;
>>> + }
>>> +
>>> + nfields = get_die_nfields(die_off);
>>> +
>>> + if (nfields < 0)
>>> + continue;
>>> +
>>> + /*
>>> + * Die found. Set the current_mod to this module index,
>>> + * a minor optimization for fast lookup next time
>>> + */
>>> + mod_st.current_mod = i;
>>> + return nfields;
>>> + }
>>> +
>>> + /* Die not found in any module. Set debuginfo back to vmlinux */
>>> + set_dwarf_debuginfo("vmlinux", NULL, info->name_vmlinux,
>>> + info->fd_vmlinux);
>>> +
>>> + if (!vmlinux_searched)
>>> + return get_die_nfields(die_off);
>>> + else
>>> + return -1;
>>> +
>>> +}
>>> +
>>> +/*
>>> * Search for die member in modules as well as vmlinux
>>> */
>>> int
>>> diff --git a/erase_info.h b/erase_info.h
>>> index a90fac0..4d4957e 100644
>>> --- a/erase_info.h
>>> +++ b/erase_info.h
>>> @@ -35,6 +35,7 @@ unsigned long long get_symbol_addr_all(char *);
>>> long get_domain_all(char *, int, unsigned long long *);
>>> int get_die_member_all(unsigned long long die_off, int index, long *offset,
>>> char **name, int *nbits, int *fbits, unsigned long long *m_die);
>>> +int get_die_nfields_all(unsigned long long die_off);
>>>
>>> struct call_back {
>>> long (*get_domain_all)(char *, int, unsigned long long *);
>>> @@ -48,7 +49,7 @@ struct call_back {
>>> int (*get_die_member_all)(unsigned long long die_off, int index,
>>> long *offset, char **name, int *nbits, int *fbits,
>>> unsigned long long *m_die);
>>> - int (*get_die_nfields)(unsigned long long die_off);
>>> + int (*get_die_nfields_all)(unsigned long long die_off);
>>> unsigned long long (*get_symbol_addr_all)(char *symname);
>>> int (*update_filter_info_raw)(unsigned long long, int, int);
>>> };
>>> diff --git a/extension_eppic.c b/extension_eppic.c
>>> index 7e045c9..bb36d5a 100644
>>> --- a/extension_eppic.c
>>> +++ b/extension_eppic.c
>>> @@ -219,7 +219,7 @@ apimember(char *mname, ull idx, type_t *tm, member_t *m, ull *last_index)
>>> ull m_die, die_off = idx;
>>> char *name = NULL;
>>>
>>> - nfields = GET_DIE_NFIELDS(die_off);
>>> + nfields = GET_DIE_NFIELDS_ALL(die_off);
>>> /*
>>> * GET_DIE_NFIELDS() returns < 0 if the die is not structure type
>>> * or union type
>>> diff --git a/extension_eppic.h b/extension_eppic.h
>>> index 42437f2..24189ba 100644
>>> --- a/extension_eppic.h
>>> +++ b/extension_eppic.h
>>> @@ -88,7 +88,7 @@ struct call_back *cb;
>>> #define GET_DIE_OFFSET cb->get_die_offset
>>> #define GET_DIE_LENGTH cb->get_die_length
>>> #define GET_DIE_MEMBER_ALL cb->get_die_member_all
>>> -#define GET_DIE_NFIELDS cb->get_die_nfields
>>> +#define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all
>>> #define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
>>> #define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
>>>
>>>
>>>
>>> _______________________________________________
>>> kexec mailing list
>>> kexec@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/kexec
>
>
>_______________________________________________
>kexec mailing list
>kexec@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-28 7:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 6:19 [PATCH] makedumpfile: Add support to module data structures Aruna Balakrishnaiah
2014-02-28 6:51 ` Atsushi Kumagai
2014-02-28 7:08 ` Aruna Balakrishnaiah
2014-02-28 7:30 ` Atsushi Kumagai
-- strict thread matches above, loose matches on Subject: below --
2013-11-08 5:21 Aruna Balakrishnaiah
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.