Hi.
I have posted the patches to add kernel debugging information analysis
function to the partial dump command for kdump. Below is the
explanation about the source code.
Previously the size of the page structure and offsets of the members
flags, _count and mapping were hardcoded.
This patch enables "makedumpfile" command to get these information from
the debugging information in the kernel complied with "-g" option.
I have modified the source from dwarfdump command (in particular the
"-ky" option handling code) to implement this feature.
The following table shows the current status of the command. The
command doesn't operate on x86_64 now, because the address of "mem_map"
could not be found in System.map. We're trying to fix it now.
linux-2.6.15 linux-2.6.16 linux-2.6.17
i386 up OK OK OK
i386 smp OK OK OK
x86_64 up OK OK OK
x86_64 smp OK NG NG
I have several concerns about the current implementation, and would like
to hear your opinion.
Outline of added functionality:
1. Get the page structure size and the name and offset of all it's
members using the dwarfdump functionality. Check that the structure
was defined in the right source file.
2. Traverse the members until it finds "flags", "_count", and "mapping"
in the page structure.
Q1.Checking the source file of the structure;
The current implementation checks the source file name (not including
directory name) the structure was defined in. This will prevent the
command from mistakingly using other structures with the same name.
However it will result in a lower flexibility against future kernel changes.
Do you think it is better to check the source file name?
Q2.Detection of mapping;
Member "mapping" in page_struct is declared in a unnamed struct within
a unnamed union after 2.6.16, and the debugging information cannot be
searched from page_struct. The current implementation assumes that
the value of
DW_AT_data_member_location + sizeof(unsigned long)
of the first unnamed tag after _count in page_struct to be the member
"mapping". Are there a better method to find this out?
At the end the example of outputting
dwarfdump -ky vmlinux
is shown with x86_64 linux-2.6.17.4.
In the following example, the following is understood.
o The size of the page structure is 64 bytes according to DW_AT_byte_size.
o Offsets of member "flags" are 0 byte according to DW_AT_data_member_location.
Member "_count" offsets are 8 bytes.
o The file from which page structure is declared is "mm.h" according to
DW_AT_decl_file.
o Offsets of the structure including "mapping" are 16 bytes.
<1>< 9918> DW_TAG_structure_type
DW_AT_sibling <10009>
DW_AT_name page
DW_AT_byte_size 64
DW_AT_decl_file 33 include/asm-generic/memory_model.h
DW_AT_decl_line 27
<2>< 9930> DW_TAG_member
DW_AT_name flags
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 220
DW_AT_type <91>
DW_AT_data_member_location DW_OP_plus_uconst 0
<2>< 9944> DW_TAG_member
DW_AT_name _count
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 222
DW_AT_type <4454>
DW_AT_data_member_location DW_OP_plus_uconst 8
<2>< 9958> DW_TAG_member
DW_AT_name _mapcount
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 223
DW_AT_type <4454>
DW_AT_data_member_location DW_OP_plus_uconst 12
<2>< 9972> DW_TAG_member
DW_AT_type <26172>
DW_AT_data_member_location DW_OP_plus_uconst 16
<2>< 9980> DW_TAG_member
DW_AT_name index
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 248
DW_AT_type <91>
DW_AT_data_member_location DW_OP_plus_uconst 40
<2>< 9994> DW_TAG_member
DW_AT_name lru
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 249
DW_AT_type <6547>
DW_AT_data_member_location DW_OP_plus_uconst 48
<1><10009> DW_TAG_pointer_type
DW_AT_byte_size 8
DW_AT_type <9918>
<1><26172> DW_TAG_union_type
DW_AT_sibling <26192>
DW_AT_byte_size 24
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 247
<2><26180> DW_TAG_member
DW_AT_name ptl
DW_AT_decl_file 29 include/linux/mm.h
DW_AT_decl_line 245
DW_AT_type <4339>
<1><26192> DW_TAG_typedef
DW_AT_name Elf64_Addr
DW_AT_decl_file 55 include/linux/elf.h
DW_AT_decl_line 23
DW_AT_type <421>
Thanks
tachibana
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot