Handle block helper functions in Breakpad symbol parser. Block helper functions are associated with a source file but not associated with any line number. For such functions, the Breakpad symbol file contains 0 for the line numbers. Hence, 0 should be threated as valid line number. For more information on block helper functions, please, take a look at http://clang.llvm.org/docs/Block-ABI-Apple.html.

Here is the symbol parser output:

E0906 11:27:06.051507 22535 basic_source_line_resolver.cc:76] Line 380187: ParseLine failed
E0906 11:27:06.051614 22535 basic_source_line_resolver.cc:76] Line 380188: ParseLine failed
E0906 11:27:06.051648 22535 basic_source_line_resolver.cc:76] Line 380190: ParseLine failed
E0906 11:27:06.051679 22535 basic_source_line_resolver.cc:76] Line 380191: ParseLine failed
E0906 11:27:06.200814 22535 basic_source_line_resolver.cc:76] Line 446729: ParseLine failed

Here are the contents of the Breakpad symbol file:

FUNC 440d60 49 0 __copy_helper_block_
440d60 b 0 3160    <<<-----------  the third number is the line number
440d6b 3e 0 3160    <<<----------------------------   same here
FUNC 440db0 36 0 __destroy_helper_block_
440db0 a 0 3160    <<<----------------------------   same here
440dba 2c 0 3160    <<<----------------------------   same here
Review URL: https://breakpad.appspot.com/629002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1214 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2013-09-19 21:37:49 +00:00
parent 8c037de0b2
commit ab52ca7d6e

View file

@ -350,7 +350,7 @@ BasicSourceLineResolver::Module::ParseFunction(char *function_line) {
BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine(
char *line_line) { char *line_line) {
// <address> <line number> <source file id> // <address> <size> <line number> <source file id>
vector<char*> tokens; vector<char*> tokens;
if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { if (!Tokenize(line_line, kWhitespace, 4, &tokens)) {
return NULL; return NULL;
@ -360,7 +360,14 @@ BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine(
uint64_t size = strtoull(tokens[1], NULL, 16); uint64_t size = strtoull(tokens[1], NULL, 16);
int line_number = atoi(tokens[2]); int line_number = atoi(tokens[2]);
int source_file = atoi(tokens[3]); int source_file = atoi(tokens[3]);
if (line_number <= 0) {
// Valid line numbers normally start from 1, however there are functions that
// are associated with a source file but not associated with any line number
// (block helper function) and for such functions the symbol file contains 0
// for the line numbers. Hence, 0 shoud be treated as a valid line number.
// For more information on block helper functions, please, take a look at:
// http://clang.llvm.org/docs/Block-ABI-Apple.html
if (line_number < 0) {
return NULL; return NULL;
} }