From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org
Subject: [RFC PATCH 02/10] Add debuginfo interface for enum type size
Date: Fri, 29 Jun 2012 02:38:13 +0900 [thread overview]
Message-ID: <20120628173813.19702.18946.stgit@fedora-machine> (raw)
In-Reply-To: <20120628173757.19702.75678.stgit@fedora-machine>
This is needed in this patch set to determine whether or not a certain
enumeration type exists from a given debuginfo. The interface is a
simple extension from the existing one for enumeration value.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
dwarf_info.c | 29 +++++++++++++++++++++--------
dwarf_info.h | 1 +
makedumpfile.h | 13 +++++++++++--
3 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/dwarf_info.c b/dwarf_info.c
index 1429858..98efc26 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -75,7 +75,8 @@ is_search_structure(int cmd)
static int
is_search_number(int cmd)
{
- if (cmd == DWARF_INFO_GET_ENUM_NUMBER)
+ if ((cmd == DWARF_INFO_GET_ENUM_NUMBER)
+ || (cmd == DWARF_INFO_GET_ENUMERATION_TYPE_SIZE))
return TRUE;
else
return FALSE;
@@ -647,7 +648,7 @@ search_structure(Dwarf_Die *die, int *found)
static void
search_number(Dwarf_Die *die, int *found)
{
- int tag;
+ int tag, bytesize;
Dwarf_Word const_value;
Dwarf_Attribute attr;
Dwarf_Die child, *walker;
@@ -658,6 +659,22 @@ search_number(Dwarf_Die *die, int *found)
if (tag != DW_TAG_enumeration_type)
continue;
+ if (dwarf_info.cmd == DWARF_INFO_GET_ENUMERATION_TYPE_SIZE) {
+ name = dwarf_diename(die);
+
+ if (!name || strcmp(name, dwarf_info.struct_name))
+ continue;
+
+ if ((bytesize = dwarf_bytesize(die)) <= 0)
+ continue;
+
+ *found = TRUE;
+
+ dwarf_info.struct_size = bytesize;
+
+ return;
+ }
+
if (dwarf_child(die, &child) != 0)
continue;
@@ -1026,13 +1043,9 @@ out:
* Get the size of structure.
*/
long
-get_structure_size(char *structname, int flag_typedef)
+get_structure_size(char *structname, int cmd)
{
- if (flag_typedef)
- dwarf_info.cmd = DWARF_INFO_GET_TYPEDEF_SIZE;
- else
- dwarf_info.cmd = DWARF_INFO_GET_STRUCT_SIZE;
-
+ dwarf_info.cmd = cmd;
dwarf_info.struct_name = structname;
dwarf_info.struct_size = NOT_FOUND_STRUCTURE;
diff --git a/dwarf_info.h b/dwarf_info.h
index 1e07484..b445738 100644
--- a/dwarf_info.h
+++ b/dwarf_info.h
@@ -47,6 +47,7 @@ enum {
DWARF_INFO_CHECK_SYMBOL_ARRAY_TYPE,
DWARF_INFO_GET_SYMBOL_TYPE,
DWARF_INFO_GET_MEMBER_TYPE,
+ DWARF_INFO_GET_ENUMERATION_TYPE_SIZE,
};
char *get_dwarf_module_name(void);
diff --git a/makedumpfile.h b/makedumpfile.h
index 6f5489d..95c0abc 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -225,14 +225,23 @@ do { \
#define ARRAY_LENGTH(X) (array_table.X)
#define SIZE_INIT(X, Y) \
do { \
- if ((SIZE(X) = get_structure_size(Y, 0)) == FAILED_DWARFINFO) \
+ if ((SIZE(X) = get_structure_size(Y, DWARF_INFO_GET_STRUCT_SIZE)) \
+ == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define TYPEDEF_SIZE_INIT(X, Y) \
do { \
- if ((SIZE(X) = get_structure_size(Y, 1)) == FAILED_DWARFINFO) \
+ if ((SIZE(X) = get_structure_size(Y, DWARF_INFO_GET_TYPEDEF_SIZE)) \
+ == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
+#define ENUM_TYPE_SIZE_INIT(X, Y) \
+do { \
+ if ((SIZE(X) = get_structure_size(Y, \
+ DWARF_INFO_GET_ENUMERATION_TYPE_SIZE)) \
+ == FAILED_DWARFINFO) \
+ return FALSE; \
+ } while (0)
#define OFFSET_INIT(X, Y, Z) \
do { \
if ((OFFSET(X) = get_member_offset(Y, Z, DWARF_INFO_GET_MEMBER_OFFSET)) \
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-06-28 17:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 17:37 [RFC PATCH 00/10] Support free page filtering looking up mem_map array HATAYAMA Daisuke
2012-06-28 17:38 ` [RFC PATCH 01/10] Move page flags setup for old kernels after debuginfo initialization HATAYAMA Daisuke
2012-06-28 17:38 ` HATAYAMA Daisuke [this message]
2012-06-28 17:38 ` [RFC PATCH 03/10] Add new parameters for various tables HATAYAMA Daisuke
2012-06-28 17:38 ` [RFC PATCH 04/10] Add debuginfo-related processing for VMCOREINFO/VMLINUX HATAYAMA Daisuke
2012-06-28 17:38 ` [RFC PATCH 05/10] Add page flag values as hardcoded values HATAYAMA Daisuke
2012-06-28 17:38 ` [RFC PATCH 06/10] Add command-line processing for free page filtering looking up mem_map array HATAYAMA Daisuke
2012-06-28 17:38 ` [RFC PATCH 07/10] Add excldue free pages by " HATAYAMA Daisuke
2012-06-28 17:39 ` [RFC PATCH 08/10] Add page_is_buddy for recent kernels HATAYAMA Daisuke
2012-06-28 17:39 ` [RFC PATCH 09/10] Add page_is_buddy for PG_buddy HATAYAMA Daisuke
2012-06-28 17:39 ` [RFC PATCH 10/10] Add page_is_buddy for old kernels HATAYAMA Daisuke
2012-06-29 3:07 ` [RFC PATCH 00/10] Support free page filtering looking up mem_map array HATAYAMA Daisuke
2012-06-29 6:23 ` Atsushi Kumagai
2012-07-13 5:23 ` Atsushi Kumagai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120628173813.19702.18946.stgit@fedora-machine \
--to=d.hatayama@jp.fujitsu.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox