Make processor compatible with both old and new format INLINE/INLINE_ORIGIN

This is similar to the processor part of
https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3232838/,
but added compatibility to process both old and new format of
INLINE/INLINE_ORIGIN records in symbol file.

Old INLINE format:
INLINE <inline_nest_level> <call_site_line> <origin_id>
[<address> <size>]+
New INLINE format:
INLINE <inline_nest_level> <call_site_line> <call_site_file_id>
<origin_id> [<address> <size>]+
Old INLINE_ORIGIN format:
INLINE_ORIGIN <origin_id> <file_id> <name>
New INLINE_ORIGIN format:
INLINE_ORIGIN <origin_id> <name>

Change-Id: I555d9747bfd44a1a95113b9946dcd509b7710876
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3248433
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2021-10-29 16:20:55 -07:00 committed by Joshua Peraza
parent dfcb7b6799
commit ee2ad61263
16 changed files with 377 additions and 121 deletions

View file

@ -98,28 +98,35 @@ class SymbolParseHelper {
char** filename); // out
// Parses a |inline_origin_line| declaration. Returns true on success.
// Format: INLINE_ORIGIN <origin_id> <file_id> <name>.
// Old Format: INLINE_ORIGIN <origin_id> <file_id> <name>.
// New Format: INLINE_ORIGIN <origin_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|.
// why it can't be const. On success, <has_file_id>, <origin_id>, <file_id>
// and <name> are stored in |*has_file_id*|, |*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
bool* has_file_id, // out
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> ....
// Old Format: INLINE <inline_nest_level> <call_site_line> <origin_id>
// [<address> <size>]+
// New Format: INLINE <inline_nest_level> <call_site_line> <call_site_file_id>
// <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 .
// which is why it can't be const. On success, <has_call_site_file_id>,
// <inline_nest_level>, <call_site_line> and <origin_id> are stored in
// |*has_call_site_file_id*|, |*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
bool* has_call_site_file_id, // out
long* inline_nest_level, // out
long* call_site_line, // out
long* call_site_file_id, // out
long* origin_id, // out
std::vector<std::pair<MemAddr, MemAddr>>* ranges); // out

View file

@ -41,6 +41,7 @@
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
#include <deque>
#include <map>
#include <set>
#include <string>
@ -86,7 +87,7 @@ class SourceLineResolverBase : public SourceLineResolverInterface {
virtual bool IsModuleCorrupt(const CodeModule* module);
virtual void FillSourceLineInfo(
StackFrame* frame,
std::vector<std::unique_ptr<StackFrame>>* inlined_frames);
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);

View file

@ -34,6 +34,7 @@
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
#include <deque>
#include <memory>
#include <string>
#include <vector>
@ -98,7 +99,7 @@ class SourceLineResolverInterface {
// inlined_frames in an order from outermost frame to inner most frame.
virtual void FillSourceLineInfo(
StackFrame* frame,
std::vector<std::unique_ptr<StackFrame>>* inlined_frames) = 0;
std::deque<std::unique_ptr<StackFrame>>* inlined_frames) = 0;
// If Windows stack walking information is available covering
// FRAME's instruction address, return a WindowsFrameInfo structure

View file

@ -35,6 +35,7 @@
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
#include <deque>
#include <memory>
#include <set>
#include <string>
@ -82,7 +83,7 @@ class StackFrameSymbolizer {
const CodeModules* unloaded_modules,
const SystemInfo* system_info,
StackFrame* stack_frame,
std::vector<std::unique_ptr<StackFrame>>* inlined_frames);
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);