Add support to process INLINE records in symbol files

This adds the support to process INLINE and INLINE_ORIGIN records in
symbol files and to generate inlined frames using those records if
possible.

Bug: 1190878
Change-Id: Ia0b6d56c9de37cf818d9bb6842d58c9b68f235b2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3024690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2021-07-22 11:13:37 -07:00 committed by Joshua Peraza
parent 32096a2dc8
commit f080350795
18 changed files with 948 additions and 363 deletions

View file

@ -40,6 +40,7 @@
#include <map>
#include <string>
#include <vector>
#include "common/using_std_string.h"
#include "google_breakpad/processor/source_line_resolver_base.h"
@ -84,6 +85,8 @@ class BasicSourceLineResolver : public SourceLineResolverBase {
// Helper class, containing useful methods for parsing of Breakpad symbol files.
class SymbolParseHelper {
public:
using MemAddr = SourceLineResolverInterface::MemAddr;
// 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
@ -94,6 +97,32 @@ class SymbolParseHelper {
long* index, // out
char** filename); // out
// Parses a |inline_origin_line| declaration. Returns true on success.
// Format: INLINE_ORIGIN <origin_id> <file_id> <name>.
// Notice, that this method modifies the input |inline_origin_line| which is
// why it can't be const. On success, <origin_id>, <file_id> and <name> are
// stored in |*origin_id|, |*file_id|, and |*name|. No allocation is
// done, |*name| simply points inside |inline_origin_line|.
static bool ParseInlineOrigin(char* inline_origin_line, // in
long* origin_id, // out
long* file_id, // out
char** name); // out
// Parses a |inline| declaration. Returns true on success.
// Format: INLINE <inline_nest_level> <call_site_line> <origin_id> <address>
// <size> ....
// Notice, that this method modifies the input |inline|
// which is why it can't be const. On success, <inline_nest_level>,
// <call_site_line> and <origin_id> are stored in |*inline_nest_level|,
// |*call_site_line|, and |*origin_id|, and all pairs of (<address>, <size>)
// are added into ranges .
static bool ParseInline(
char* inline_line, // in
long* inline_nest_level, // out
long* call_site_line, // out
long* origin_id, // out
std::vector<std::pair<MemAddr, MemAddr>>* ranges); // out
// Parses a |function_line| declaration. Returns true on success.
// Format: FUNC [<multiple>] <address> <size> <stack_param_size> <name>.
// Notice, that this method modifies the input |function_line| which is why it