class Squash::Symbolicator::Symbols
An aggregation of the `Symbolicator::Symbol`s of a binary. This class is enumerable.
Public Class Methods
Creates a new empty aggregation.
# File lib/squash/symbolicator/symbols.rb, line 51 def initialize @symbols = Array.new end
Public Instance Methods
Delegated to `Array`.
# File lib/squash/symbolicator/symbols.rb, line 92 def [](*args) @symbols[*args] end
Adds a symbol definition to the aggregation.
@param [Fixnum] start_address The lowest program counter address
corresponding to this method or function.
@param [Fixnum] end_address The highest program counter address
corresponding to this method or function.
@param [String] file The path to the file where this symbol is declared. @param [Fixnum] line The line number in `file` where this symbol is
declared.
@param [String] symbol The method or function name.
# File lib/squash/symbolicator/symbols.rb, line 66 def add(start_address, end_address, file, line, symbol) index = @symbols.find_index { |sym| sym.start_address > start_address || (sym.start_address == start_address && sym.end_address >= end_address) } new_sym = Squash::Symbolicator::Symbol.new(start_address, end_address, file, line, symbol) if index @symbols.insert index, new_sym else @symbols << new_sym end end
Delegated to `Array`.
# File lib/squash/symbolicator/symbols.rb, line 94 def clear(*args) @symbols.clear(*args) end
Delegated to `Array`.
# File lib/squash/symbolicator/symbols.rb, line 90 def each(*args) @symbols.each(*args) end
Returns the `Symbolicator::Symbol` containing a given program counter address. If there are symbols with overlapping address ranges, the one with the smallest range is returned.
@param [Fixnum] address A program counter address. @return [Symbol, nil] The symbol corresponding to that address, or `nil` if
the address is not symbolicated.
# File lib/squash/symbolicator/symbols.rb, line 85 def for(address) @symbols.detect { |sym| sym.start_address <= address && sym.end_address >= address } end
@private
# File lib/squash/symbolicator/symbols.rb, line 99 def inspect() "#<#{self.class} [#{size} symbols]>" end
Delegated to `Array`.
# File lib/squash/symbolicator/symbols.rb, line 96 def size(*args) @symbols.size(*args) end