Project

odinflex

0.0
No release in over 3 years
Low commit activity in last 3 years
Do you need to parse an AR file or a Mach-O file? If so, then this is the library for you!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

OdinFlex

This is just a collection of weird tools that I wrote for dealing with some binary file formats. There is an AR parser and a MachO parser in here.

Examples

Find debugging information:

mach_o = OdinFlex::MachO.new(io)
abbrev = mach_o.find_section "__debug_abbrev"

# Do stuff with the debugging information

List all symbols in Ruby:

require "odinflex/mach-o"

File.open(RbConfig.ruby) do |f|
  my_macho = OdinFlex::MachO.new f
  my_macho.each do |section|
    if section.symtab?
      section.nlist.each { |symbol|
        p symbol
      }
    end
  end
end

Find Ruby's archive file, then read the archive:

require "odinflex/mach-o"
require "odinflex/ar"

archive = nil

File.open(RbConfig.ruby) do |f|
  my_macho = OdinFlex::MachO.new f
  my_macho.each do |section|
    if section.symtab?
      archive = section.nlist.find_all(&:archive?).map(&:archive).uniq.first
      break
    end
  end
end

File.open(archive) do |f|
  ar = OdinFlex::AR.new f
  ar.each do |object_file|
    p object_file.identifier
  end
end