From ab52ca7d6e2f88f2f8c5830716abffce356b09e7 Mon Sep 17 00:00:00 2001 From: "ivan.penkov@gmail.com" Date: Thu, 19 Sep 2013 21:37:49 +0000 Subject: 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 --- src/processor/basic_source_line_resolver.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc index 6fb47b3b..799045ac 100644 --- a/src/processor/basic_source_line_resolver.cc +++ b/src/processor/basic_source_line_resolver.cc @@ -350,7 +350,7 @@ BasicSourceLineResolver::Module::ParseFunction(char *function_line) { BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( char *line_line) { - //
+ //
vector tokens; if (!Tokenize(line_line, kWhitespace, 4, &tokens)) { return NULL; @@ -360,7 +360,14 @@ BasicSourceLineResolver::Line* BasicSourceLineResolver::Module::ParseLine( uint64_t size = strtoull(tokens[1], NULL, 16); int line_number = atoi(tokens[2]); 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; } -- cgit v1.2.1