diff options
author | Eugene Tarassov | 2017-03-01 18:16:00 +0000 |
---|---|---|
committer | Eugene Tarassov | 2017-03-01 18:16:00 +0000 |
commit | e89589ca2c5474e1f3eedef049f58521f98df3e5 (patch) | |
tree | ef03f7fa3353d01ec72ee1119d617d2a44f10545 | |
parent | 60889eedb5f354e6a263a5d6bdd19594c4614741 (diff) | |
download | org.eclipse.tcf.agent-e89589ca2c5474e1f3eedef049f58521f98df3e5.tar.gz org.eclipse.tcf.agent-e89589ca2c5474e1f3eedef049f58521f98df3e5.tar.xz org.eclipse.tcf.agent-e89589ca2c5474e1f3eedef049f58521f98df3e5.zip |
TCF Agent: fixed: elf_open() sometimes throws exception, should return NULL and errno instead
-rw-r--r-- | agent/tcf/services/tcf_elf.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c index fd544f6b..11fb7ef5 100644 --- a/agent/tcf/services/tcf_elf.c +++ b/agent/tcf/services/tcf_elf.c @@ -924,14 +924,22 @@ static ELF_File * create_elf_cache(const char * file_name) { } } if (error == 0) { - unsigned m = 0; - file->section_opd = 0; - for (m = 1; m < file->section_cnt; m++) { - ELF_Section * tbl = file->sections + m; - if (file->machine == EM_PPC64 && strcmp (tbl->name, ".opd") == 0) file->section_opd = m; - if (tbl->sym_count == 0) continue; - create_symbol_names_hash(tbl); + Trap trap; + /* unpack_elf_symbol_info() can thow exception */ + if (set_trap(&trap)) { + unsigned m = 0; + file->section_opd = 0; + for (m = 1; m < file->section_cnt; m++) { + ELF_Section * tbl = file->sections + m; + if (file->machine == EM_PPC64 && strcmp(tbl->name, ".opd") == 0) file->section_opd = m; + if (tbl->sym_count == 0) continue; + create_symbol_names_hash(tbl); + } + clear_trap(&trap); } + error = trap.error; + } + if (error == 0) { file->debug_info_file = is_debug_info_file(file); if (!file->debug_info_file) file->debug_info_file_name = get_debug_info_file_name(file, &error); if (file->debug_info_file_name) trace(LOG_ELF, "Debug info file found %s", file->debug_info_file_name); |