From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: ananth@in.ibm.com, mahesh@linux.vnet.ibm.com,
kexec@lists.infradead.org, LChouinard@s2sys.com,
tachibana@mxm.nes.nec.co.jp, buendgen@de.ibm.com
Subject: Re: [PATCH v3 4/7] Implement apigetctype call back function
Date: Thu, 27 Dec 2012 14:41:23 +0530 [thread overview]
Message-ID: <50DC10BB.7060604@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121220174539.84328e734a10246c102f026f@mxc.nes.nec.co.jp>
Hi Atsushi,
On 2012-12-20 14:15, Atsushi Kumagai wrote:
> Hello Aravinda,
>
> On Fri, 14 Dec 2012 14:56:32 +0530
> Aravinda Prasad <aravinda@linux.vnet.ibm.com> wrote:
>
[...]
> I commented for search_domain() in v1 patch:
>
> http://lists.infradead.org/pipermail/kexec/2012-October/007024.html
>
> > I assume that search_domain() needs to descend into struct/union for
> > a nested member, like how we fixed search_member() in commit:ecff242c.
> > I want to make sure that your patches can treat even a nested member.
>
> And I still think so, it should be fixed as below:
>
>
> diff --git a/dwarf_info.c b/dwarf_info.c
> index 22c9e2f..a11b6ad 100644
> --- a/dwarf_info.c
> +++ b/dwarf_info.c
> @@ -814,7 +814,7 @@ search_domain(Dwarf_Die *die, int *found)
> * Descend into members and search for the
> * needed domain there.
> */
> - if (!name) {
> + if ((!name) || strcmp(name, dwarf_info.symbol_name)) {
> if (!get_die_type(die, &die_type))
> continue;
>
> Do you agree with me ?
Yes, I think this should be fine. I will modify and test the patch with
the above change.
>
>
> Thanks
> Atsushi Kumagai
>
>> +
>> + switch (dwarf_info.cmd) {
>> + case DWARF_INFO_GET_DOMAIN_STRUCT:
>> + if (tag == DW_TAG_structure_type)
>> + flag = 1;
>> + break;
>> + case DWARF_INFO_GET_DOMAIN_UNION:
>> + if (tag == DW_TAG_union_type)
>> + flag = 1;
>> + break;
>> + case DWARF_INFO_GET_DOMAIN_TYPEDEF:
>> + if (tag == DW_TAG_typedef)
>> + flag = 1;
>> + break;
>> + /* TODO
>> + * Implement functionality for the rest of the domains
>> + */
>> + }
>> +
>> + if (!flag)
>> + continue;
>> +
>> + dwarf_info.struct_size = dwarf_bytesize(die);
>> +
>> + if (dwarf_info.struct_size > 0) {
>> + if (found)
>> + *found = TRUE;
>> + dwarf_info.die_offset = dwarf_dieoffset(die);
>> + break;
>> + }
>> + } while (!dwarf_siblingof(die, die));
>> +}
>> +
>> +static void
>> search_die_tree(Dwarf_Die *die, int *found)
>> {
>> Dwarf_Die child;
>> @@ -774,6 +859,9 @@ search_die_tree(Dwarf_Die *die, int *found)
>>
>> else if (is_search_typedef(dwarf_info.cmd))
>> search_typedef(die, found);
>> +
>> + else if (is_search_domain(dwarf_info.cmd))
>> + search_domain(die, found);
>> }
>>
>> static int
>> @@ -1166,6 +1254,27 @@ get_source_filename(char *structname, char *src_name, int cmd)
>> }
>>
>> /*
>> + * Get the domain information of the symbol
>> + */
>> +long
>> +get_domain(char *symname, int cmd, unsigned long long *die)
>> +{
>> + dwarf_info.cmd = cmd;
>> + dwarf_info.symbol_name = symname;
>> + dwarf_info.type_name = NULL;
>> + dwarf_info.struct_size = NOT_FOUND_STRUCTURE;
>> + dwarf_info.die_offset = 0;
>> +
>> + if (!get_debug_info())
>> + return 0;
>> +
>> + if (die)
>> + *die = (unsigned long long) dwarf_info.die_offset;
>> +
>> + return dwarf_info.struct_size;
>> +}
>> +
>> +/*
>> * Set the dwarf_info with kernel/module debuginfo file information.
>> */
>> int
>> diff --git a/dwarf_info.h b/dwarf_info.h
>> index 185cbb6..074b5cc 100644
>> --- a/dwarf_info.h
>> +++ b/dwarf_info.h
>> @@ -47,6 +47,14 @@ enum {
>> DWARF_INFO_GET_SYMBOL_TYPE,
>> DWARF_INFO_GET_MEMBER_TYPE,
>> DWARF_INFO_GET_ENUMERATION_TYPE_SIZE,
>> + DWARF_INFO_GET_DOMAIN_STRUCT,
>> + DWARF_INFO_GET_DOMAIN_TYPEDEF,
>> + DWARF_INFO_GET_DOMAIN_ARRAY,
>> + DWARF_INFO_GET_DOMAIN_UNION,
>> + DWARF_INFO_GET_DOMAIN_ENUM,
>> + DWARF_INFO_GET_DOMAIN_REF,
>> + DWARF_INFO_GET_DOMAIN_STRING,
>> + DWARF_INFO_GET_DOMAIN_BASE,
>> };
>>
>> char *get_dwarf_module_name(void);
>> @@ -61,6 +69,7 @@ char *get_member_type_name(char *structname, char *membername, int cmd, long *si
>> long get_array_length(char *name01, char *name02, unsigned int cmd);
>> long get_enum_number(char *enum_name);
>> int get_source_filename(char *structname, char *src_name, int cmd);
>> +long get_domain(char *symname, int cmd, unsigned long long *die);
>> int set_dwarf_debuginfo(char *mod_name, char *os_release, char *name_debuginfo, int fd_debuginfo);
>>
>> #endif /* DWARF_INFO_H */
>> diff --git a/extension_eppic.c b/extension_eppic.c
>> index 774d16e..3fa3e88 100644
>> --- a/extension_eppic.c
>> +++ b/extension_eppic.c
>> @@ -91,7 +91,33 @@ apimember(char *mname, ull pidx, type_t *tm,
>> static int
>> apigetctype(int ctype, char *name, type_t *tout)
>> {
>> - return 0;
>> + long size = 0;
>> + unsigned long long die = 0;
>> +
>> + switch (ctype) {
>> + case V_TYPEDEF:
>> + size = get_domain(name, DWARF_INFO_GET_DOMAIN_TYPEDEF, &die);
>> + break;
>> + case V_STRUCT:
>> + size = get_domain(name, DWARF_INFO_GET_DOMAIN_STRUCT, &die);
>> + break;
>> + case V_UNION:
>> + size = get_domain(name, DWARF_INFO_GET_DOMAIN_UNION, &die);
>> + break;
>> + /* TODO
>> + * Implement for all the domains
>> + */
>> + }
>> +
>> + if (size <= 0 || !die)
>> + return 0;
>> +
>> + /* populate */
>> + eppic_type_settype(tout, ctype);
>> + eppic_type_setsize(tout, size);
>> + eppic_type_setidx(tout, (ull)(unsigned long)die);
>> + eppic_pushref(tout, 0);
>> + return 1;
>> }
>>
>> static char *
>>
>
--
Regards,
Aravinda
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-12-27 9:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 9:25 [PATCH v3 0/7] makedumpfile security key filtering with eppic Aravinda Prasad
2012-12-14 9:26 ` [PATCH v3 1/7] Initialize and setup eppic Aravinda Prasad
2012-12-20 8:45 ` Atsushi Kumagai
2012-12-27 9:19 ` Aravinda Prasad
2012-12-14 9:26 ` [PATCH v3 2/7] makedumpfile and eppic interface layer Aravinda Prasad
2012-12-14 9:26 ` [PATCH v3 3/7] Eppic call back functions to query a dump image Aravinda Prasad
2012-12-14 9:26 ` [PATCH v3 4/7] Implement apigetctype call back function Aravinda Prasad
2012-12-20 8:45 ` Atsushi Kumagai
2012-12-27 9:11 ` Aravinda Prasad [this message]
2012-12-14 9:26 ` [PATCH v3 5/7] Implement apimember and apigetrtype call back functions Aravinda Prasad
2012-12-14 9:26 ` [PATCH v3 6/7] Extend eppic built-in functions to include memset function Aravinda Prasad
2012-12-14 9:27 ` [PATCH v3 7/7] Support fully typed symbol access mode Aravinda Prasad
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=50DC10BB.7060604@linux.vnet.ibm.com \
--to=aravinda@linux.vnet.ibm.com \
--cc=LChouinard@s2sys.com \
--cc=ananth@in.ibm.com \
--cc=buendgen@de.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
--cc=mahesh@linux.vnet.ibm.com \
--cc=tachibana@mxm.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