Skip to content

Commit

Permalink
fix: NewFile config to support just filtering LCs to parse
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed May 28, 2024
1 parent c0f9138 commit 0cb5777
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ func NewFile(r io.ReaderAt, config ...FileConfig) (*File, error) {
f.objc = make(map[uint64]any)
f.swift = make(map[uint64]any)

f.vma = &types.VMAddrConverter{
Converter: f.convertToVMAddr,
VMAddr2Offet: f.getOffset,
Offet2VMAddr: f.getVMAddress,
}
f.sr = types.NewCustomSectionReader(r, f.vma, 0, 1<<63-1)
f.cr = f.sr

if config != nil {
if config[0].SectionReader != nil {
f.sr = config[0].SectionReader
Expand All @@ -142,18 +150,12 @@ func NewFile(r io.ReaderAt, config ...FileConfig) (*File, error) {
if config[0].CacheReader != nil {
f.cr = config[0].CacheReader
}
f.vma = &config[0].VMAddrConverter
if config[0].VMAddrConverter.Converter != nil {
f.vma = &config[0].VMAddrConverter
}
loadIncluding = config[0].LoadIncluding
loadExcluding = config[0].LoadExcluding
f.sharedCacheRelativeSelectorBaseVMAddress = config[0].RelativeSelectorBase
} else {
f.vma = &types.VMAddrConverter{
Converter: f.convertToVMAddr,
VMAddr2Offet: f.getOffset,
Offet2VMAddr: f.getVMAddress,
}
f.sr = types.NewCustomSectionReader(r, f.vma, 0, 1<<63-1)
f.cr = f.sr
}

// Read and decode Mach magic to determine byte order, size.
Expand Down

0 comments on commit 0cb5777

Please sign in to comment.