summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-27 03:01:59 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-27 03:01:59 (GMT)
commitacc3cf5f302d8db60db7d8a5e9790d29c5c6c553 (patch)
tree3e6a75df4883c57123067a408fc517938b7aee92 /addr2line.c
parent6c27d383ddd1e416926533d16618b5886c9b49a4 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/addr2line.c b/addr2line.c
index 5b4c1ea..97dee57 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -530,18 +530,28 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
#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)));