Class: Tracetool::BaseTraceParser

Inherits:
Object
  • Object
show all
Defined in:
lib/tracetool/utils/parser.rb

Overview

Base trace parser logic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry_pattern, call_pattern, build_files, convert_numbers = false) ⇒ BaseTraceParser

Returns a new instance of BaseTraceParser.



6
7
8
9
10
11
# File 'lib/tracetool/utils/parser.rb', line 6

def initialize(entry_pattern, call_pattern, build_files, convert_numbers = false)
  @build_files = build_files
  @entry_pattern = entry_pattern
  @call_pattern = call_pattern
  @convert_numbers = convert_numbers
end

Instance Attribute Details

#call_patternObject (readonly)

Returns the value of attribute call_pattern.



4
5
6
# File 'lib/tracetool/utils/parser.rb', line 4

def call_pattern
  @call_pattern
end

#entry_patternObject (readonly)

Returns the value of attribute entry_pattern.



4
5
6
# File 'lib/tracetool/utils/parser.rb', line 4

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



26
27
28
29
30
31
# File 'lib/tracetool/utils/parser.rb', line 26

def parse(lines)
  lines
    .split("\n")
    .select { |line| line_filter(line) }
    .map { |line| scan_call(scan_line(line)) }
end