Class: Tracetool::BaseTraceParser
- Inherits:
-
Object
- Object
- Tracetool::BaseTraceParser
- Includes:
- StringUtils
- Defined in:
- lib/tracetool/utils/parser.rb
Overview
Base trace parser logic
Direct Known Subclasses
Android::JavaTraceParser, Android::NativeTraceParser, IOS::IOSTraceParser
Instance Attribute Summary collapse
-
#call_pattern ⇒ Object
readonly
Returns the value of attribute call_pattern.
-
#entry_pattern ⇒ Object
readonly
Returns the value of attribute entry_pattern.
Instance Method Summary collapse
-
#initialize(entry_pattern, call_pattern, build_files, convert_numbers = false) ⇒ BaseTraceParser
constructor
A new instance of BaseTraceParser.
-
#parse(lines) ⇒ Object
Parse crash dump Each line should be parsed in Hash which SHOULD or MAY contains following entries:.
Constructor Details
#initialize(entry_pattern, call_pattern, build_files, convert_numbers = false) ⇒ BaseTraceParser
Returns a new instance of BaseTraceParser.
10 11 12 13 14 15 |
# File 'lib/tracetool/utils/parser.rb', line 10 def initialize(entry_pattern, call_pattern, build_files, convert_numbers = false) @build_files = build_files @entry_pattern = entry_pattern @call_pattern = call_pattern.is_a?(Array) ? call_pattern : [call_pattern] @convert_numbers = convert_numbers end |
Instance Attribute Details
#call_pattern ⇒ Object (readonly)
Returns the value of attribute call_pattern.
8 9 10 |
# File 'lib/tracetool/utils/parser.rb', line 8 def call_pattern @call_pattern end |
#entry_pattern ⇒ Object (readonly)
Returns the value of attribute entry_pattern.
8 9 10 |
# File 'lib/tracetool/utils/parser.rb', line 8 def entry_pattern @entry_pattern end |
Instance Method Details
#parse(lines) ⇒ Object
Parse crash dump Each line should be parsed in Hash which SHOULD or MAY contains following entries:
-
SHOULD contain ‘orig` entry – original trace entry
-
MAY contain following entries IF original entry matched pattern:
** ‘frame` - stack frame index ** `lib` - shared library name (android) or module name (ios) ** `call_description` - original call block ** MAY contain `call` entry if `call_description` was recognized: *** `method` - namespaced method name (with class and its namespace) *** `file` - file path relative to `symbols dir` *** `line` - line number in specified file
30 31 32 33 34 35 |
# File 'lib/tracetool/utils/parser.rb', line 30 def parse(lines) lines .split("\n") .select { |line| line_filter(line) } .map { |line| scan_call(scan_line(line)) } end |