Module: Tracetool::Android::NativeTraceEnhancer

Included in:
NativeTraceScanner
Defined in:
lib/tracetool/android/native.rb

Overview

Methods for stack trace string normalization

Constant Summary collapse

NATIVE_DUMP_HEADER =

Default header for android backtrace

<<-BACKTRACE.strip_indent
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: UNKNOWN
pid: 0, tid: 0
signal 0 (UNKNOWN)
backtrace:
BACKTRACE

Instance Method Summary collapse

Instance Method Details

#add_header(string) ⇒ Object

Add dummy header for stack trace body



45
46
47
# File 'lib/tracetool/android/native.rb', line 45

def add_header(string)
  NATIVE_DUMP_HEADER + sanitize(string)
end

#unpack(trace) ⇒ Object

Converts packed stack trace into ndk-stack compatible format

Parameters:

  • trace (String)

    packed stack trace

Returns:

  • well formed stack trace



37
38
39
40
41
42
# File 'lib/tracetool/android/native.rb', line 37

def unpack(trace)
  dump_body = prepare(trace)
              .map
              .with_index { |line, index| convert_line(line, index) }
  add_header(dump_body.join("\n"))
end