Class: Tracetool::IOS::IOSTraceScanner
- Inherits:
-
Object
- Object
- Tracetool::IOS::IOSTraceScanner
- Defined in:
- lib/tracetool/ios/scanner.rb
Overview
launches atos
Instance Method Summary collapse
-
#parse(trace) ⇒ Array
Stack trace line consists of numerous whitespace separated columns.
-
#parse_line(line) ⇒ Object
Parse trace line from trace.
-
#parser(files) ⇒ Tracetool::BaseTraceParser
Create parser for current trace format.
- #process(trace, context) ⇒ Object
- #run_atos(context, trace) ⇒ Object
Instance Method Details
#parse(trace) ⇒ Array
Stack trace line consists of numerous whitespace separated columns. First three always are:
-
frame #
-
binary name
-
address
13 14 15 16 17 |
# File 'lib/tracetool/ios/scanner.rb', line 13 def parse(trace) trace.split("\n").map do |line| parse_line(line) end end |
#parse_line(line) ⇒ Object
Parse trace line from trace. Which usualy looks like this:
3 My Module Name 0x0000000102d6e9f4 My Module Name + 5859828
We need to fetch two values: ‘My Module Name’ and ‘0x0000000102d6e9f4’.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tracetool/ios/scanner.rb', line 22 def parse_line(line) parts = line.split(' ') parts.shift # Frame number, not needed module_name = '' until parts.first.start_with?('0x') module_name += parts.shift module_name += ' ' end address = parts.shift [module_name.chop, address] end |
#parser(files) ⇒ Tracetool::BaseTraceParser
Create parser for current trace format
53 54 55 |
# File 'lib/tracetool/ios/scanner.rb', line 53 def parser(files) IOSTraceParser.new(files) end |
#process(trace, context) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/tracetool/ios/scanner.rb', line 38 def process(trace, context) trace = parse(trace) desym = run_atos(context, trace.map(&:last).join(' ')) # Add useful columns to unpacked trace mix(trace, desym.split("\n")).join("\n") end |
#run_atos(context, trace) ⇒ Object
45 46 47 |
# File 'lib/tracetool/ios/scanner.rb', line 45 def run_atos(context, trace) Pipe['atos', *AtosContext.new(context).to_args] << trace end |