aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/dump_symbols.cc
diff options
context:
space:
mode:
authorjimblandy@gmail.com <jimblandy@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-08-05 00:54:47 +0000
committerjimblandy@gmail.com <jimblandy@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-08-05 00:54:47 +0000
commit15117f9ae00f8c594d3529b0e04fdfa12db7a219 (patch)
tree9120d5dc7a5b5fab955379b37dcebf5c69a64831 /src/common/linux/dump_symbols.cc
parentLinux dumper: Delete non-functional stack parameter size computation. (diff)
downloadbreakpad-15117f9ae00f8c594d3529b0e04fdfa12db7a219.tar.xz
Linux dumper: Don't switch to wrong source file when starting new function.
In STABS, if one function's line number information contains an N_SOL entry to switch to a new source file, then the next function's line data should pick up in the same source file where the prior function left off. However, the Linux dumper restarts each function in the compilation unit's main source file. This patch fixes that, so that the output attributes the lines in subsequent functions to the correct source files. a=jimblandy r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@373 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/dump_symbols.cc')
-rw-r--r--src/common/linux/dump_symbols.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index f0333e3d..757da93e 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -153,6 +153,10 @@ struct SymbolInfo {
// than create FuncInfoList for such entries, we record their
// addresses here. These are not necessarily sorted.
std::vector<ElfW(Addr)> file_boundaries;
+
+ // The current source file, for line number information. This is
+ // persistent across functions.
+ SourceFileInfo *current_source_file;
};
// Stab section name.
@@ -254,10 +258,8 @@ static int LoadLineInfo(struct nlist *list,
struct FuncInfo *func_info,
const ElfW(Shdr) *stabstr_section) {
struct nlist *cur_list = list;
- // The source file to which subsequent lines belong.
- SourceFileInfo *current_source_file = source_file_info;
// The name of the file any subsequent lines would belong to.
- const char *last_source_name = current_source_file->name;
+ const char *last_source_name = symbols->current_source_file->name;
do {
// Skip non line information.
while (cur_list < list_end && cur_list->n_type != N_SLINE) {
@@ -276,9 +278,11 @@ static int LoadLineInfo(struct nlist *list,
struct LineInfo line;
while (cur_list < list_end && cur_list->n_type == N_SLINE) {
// If this line is attributed to a new file, create its entry now.
- if (last_source_name != current_source_file->name)
- current_source_file = FindSourceFileInfo(symbols, last_source_name);
- line.file = current_source_file;
+ if (last_source_name != symbols->current_source_file->name) {
+ symbols->current_source_file
+ = FindSourceFileInfo(symbols, last_source_name);
+ }
+ line.file = symbols->current_source_file;
line.rva_to_func = cur_list->n_value;
// n_desc is a signed short
line.line_num = (unsigned short)cur_list->n_desc;
@@ -466,6 +470,7 @@ static bool LoadSymbols(const ElfW(Shdr) *stab_section,
if (! source_file_info->addr)
symbols->main_files.push_back(source_file_info);
source_file_info->addr = cur_list->n_value;
+ symbols->current_source_file = source_file_info;
step = LoadFuncSymbols(cur_list, lists + nstab, symbols,
source_file_info, stabstr_section);
} else {