Class: OdinFlex::MachO::LC_SYMTAB
- Defined in:
- lib/odinflex/mach-o.rb
Defined Under Namespace
Classes: NList
Constant Summary collapse
- VALUE =
0x2
- SIZE =
symoff
4 + # symoff 4 + # nsyms 4 + # stroff 4
Instance Attribute Summary collapse
-
#nlist ⇒ Object
readonly
Returns the value of attribute nlist.
-
#nsyms ⇒ Object
readonly
Returns the value of attribute nsyms.
-
#stroff ⇒ Object
readonly
Returns the value of attribute stroff.
-
#strsize ⇒ Object
readonly
Returns the value of attribute strsize.
-
#symoff ⇒ Object
readonly
Returns the value of attribute symoff.
Attributes inherited from Command
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cmd, size, symoff, nsyms, stroff, strsize, nlist) ⇒ LC_SYMTAB
constructor
A new instance of LC_SYMTAB.
- #symtab? ⇒ Boolean
Methods inherited from Command
Methods included from SectionTypes
#command?, #dysymtab?, #section?, #segment?
Constructor Details
#initialize(cmd, size, symoff, nsyms, stroff, strsize, nlist) ⇒ LC_SYMTAB
Returns a new instance of LC_SYMTAB.
322 323 324 325 326 327 328 329 |
# File 'lib/odinflex/mach-o.rb', line 322 def initialize cmd, size, symoff, nsyms, stroff, strsize, nlist super(cmd, size) @symoff = symoff @nsyms = nsyms @stroff = stroff @strsize = strsize @nlist = nlist end |
Instance Attribute Details
#nlist ⇒ Object (readonly)
Returns the value of attribute nlist.
320 321 322 |
# File 'lib/odinflex/mach-o.rb', line 320 def nlist @nlist end |
#nsyms ⇒ Object (readonly)
Returns the value of attribute nsyms.
320 321 322 |
# File 'lib/odinflex/mach-o.rb', line 320 def nsyms @nsyms end |
#stroff ⇒ Object (readonly)
Returns the value of attribute stroff.
320 321 322 |
# File 'lib/odinflex/mach-o.rb', line 320 def stroff @stroff end |
#strsize ⇒ Object (readonly)
Returns the value of attribute strsize.
320 321 322 |
# File 'lib/odinflex/mach-o.rb', line 320 def strsize @strsize end |
#symoff ⇒ Object (readonly)
Returns the value of attribute symoff.
320 321 322 |
# File 'lib/odinflex/mach-o.rb', line 320 def symoff @symoff end |
Class Method Details
.from_io(cmd, size, offset, io) ⇒ Object
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/odinflex/mach-o.rb', line 297 def self.from_io cmd, size, offset, io current = io.pos symoff, nsyms, stroff, strsize = *io.read(SIZE).unpack('L4') io.seek stroff, IO::SEEK_SET stable = io.read(strsize) io.seek symoff, IO::SEEK_SET nlist = nsyms.times.map do |i| index = io.read(4).unpack1 'L' x = stable.byteslice(index, stable.bytesize) unless x return new(cmd, size, symoff, nsyms, stroff, strsize, []) end name = x.unpack1 "Z*" NList.new(name, index, *io.read(1 + 1 + 2 + 8).unpack('CCsQ')) end new(cmd, size, symoff, nsyms, stroff, strsize, nlist) ensure io.seek current, IO::SEEK_SET end |
Instance Method Details
#symtab? ⇒ Boolean
331 |
# File 'lib/odinflex/mach-o.rb', line 331 def symtab?; true; end |