Class: Dwarves::Parser::V4Parser
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- Dwarves::Parser::V4Parser
show all
- Includes:
- BasicRules
- Defined in:
- lib/dwarves/parser/4/parser.rb
Instance Method Summary
collapse
Methods included from BasicRules
#colon, #digit, #filename, #hexadecimal, #integer, #lparen, #newline, #newlines, #rparen, #semicolon, #separator, #space, #space?, #word, #words
Instance Method Details
#arch ⇒ Object
86
|
# File 'lib/dwarves/parser/4/parser.rb', line 86
rule(:arch) { digit.repeat >> str("-bit") }
|
#attribute ⇒ Object
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/dwarves/parser/4/parser.rb', line 137
rule :attribute do
_ >>
str("<") >>
word.as(:address) >>
str(">") >>
_ >>
word.as(:name) >>
_ >>
colon >>
_ >>
(newline.absent? >> any).repeat.as(:description) >>
newline
end
|
#die ⇒ Object
152
|
# File 'lib/dwarves/parser/4/parser.rb', line 152
rule(:die) { >> die_body.maybe }
|
#die_body ⇒ Object
130
|
# File 'lib/dwarves/parser/4/parser.rb', line 130
rule(:die_body) { attribute.repeat.as :attributes }
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/dwarves/parser/4/parser.rb', line 103
rule :die_header do
_ >>
str("<") >>
integer.as(:depth) >>
str(">") >>
str("<") >>
word.as(:address) >>
str(">") >>
str(": Abbrev Number: ") >>
integer.as(:abbrev_number) >>
(
_ >>
str("(") >>
words.as(:type) >>
str(")")
).maybe >>
newline
end
|
#ending ⇒ Object
155
|
# File 'lib/dwarves/parser/4/parser.rb', line 155
rule(:ending) { any.repeat }
|
93
|
# File 'lib/dwarves/parser/4/parser.rb', line 93
rule(:format) { filename }
|
16
17
18
|
# File 'lib/dwarves/parser/4/parser.rb', line 16
rule :input do
prelude >> die.repeat.as(:dies) >> ending
end
|
#prelude ⇒ Object
TODO:
convert numeric string results to numeric values
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/dwarves/parser/4/parser.rb', line 62
rule :prelude do
>>
str("Compilation Unit @ offset ") >>
hexadecimal.as(:compilation_unit_offset) >> colon >>
newline >>
_ >> str("Length:") >> _ >> hexadecimal.as(:length) >> _ >>
str("(") >> arch.as(:architecture) >> str(")") >>
newline >>
_ >> str("Version:") >> _ >> integer.as(:version) >>
newline >>
_ >> str("Abbrev Offset:") >> _ >> hexadecimal.as(:abbrev_offset) >>
newline >>
_ >> str("Pointer Size:") >> _ >> integer.as(:pointer_size) >>
newline
end
|
The very beginning of input.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/dwarves/parser/4/parser.rb', line 32
rule :prelude_header do
readelf =
str("Contents of the .debug_info section:") >>
newline >>
_
objdump =
filename >> _ >> str("file format") >> _ >> format >>
newline >>
_ >> str("Contents of the .debug_info section:") >>
newline >>
_
readelf | objdump
end
|
#root ⇒ Object
11
|
# File 'lib/dwarves/parser/4/parser.rb', line 11
root :input
|