makedumpfile -g with recent kernels

Stefan Bader stefan.bader at canonical.com
Mon Aug 6 03:39:53 EDT 2012


On 06.08.2012 07:54, Atsushi Kumagai wrote:
> Hello Stefan,
> 
> On Thu, 02 Aug 2012 10:23:13 +0200
> Stefan Bader <stefan.bader at canonical.com> wrote:
> 
>>>   static void
>>>   adjust_member_offset(Dwarf_Die *die)
>>>   {
>>>           long offset;
>>>
>>>           if (dwarf_info.member_offset == NOT_FOUND_STRUCTURE)     // this comparison is always true
>>>                   return;
>>>           if (!get_data_member_location(die, &offset))
>>>                   return;
>>>           dwarf_info.member_offset += offset;
>>>   }
>>>
>>> At least, the change below works fine without regression.
>>>
>>>
>>> diff --git a/dwarf_info.c b/dwarf_info.c
>>> index 583df53..03e4c90 100644
>>> --- a/dwarf_info.c
>>> +++ b/dwarf_info.c
>>> @@ -520,7 +520,9 @@ search_member(Dwarf_Die *die)
>>>                         /*
>>>                          * Get the member offset.
>>>                          */
>>> -                       if (!get_data_member_location(walker, &offset))
>>> +                       if (dwarf_tag(die) == DW_TAG_union_type)
>>
>> Hm, should that not be die_type to check what the walker is on? And in that case
>> it seems that check was made just before... So maybe it would be ok to assume 0
>> as the offset when getting here...?
> 
> As you said, the walker will be a member of union or struct when reaching here,
> because is_anonymous_container() already checked the walker.
> 
> However, get_data_member_location() must succeed if the walker is a member of struct
> while it doesn't succeed if the walker is a member of union.
> That's why I added the code to check whether the walker is a member of union or not.

Right, I was just wondering whether that would allow to simplify even more. Like
this:

       case DWARF_INFO_GET_MEMBER_OFFSET_1ST_UNION:
                if (!get_die_type(walker, &die_type))
                        continue;
                if (dwarf_tag(&die_type) != DW_TAG_union_type)
                        continue;

                /*
                 * At this point it is clear that this is a union.
                 * Though unions have no offset elements (the offset
                 * is always 0. So get_data_member_location would fail.
                 */
                 dwarf_info.member_offset = 0;
                 return TRUE;

> 
> 
> Thanks
> Atsushi Kumagai
> 
>>> +                               offset = 0;
>>> +                       else if (!get_data_member_location(walker, &offset))
>>>                                 continue;
>>>                         dwarf_info.member_offset = offset;
>>>                         return TRUE;
>>>
>>>
>>> Unless you have better way to fix this issue, I'll merge your patch into
>>> the next version with the change above.
>>>
>>> By the way, this fix enable us also to get the offset of page._mapcount and
>>> page.private, it's very helpful for the new method of free page filtering.
>>>
>>>   http://lists.infradead.org/pipermail/kexec/2012-June/006441.html
>>>
>>>
>>> Thanks
>>> Atsushi Kumagai
>>>
>>
>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20120806/5d58b75f/attachment-0001.sig>


More information about the kexec mailing list