From 0eb3c6e5e2846cc71a7fbcf581596f3b5b3135b6 Mon Sep 17 00:00:00 2001 From: "jimblandy@gmail.com" Date: Mon, 27 Jul 2009 21:33:25 +0000 Subject: [PATCH] Linux dumper: Correctly find boundary address when computing line and function sizes. In NextAddress, check both the file list and the function list for the nearest boundary. Don't assume that, if we find any bounding entry in the function list, that must be the nearest thing. A=jimblandy R=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@365 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/dump_symbols.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index 55680d5f..b8846e33 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -347,9 +347,6 @@ static ElfW(Addr) NextAddress( ), &func_info) ); - if (next_func_iter != sorted_functions->end()) - return (*next_func_iter)->addr; - std::vector::iterator next_file_iter = std::find_if(sorted_files->begin(), sorted_files->end(), @@ -360,10 +357,17 @@ static ElfW(Addr) NextAddress( ), &func_info) ); - if (next_file_iter != sorted_files->end()) { - return (*next_file_iter)->addr; + if (next_func_iter != sorted_functions->end()) { + if (next_file_iter != sorted_files->end()) + return std::min((*next_file_iter)->addr, (*next_func_iter)->addr); + else + return (*next_func_iter)->addr; + } else { + if (next_file_iter != sorted_files->end()) + return (*next_file_iter)->addr; + else + return 0; } - return 0; } // Add included file information.