public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org
Subject: [PATCH v2 02/10] Add debuginfo interface for enum type size
Date: Fri, 16 Nov 2012 14:01:41 +0900	[thread overview]
Message-ID: <20121116050141.8280.42737.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20121116050108.8280.14861.stgit@localhost6.localdomain6>

This is need to determine if a specified enumeration type is present
in a given debug information.

In this patch set, I'll use this to check if enum pageflags is
present.

The newly introduced 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   |   18 +++++++++++++++++-
 dwarf_info.h   |    1 +
 makedumpfile.h |   13 +++++++++++--
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/dwarf_info.c b/dwarf_info.c
index 94b920a..09a8e1e 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -607,7 +607,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;
@@ -618,6 +618,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;
 
diff --git a/dwarf_info.h b/dwarf_info.h
index 8d0084d..185cbb6 100644
--- a/dwarf_info.h
+++ b/dwarf_info.h
@@ -46,6 +46,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 97aca2a..20f4d99 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -256,14 +256,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

  parent reply	other threads:[~2012-11-16  5:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16  5:01 [PATCH v2 00/10] Support free page filtering looking up mem_map array HATAYAMA Daisuke
2012-11-16  5:01 ` [PATCH v2 01/10] Move page flags setup for old kernels after debuginfo initialization HATAYAMA Daisuke
2012-11-16  5:01 ` HATAYAMA Daisuke [this message]
2012-11-16  5:01 ` [PATCH v2 03/10] Add new parameters to various tables HATAYAMA Daisuke
2012-11-16  5:01 ` [PATCH v2 04/10] Add debuginfo-related processing for VMCOREINFO/VMLINUX HATAYAMA Daisuke
2012-11-16  5:01 ` [PATCH v2 05/10] Add hardcoded page flag values HATAYAMA Daisuke
2012-11-16  5:02 ` [PATCH v2 06/10] Exclude free pages by looking up mem_map array HATAYAMA Daisuke
2012-11-16  5:02 ` [PATCH v2 07/10] Add page_is_buddy for recent kernels HATAYAMA Daisuke
2012-11-16  5:02 ` [PATCH v2 08/10] Add page_is_buddy for PG_buddy HATAYAMA Daisuke
2012-11-27  6:00   ` Atsushi Kumagai
2012-11-27  7:30     ` Atsushi Kumagai
2012-11-27  8:53     ` Hatayama, Daisuke
2012-11-28  7:42       ` Atsushi Kumagai
2012-11-16  5:02 ` [PATCH v2 09/10] Add page_is_buddy for old kernels HATAYAMA Daisuke
2012-11-16  5:02 ` [PATCH v2 10/10] Warn cyclic buffer overrun and correct it if possible HATAYAMA Daisuke
2013-09-11  7:51   ` Atsushi Kumagai
2013-09-11  8:35     ` HATAYAMA Daisuke
2013-09-12  2:00       ` HATAYAMA Daisuke
2013-09-12  6:17         ` Atsushi Kumagai
2012-11-16  7:05 ` [PATCH v2 00/10] Support free page filtering looking up mem_map array 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=20121116050141.8280.42737.stgit@localhost6.localdomain6 \
    --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