Class: ELFTools::Sections::Symbol
- Inherits:
-
Object
- Object
- ELFTools::Sections::Symbol
- Defined in:
- lib/elftools/sections/symbol.rb
Overview
Class of symbol.
Instance Attribute Summary collapse
-
#header ⇒ ELFTools::Structs::ELF32_sym, ELFTools::Structs::ELF64_sym
readonly
Section header.
-
#stream ⇒ #pos=, #read
readonly
Streaming object.
Instance Method Summary collapse
-
#bind ⇒ Integer
How this symbol is linked against others with the same name.
-
#bind_name ⇒ String
The name of #bind.
-
#initialize(header, stream, symstr: nil, machine: nil) ⇒ Symbol
constructor
Instantiate a Symbol object.
-
#name ⇒ String
Return the symbol name.
-
#section_index ⇒ Integer
The index of the section this symbol is defined in.
-
#type ⇒ Integer
What kind of entity this symbol refers to.
-
#type_name ⇒ String
The name of #type.
-
#visibility ⇒ Integer
How this symbol is accessed once it becomes part of an executable or shared object.
-
#visibility_name ⇒ String
The name of #visibility.
Constructor Details
#initialize(header, stream, symstr: nil, machine: nil) ⇒ Symbol
Instantiate a ELFTools::Sections::Symbol object.
22 23 24 25 26 27 |
# File 'lib/elftools/sections/symbol.rb', line 22 def initialize(header, stream, symstr: nil, machine: nil) @header = header @stream = stream @symstr = symstr @machine = machine end |
Instance Attribute Details
#header ⇒ ELFTools::Structs::ELF32_sym, ELFTools::Structs::ELF64_sym (readonly)
Returns Section header.
9 10 11 |
# File 'lib/elftools/sections/symbol.rb', line 9 def header @header end |
#stream ⇒ #pos=, #read (readonly)
Returns Streaming object.
10 11 12 |
# File 'lib/elftools/sections/symbol.rb', line 10 def stream @stream end |
Instance Method Details
#bind ⇒ Integer
How this symbol is linked against others with the same name.
The available bindings are listed in Constants::STB.
65 66 67 |
# File 'lib/elftools/sections/symbol.rb', line 65 def bind header.st_info >> 4 end |
#bind_name ⇒ String
The name of #bind.
74 75 76 |
# File 'lib/elftools/sections/symbol.rb', line 74 def bind_name Constants::STB.mapping(@machine, bind) end |
#name ⇒ String
Return the symbol name.
31 32 33 |
# File 'lib/elftools/sections/symbol.rb', line 31 def name @name ||= @symstr.call.name_at(header.st_name) end |
#section_index ⇒ Integer
The index of the section this symbol is defined in.
Values in Constants::SHN have special meanings instead of being an index.
107 108 109 |
# File 'lib/elftools/sections/symbol.rb', line 107 def section_index header.st_shndx.to_i end |
#type ⇒ Integer
What kind of entity this symbol refers to.
The available types are listed in Constants::STT.
42 43 44 |
# File 'lib/elftools/sections/symbol.rb', line 42 def type header.st_info & 0xf end |
#type_name ⇒ String
The name of #type.
A machine names types of its own, so the name is only known when the machine of the file is.
54 55 56 |
# File 'lib/elftools/sections/symbol.rb', line 54 def type_name Constants::STT.mapping(@machine, type) end |
#visibility ⇒ Integer
How this symbol is accessed once it becomes part of an executable or shared object.
The available visibilities are listed in Constants::STV.
86 87 88 |
# File 'lib/elftools/sections/symbol.rb', line 86 def visibility header.st_other & 0x3 end |
#visibility_name ⇒ String
The name of #visibility.
95 96 97 |
# File 'lib/elftools/sections/symbol.rb', line 95 def visibility_name Constants::STV.mapping(@machine, visibility) end |