elf - Can't parse DWARF - Tricore CPU's DWARF info -


i struggling parse elf file - dwarf contents of *.elf after compilation tasking compiler infineon's tricore cpu. can't match .debug_abbrev , .debug_info, me looks contents corrupted. can guys guide me how parse .debug_info contents?

.debug_abbrev; ... 04 (code) 05 (dw_tag_compile_unit) 00 (no child) 03 08 (dw_at_name, dw_form_string) 3a 0f (dw_at_decl_file, dw_form_udata) 3b 0f (dw_at_decl_line, dw_form_udata) 39 0f (dw_at_decl_column, dw_form_udata) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end)  05 (code) 35 (dw_tag_volatile_type) 00 (no child) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end)  06 (code) 0f (dw_tag_pointer_type) 00 (no child) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end) ... 

with above .debug_abbrev contents tried parse .debug_info contents, it's weird, maybe wrong parsing made, , further parsing not match, make weird result. i guess wrong made parser cannot understand why.

.debug_info; 04 (04, code) 75 77 56 61 6c 75 65 00 (uwvalue, dw_form_string) 01 (1, dw_form_udata) 8d 01 (8d, dw_form_udata) 1f (1f, dw_form_udata) 93 00 00 00 (00000093, dw_form_ref4) 00 (end)  05 (05, code) 93 00 00 00 (00000093, dw_form_ref4) 

03 75 6e 73 69 67 6e 65 6e 73 69 67 (??? how should parse them???)
there no 06 (for matching code 06)... cannot perform parsing anymore.

for beginning part of .debug_info parsed, above point can't totally understand how need handle values. read dwarf pdf files no more detailed description found.

please guide me how should have more detailed understanding on it, thanks!

i received comments other guy - solved issue.

i made misunderstanding .debug_info should parsed below;

1st section of .debug_info match 1st section of .debug_abbrev,

2st section of .debug_info match 2st section of .debug_abbrev,

3st section of .debug_info match 3st section of .debug_abbrev,

etc...

so assumed .debug_info's sections sequential thing : 01 -> 02 -> 03 -> 04 -> ...

however found it's not true, .debug_info may have not-sequential numbers.

usually have 01 -> 02 -> 02 -> 02 -> 03 -> 04 -> 02 -> 01 -> ...

so difference reason made misunderstanding , bytes of .debug_info not match .debug_abbrev.

i hope guy needs similar thing may not confused did.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo