aboutsummaryrefslogtreecommitdiff
path: root/src/google_breakpad/processor
diff options
context:
space:
mode:
authorivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-09-25 18:25:13 +0000
committerivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-09-25 18:25:13 +0000
commitbd71bdd74252585a1d567a480fa97e19884fa3fb (patch)
treef1b6ff5c0a51655d6934e57ba988313d6289e7a1 /src/google_breakpad/processor
parentFix the Android/MIPS build. (diff)
downloadbreakpad-bd71bdd74252585a1d567a480fa97e19884fa3fb.tar.xz
Adding stricter validation checks to various symbol parser functions.
More specifically, the validation of the following record types is improved: - FILE records - FUNC records - Line record - PUBLIC records Adding unittests. Review URL: https://breakpad.appspot.com/632003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1217 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/google_breakpad/processor')
-rw-r--r--src/google_breakpad/processor/basic_source_line_resolver.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/google_breakpad/processor/basic_source_line_resolver.h b/src/google_breakpad/processor/basic_source_line_resolver.h
index c1946ca4..6bb6d863 100644
--- a/src/google_breakpad/processor/basic_source_line_resolver.h
+++ b/src/google_breakpad/processor/basic_source_line_resolver.h
@@ -81,6 +81,64 @@ class BasicSourceLineResolver : public SourceLineResolverBase {
void operator=(const BasicSourceLineResolver&);
};
+// Helper class, containing useful methods for parsing of Breakpad symbol files.
+class SymbolParseHelper {
+ public:
+ // Parses a |file_line| declaration. Returns true on success.
+ // Format: FILE <id> <filename>.
+ // Notice, that this method modifies the input |file_line| which is why it
+ // can't be const. On success, <id>, and <filename> are stored in |*index|,
+ // and |*filename|. No allocation is done, |*filename| simply points inside
+ // |file_line|.
+ static bool ParseFile(char *file_line, // in
+ long *index, // out
+ char **filename); // out
+
+ // Parses a |function_line| declaration. Returns true on success.
+ // Format: FUNC <address> <size> <stack_param_size> <name>.
+ // Notice, that this method modifies the input |function_line| which is why it
+ // can't be const. On success, <address>, <size>, <stack_param_size>, and
+ // <name> are stored in |*address|, |*size|, |*stack_param_size|, and |*name|.
+ // No allocation is done, |*name| simply points inside |function_line|.
+ static bool ParseFunction(char *function_line, // in
+ uint64_t *address, // out
+ uint64_t *size, // out
+ long *stack_param_size, // out
+ char **name); // out
+
+ // Parses a |line| declaration. Returns true on success.
+ // Format: <address> <size> <line number> <source file id>
+ // Notice, that this method modifies the input |function_line| which is why
+ // it can't be const. On success, <address>, <size>, <line number>, and
+ // <source file id> are stored in |*address|, |*size|, |*line_number|, and
+ // |*source_file|.
+ static bool ParseLine(char *line_line, // in
+ uint64_t *address, // out
+ uint64_t *size, // out
+ long *line_number, // out
+ long *source_file); // out
+
+ // Parses a |public_line| declaration. Returns true on success.
+ // Format: PUBLIC <address> <stack_param_size> <name>
+ // Notice, that this method modifies the input |function_line| which is why
+ // it can't be const. On success, <address>, <stack_param_size>, <name>
+ // are stored in |*address|, |*stack_param_size|, and |*name|.
+ // No allocation is done, |*name| simply points inside |public_line|.
+ static bool ParsePublicSymbol(char *public_line, // in
+ uint64_t *address, // out
+ long *stack_param_size, // out
+ char **name); // out
+
+ private:
+ // Used for success checks after strtoull and strtol.
+ static bool IsValidAfterNumber(char *after_number);
+
+ // Only allow static methods.
+ SymbolParseHelper();
+ SymbolParseHelper(const SymbolParseHelper&);
+ void operator=(const SymbolParseHelper&);
+};
+
} // namespace google_breakpad
#endif // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__