added an strace_parser

This commit is contained in:
Brendan McDevitt 2020-08-04 02:10:11 -05:00
parent 1d88c3cfbb
commit 7d7ffb190d
3 changed files with 18237 additions and 0 deletions

1
strace_parser/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
strace.out

18199
strace_parser/strace.out Normal file

File diff suppressed because it is too large Load diff

37
strace_parser/strace_parser.rb Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env ruby
require 'pry'
class StraceParser
SYS_CALL_MATCHER = /\A[a-zA-Z_]*\(/
attr_accessor :file_lines
def initialize(filepath)
@file_lines = File.readlines(filepath).map(&:chomp)
end
def sys_calls
@file_lines.map do |line|
matches = line.match(SYS_CALL_MATCHER)
# catch any non-sys-call-matches. maybe we can fix the regex but this is fine for now.
sys_call = matches.to_s.chomp("(") unless matches.to_s == ""
end.compact
end
def sys_call_counts
sys_calls.group_by(&:itself).map {|k,v| [k, v.count] }.sort_by {|k,v|v}.reverse
end
def open_sys_calls
end
def read_sys_calls
end
def write_sys_calls
end
end
# to test - why is my dbb-app segfaulting on my manjaro linux install?
# something to do with qt5 but lets see if we can write a better tool to help
filepath = './strace.out'
parser = StraceParser.new(filepath)
binding.pry