Skip to content

Commit a6adc86

Browse files
committed
Move DWARF support to DWARF.jl
1 parent 77c1f9d commit a6adc86

File tree

1 file changed

+1
-65
lines changed

1 file changed

+1
-65
lines changed

src/ObjFileBase.jl

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export ObjectHandle, SectionRef, SymbolRef, debugsections
44

55
export printfield, printentry, printfield_with_color, deref,
66
sectionaddress, sectionoffset, sectionsize, sectionname,
7-
load_strtab
7+
load_strtab, readmeta
88

99
import Base: read, seek, readbytes, position, show
1010

@@ -148,70 +148,6 @@ function readbytes{T<:ObjectHandle,S}(oh::T,sec::Section{S})
148148
end
149149
readbytes(sec::SectionRef) = readbytes(handle(sec),deref(sec))
150150

151-
# # # DWARF support
152-
#
153-
# Whether or not this is the right place to put this is up for debate, but
154-
# this way, DWARF does not need to be concerned with the specific notion of
155-
# being embedded in an object file.
156-
#
157-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
158-
159-
using DWARF
160-
161-
function read{T<:ObjectHandle,S}(oh::T,sec::Section{S},::Type{DWARF.ARTable})
162-
@assert T <: S
163-
seek(oh, sec)
164-
ret = DWARF.ARTable(Array(DWARF.ARTableSet,0))
165-
while position(oh) < sectionoffset(sec) + sectionsize(sec)
166-
push!(ret.sets, read(oh, DWARF.ARTableSet, endianness(oh)))
167-
end
168-
ret
169-
end
170-
171-
function read{T<:ObjectHandle,S}(oh::T,sec::Section{S},::Type{DWARF.PUBTable})
172-
@assert T <: S
173-
seek(oh, sec)
174-
ret = DWARF.PUBTable(Array(DWARF.PUBTableSet,0))
175-
while position(oh) < sectionoffset(sec) + sectionsize(sec)
176-
push!(ret.sets,read(oh,DWARF.PUBTableSet, endianness(oh)))
177-
end
178-
ret
179-
end
180-
181-
function read{T<:ObjectHandle,S}(oh::T, sec::Section{S},
182-
::Type{DWARF.AbbrevTableSet})
183-
@assert T <: S
184-
seek(oh, sec)
185-
read(oh, AbbrevTableSet, endianness(oh))
186-
end
187-
188-
function read{T<:ObjectHandle,S}(oh::T,debug_info::Section{S},
189-
s::DWARF.PUBTableSet,::Type{DWARF.DWARFCUHeader})
190-
@assert T <: S
191-
seek(oh,sectionoffset(debug_info)+s.header.debug_info_offset)
192-
read(oh,DWARF.DWARFCUHeader, endianness(oh))
193-
end
194-
195-
function read{T<:ObjectHandle,S}(oh::T, debug_info::Section{S}, s::DWARF.DWARFCUHeader,
196-
::Type{DWARF.AbbrevTableSet})
197-
@assert T <: S
198-
seek(oh,sectionoffset(debug_info)+s.debug_abbrev_offset)
199-
read(oh,DWARF.AbbrevTableSet, endianness(oh))
200-
end
201-
202-
function read{T<:ObjectHandle,S}(oh::T,
203-
debug_info::Section{S}, debug_abbrev::Section{S},
204-
s::DWARF.PUBTableSet, e::DWARF.PUBTableEntry,
205-
header::DWARF.DWARFCUHeader, ::Type{DWARF.DIETree})
206-
207-
@assert T <: S
208-
ats = read(oh,debug_abbrev,header,DWARF.AbbrevTableSet)
209-
seek(oh,sectionoffset(debug_info)+s.header.debug_info_offset+e.offset)
210-
ret = DWARF.DIETree(Array(DWARF.DIETreeNode,0))
211-
read(oh,header,ats,ret,DWARF.DIETreeNode,:LittleEndian)
212-
ret
213-
end
214-
215151
typealias Maybe{T} Union(T,Nothing)
216152

217153
# # # Higher level debug info support

0 commit comments

Comments
 (0)