@@ -4,7 +4,7 @@ export ObjectHandle, SectionRef, SymbolRef, debugsections
4
4
5
5
export printfield, printentry, printfield_with_color, deref,
6
6
sectionaddress, sectionoffset, sectionsize, sectionname,
7
- load_strtab, readmeta, StrTab
7
+ load_strtab, readmeta, StrTab, symname
8
8
9
9
import Base: read, seek, readbytes, position, show
10
10
@@ -119,12 +119,17 @@ deref(section::Section) = section
119
119
abstract SymbolRef{T<: ObjectHandle }
120
120
abstract SymtabEntry{T<: ObjectHandle }
121
121
122
+ function symname
123
+ end
124
+
122
125
sectionsize (x:: SectionRef ) = sectionsize (deref (x))
123
126
sectionaddress (x:: SectionRef ) = sectionaddress (deref (x))
124
127
sectionoffset (x:: SectionRef ) = sectionoffset (deref (x))
125
128
126
129
handleT {T} (:: Union {Type{SectionRef{T}}, Type{Section{T}}, Type{SymbolRef{T}},
127
130
Type{SymtabEntry{T}}}) = T
131
+ Base. read (s:: SectionRef , args... ) = read (handle (s), args... )
132
+ Base. position (s:: SectionRef ) = position (handle (s)) - sectionoffset (s)
128
133
129
134
abstract StrTab
130
135
@@ -143,6 +148,8 @@ seek{T<:ObjectHandle,S}(oh::T, section::Section{S}) =
143
148
(@assert T <: S ; seek (oh,sectionoffset (section)))
144
149
145
150
seek (section:: SectionRef ) = seek (handle (section), deref (section))
151
+ Base. eof (section:: SectionRef ) = eof (handle (section)) ||
152
+ (position (handle (section)) >= sectionoffset (section) + sectionsize (section))
146
153
147
154
function readbytes {T<:ObjectHandle,S} (oh:: T ,sec:: Section{S} )
148
155
@assert T <: S
0 commit comments