ruby-changes:33366
From: naruse <ko1@a...>
Date: Thu, 27 Mar 2014 12:02:17 +0900 (JST)
Subject: [ruby-changes:33366] naruse:r45445 (trunk): * addr2line.c (fill_lines): check shdr[i].sh_type because even if
naruse 2014-03-27 12:01:59 +0900 (Thu, 27 Mar 2014) New Revision: 45445 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45445 Log: * addr2line.c (fill_lines): check shdr[i].sh_type because even if .symtab section exists, the section's type can be SHT_NOBITS and actual data doesn't exist in the file. [Bug #9654] revert r45441. Modified files: trunk/ChangeLog trunk/addr2line.c Index: ChangeLog =================================================================== --- ChangeLog (revision 45444) +++ ChangeLog (revision 45445) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Mar 27 11:58:55 2014 NARUSE, Yui <naruse@r...> + + * addr2line.c (fill_lines): check shdr[i].sh_type because even if + .symtab section exists, the section's type can be SHT_NOBITS and + actual data doesn't exist in the file. + revert r45441. + Wed Mar 26 14:57:35 2014 NAKAMURA Usaku <usa@r...> * parse.y: inline must be static (for mswin). Index: addr2line.c =================================================================== --- addr2line.c (revision 45444) +++ addr2line.c (revision 45445) @@ -530,18 +530,28 @@ fill_lines(int num_traces, void **traces https://github.com/ruby/ruby/blob/trunk/addr2line.c#L530 #ifdef __powerpc64__ kprintf("%s:: %s: flag(%lx)\n",binary_filename,section_name,shdr[i].sh_flags); #endif - if (!strcmp(section_name, ".debug_line")) { - debug_line_shdr = shdr + i; - } else if (!strcmp(section_name, ".gnu_debuglink")) { - gnu_debuglink_shdr = shdr + i; - } else if (!strcmp(section_name, ".symtab")) { + switch (shdr[i].sh_type) { + case SHT_STRTAB: + if (!strcmp(section_name, ".strtab")) { + strtab_shdr = shdr + i; + } + break; + case SHT_SYMTAB: + /* if (!strcmp(section_name, ".symtab")) */ symtab_shdr = shdr + i; - } else if (!strcmp(section_name, ".strtab")) { - strtab_shdr = shdr + i; + break; + case SHT_PROGBITS: + if (!strcmp(section_name, ".debug_line")) { + debug_line_shdr = shdr + i; + } + else if (!strcmp(section_name, ".gnu_debuglink")) { + gnu_debuglink_shdr = shdr + i; + } + break; } } - if (check_debuglink && symtab_shdr && strtab_shdr) { + if (symtab_shdr && strtab_shdr) { char *strtab = file + strtab_shdr->sh_offset; ElfW(Sym) *symtab = (ElfW(Sym) *)(file + symtab_shdr->sh_offset); int symtab_count = (int)(symtab_shdr->sh_size / sizeof(ElfW(Sym))); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/