dwarves 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +40 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +15 -0
- data/.ruby-version +1 -0
- data/.travis.yml +9 -0
- data/.yardopts +11 -0
- data/LICENSE.txt +21 -0
- data/README.md +73 -0
- data/bin/console +9 -0
- data/bin/objdump +5 -0
- data/bin/readelf +5 -0
- data/bin/setup +7 -0
- data/dwarves.gemspec +55 -0
- data/exe/dwarves +48 -0
- data/gems.rb +5 -0
- data/lib/dwarves.rb +12 -0
- data/lib/dwarves/parser.rb +26 -0
- data/lib/dwarves/parser/4.rb +25 -0
- data/lib/dwarves/parser/4/parser.rb +158 -0
- data/lib/dwarves/parser/4/transformer.rb +12 -0
- data/lib/dwarves/parser/basic_rules.rb +73 -0
- data/lib/dwarves/version.rb +5 -0
- data/rakefile.rb +32 -0
- metadata +210 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2366429fa46c2b680724383a3feacd28b1c242f39784ea1fd2e8c19ccddec915
|
4
|
+
data.tar.gz: e323ad5108096a98bb7ea077a06b01adc1dad48f1633572e5332e72a29f1563b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86f2e24147ebc367a44ce84713fa60c11f42ac8212f6f446efbe0b98b63a1a0e43d456745b5228bc75525c51b47b9648c3235ebd4dbd37b7aa94e19b6b82c0b9
|
7
|
+
data.tar.gz: fc49913262a9fc29b4521ee494c04fc9930d12e5b3707499d39140153476345359fbd247e7809e5af6778d071cb88e50f9264a9bc0af74ac3d608d41e8abd660
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
ruby:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.4.x', '2.5.x', '2.6.x']
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v1
|
14
|
+
with:
|
15
|
+
submodules: true
|
16
|
+
|
17
|
+
- name: set up ruby
|
18
|
+
uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
|
22
|
+
- name: setup bundler
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
|
26
|
+
- name: install
|
27
|
+
run: |
|
28
|
+
./bin/setup
|
29
|
+
|
30
|
+
- name: test
|
31
|
+
run: |
|
32
|
+
bundle exec rake test
|
33
|
+
|
34
|
+
- name: lint
|
35
|
+
run: |
|
36
|
+
bundle exec rake lint
|
37
|
+
|
38
|
+
- name: doc
|
39
|
+
run: |
|
40
|
+
bundle exec rake doc
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# rubocop styles
|
2
|
+
|
3
|
+
inherit_from:
|
4
|
+
- https://raw.githubusercontent.com/jethrodaniel/dotfiles/master/home/.config/rubocop/config.yml
|
5
|
+
|
6
|
+
Metrics/BlockLength:
|
7
|
+
Exclude:
|
8
|
+
- 'spec/dwarves/parser/**/*_spec.rb'
|
9
|
+
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/dwarves/parser/*.rb'
|
13
|
+
|
14
|
+
Style/ClassAndModuleChildren:
|
15
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Mark Delk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# dwarves
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+
[](https://badge.fury.io/rb/dwarves)
|
6
|
+
|
7
|
+
DWARF parser (only the `.debug_info` section for now) using [parslet][1] and unix utilities.
|
8
|
+
|
9
|
+
Source code is avaiable under MIT license at https://github.com/jethrodaniel/dwarves.
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
## What it do
|
14
|
+
|
15
|
+
```
|
16
|
+
λ readelf --debug-dump=info spec/fixtures/c/build/example.so | dwarves | head -n 15
|
17
|
+
|
18
|
+
{
|
19
|
+
:compilation_unit_offset => "0x0"@66,
|
20
|
+
:length => "0x112"@89,
|
21
|
+
:architecture => "32-bit"@96,
|
22
|
+
:version => "4"@122,
|
23
|
+
:abbrev_offset => "0x0"@142,
|
24
|
+
:pointer_size => "8"@164,
|
25
|
+
:dies => [
|
26
|
+
{
|
27
|
+
:nesting_level => "0"@168,
|
28
|
+
:address => "b"@171,
|
29
|
+
:dw_tag_base_type => "1"@190,
|
30
|
+
:type => "DW_TAG_compile_unit"@193,
|
31
|
+
:attributes => [
|
32
|
+
...
|
33
|
+
```
|
34
|
+
|
35
|
+
## Installation
|
36
|
+
|
37
|
+
```
|
38
|
+
gem install dwarves
|
39
|
+
```
|
40
|
+
|
41
|
+
## Development
|
42
|
+
|
43
|
+
```
|
44
|
+
λ ls bin/
|
45
|
+
console objdump readelf setup
|
46
|
+
λ rake -T
|
47
|
+
rake build # Build dwarves-0.1.0.gem into the pkg directory
|
48
|
+
rake clean # Remove any temporary products
|
49
|
+
rake clobber # Remove any generated files
|
50
|
+
rake doc # Generates documentation
|
51
|
+
rake install # Build and install dwarves-0.1.0.gem into system gems
|
52
|
+
rake install:local # Build and install dwarves-0.1.0.gem into system gems without network access
|
53
|
+
rake lint # Runs the linter
|
54
|
+
rake release[remote] # Create tag v0.1.0 and build and push dwarves-0.1.0.gem to TODO: Set to 'https://rubygems.org'
|
55
|
+
rake test # Run tests
|
56
|
+
```
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jethrodaniel/dwarves.
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
65
|
+
|
66
|
+
## Resources
|
67
|
+
|
68
|
+
- http://www.dwarfstd.org/doc/Debugging%20using%20DWARF-2012.pdf
|
69
|
+
- http://dwarfstd.org/
|
70
|
+
- http://dwarfstd.org/doc/DWARF4.pdf
|
71
|
+
- http://dwarfstd.org/doc/DWARF5.pdf
|
72
|
+
|
73
|
+
[1]: https://github.com/kschiess/parslet
|
data/bin/console
ADDED
data/bin/objdump
ADDED
data/bin/readelf
ADDED
data/bin/setup
ADDED
data/dwarves.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/dwarves/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "dwarves"
|
7
|
+
spec.version = Dwarves::VERSION
|
8
|
+
spec.authors = ["Mark Delk"]
|
9
|
+
spec.email = ["jethrodaniel@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = <<~MSG
|
12
|
+
DWARF parser (only the `.debug_info` section for now).
|
13
|
+
MSG
|
14
|
+
spec.homepage = "https://github.com/jethrodaniel/dwarves"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new ">= 2.3.0"
|
17
|
+
|
18
|
+
spec.metadata = {
|
19
|
+
"allowed_push_host" => "https://rubygems.org",
|
20
|
+
"homepage_uri" => spec.homepage,
|
21
|
+
"source_code_uri" => spec.homepage
|
22
|
+
}
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released. The
|
25
|
+
# `git ls-files -z` loads the files in the RubyGem that have been added into
|
26
|
+
# git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path __dir__) do
|
28
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
29
|
+
f.match %r{^(test|spec|features)/}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
{
|
37
|
+
"awesome_print" => "~> 1.8",
|
38
|
+
"parslet" => "~> 1.8"
|
39
|
+
}.each do |gem, version|
|
40
|
+
spec.add_dependency gem, version
|
41
|
+
end
|
42
|
+
|
43
|
+
{
|
44
|
+
"bundler" => "~> 2.0",
|
45
|
+
"minitest-reporters" => "~> 1.3",
|
46
|
+
"pry" => "~> 0.12.2",
|
47
|
+
"pry-byebug" => "~> 3.7",
|
48
|
+
"pry-doc" => "~> 1.0",
|
49
|
+
"rake" => "~> 12.3",
|
50
|
+
"rubocop" => "~> 0.72.0",
|
51
|
+
"redcarpet" => "~> 3.4"
|
52
|
+
}.each do |gem, version|
|
53
|
+
spec.add_development_dependency gem, version
|
54
|
+
end
|
55
|
+
end
|
data/exe/dwarves
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
require "awesome_print"
|
7
|
+
|
8
|
+
require_relative "../lib/dwarves"
|
9
|
+
|
10
|
+
options = {
|
11
|
+
json: false,
|
12
|
+
transform: false
|
13
|
+
}
|
14
|
+
|
15
|
+
OptionParser.new do |opts|
|
16
|
+
opts.banner = <<~MSG
|
17
|
+
Usage: dwarves [options]... [file]...
|
18
|
+
MSG
|
19
|
+
|
20
|
+
opts.on "-h", "--help", "print this help" do
|
21
|
+
puts opts
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on "-v", "--version", "show the version" do
|
26
|
+
puts Dwarves::VERSION
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on "-j", "--json", "output results in JSON" do
|
31
|
+
options[:transform] = true
|
32
|
+
options[:json] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on "-t", "--transform", "transform the parser output" do
|
36
|
+
options[:transform] = true
|
37
|
+
end
|
38
|
+
end.parse!
|
39
|
+
|
40
|
+
begin
|
41
|
+
tree = Dwarves::Parser[4].new.parse ARGF.read
|
42
|
+
|
43
|
+
tree = Dwarves::Parser[4].new.apply tree if options[:transform]
|
44
|
+
|
45
|
+
ap tree, indent: 2, index: false
|
46
|
+
rescue Parslet::ParseFailed => e
|
47
|
+
puts e.parse_failure_cause.ascii_tree
|
48
|
+
end
|
data/gems.rb
ADDED
data/lib/dwarves.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dwarves/parser/basic_rules"
|
4
|
+
require "dwarves/parser/4"
|
5
|
+
|
6
|
+
module Dwarves
|
7
|
+
# Base parser, delegates the actual parsing to versioned classes.
|
8
|
+
module Parser
|
9
|
+
# A parser error
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
# Get a versioned parser.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# v4 = Dwarves::Parser[4].new
|
16
|
+
#
|
17
|
+
# @param version [Integer] which version of DWARF to use
|
18
|
+
# @return [Subclass of Dwarves::Parser] the versioned subclass
|
19
|
+
#
|
20
|
+
def self.[] version
|
21
|
+
raise Error, "Unsupported DWARF version!" unless version == 4
|
22
|
+
|
23
|
+
V4
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "parslet"
|
4
|
+
require "dwarves/parser/4/parser"
|
5
|
+
require "dwarves/parser/4/transformer"
|
6
|
+
|
7
|
+
module Dwarves
|
8
|
+
module Parser
|
9
|
+
# Parser to handle DWARF 4 format outputed by the following
|
10
|
+
#
|
11
|
+
# - `readelf --debug-dump=info`
|
12
|
+
# - `objdump --dwarf=info`
|
13
|
+
#
|
14
|
+
class V4
|
15
|
+
# @return [Hash] the parsed DWARF output
|
16
|
+
def parse input
|
17
|
+
V4Parser.new.parse input
|
18
|
+
end
|
19
|
+
|
20
|
+
def apply input
|
21
|
+
V4Transformer.new.apply input
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "parslet"
|
4
|
+
|
5
|
+
module Dwarves
|
6
|
+
module Parser
|
7
|
+
class V4Parser < Parslet::Parser
|
8
|
+
include Parser::BasicRules
|
9
|
+
|
10
|
+
# @!method root
|
11
|
+
root :input
|
12
|
+
|
13
|
+
# @!method input
|
14
|
+
#
|
15
|
+
# The entire input
|
16
|
+
rule :input do
|
17
|
+
prelude >> die.repeat.as(:dies) >> ending
|
18
|
+
end
|
19
|
+
|
20
|
+
# @!method prelude_header
|
21
|
+
#
|
22
|
+
# The very beginning of input.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# contents of the .debug_info section:
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# tmp/everything.so: file format elf64-x86-64
|
29
|
+
#
|
30
|
+
# contents of the .debug_info section:
|
31
|
+
#
|
32
|
+
rule :prelude_header do
|
33
|
+
readelf =
|
34
|
+
str("Contents of the .debug_info section:") >>
|
35
|
+
newline >>
|
36
|
+
_
|
37
|
+
|
38
|
+
objdump =
|
39
|
+
filename >> _ >> str("file format") >> _ >> format >>
|
40
|
+
newline >>
|
41
|
+
_ >> str("Contents of the .debug_info section:") >>
|
42
|
+
newline >>
|
43
|
+
_
|
44
|
+
|
45
|
+
readelf | objdump
|
46
|
+
end
|
47
|
+
|
48
|
+
# @!method prelude
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# contents of the .debug_info section:
|
53
|
+
#
|
54
|
+
# Compilation Unit @ offset 0x0:
|
55
|
+
# Length: 0xf8 (32-bit)
|
56
|
+
# Version: 4
|
57
|
+
# Abbrev Offset: 0x0
|
58
|
+
# Pointer Size: 8
|
59
|
+
#
|
60
|
+
# @todo convert numeric string results to numeric values
|
61
|
+
#
|
62
|
+
rule :prelude do
|
63
|
+
prelude_header >>
|
64
|
+
str("Compilation Unit @ offset ") >>
|
65
|
+
hexadecimal.as(:compilation_unit_offset) >> colon >>
|
66
|
+
newline >>
|
67
|
+
_ >> str("Length:") >> _ >> hexadecimal.as(:length) >> _ >>
|
68
|
+
str("(") >> arch.as(:architecture) >> str(")") >>
|
69
|
+
newline >>
|
70
|
+
_ >> str("Version:") >> _ >> integer.as(:version) >>
|
71
|
+
newline >>
|
72
|
+
_ >> str("Abbrev Offset:") >> _ >> hexadecimal.as(:abbrev_offset) >>
|
73
|
+
newline >>
|
74
|
+
_ >> str("Pointer Size:") >> _ >> integer.as(:pointer_size) >>
|
75
|
+
newline
|
76
|
+
end
|
77
|
+
|
78
|
+
# @!method arch
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# 32-bit
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# 64-bit
|
85
|
+
#
|
86
|
+
rule(:arch) { digit.repeat >> str("-bit") }
|
87
|
+
|
88
|
+
# @!method format
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# elf64-x86-64
|
92
|
+
#
|
93
|
+
rule(:format) { filename }
|
94
|
+
|
95
|
+
# @!method die_header
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
|
99
|
+
#
|
100
|
+
# @example
|
101
|
+
# <3><b8>: Abbrev Number: 0
|
102
|
+
#
|
103
|
+
rule :die_header do
|
104
|
+
_ >>
|
105
|
+
str("<") >>
|
106
|
+
integer.as(:nesting_level) >>
|
107
|
+
str(">") >>
|
108
|
+
str("<") >>
|
109
|
+
word.as(:address) >>
|
110
|
+
str(">") >>
|
111
|
+
str(": Abbrev Number: ") >>
|
112
|
+
integer.as(:dw_tag_base_type) >>
|
113
|
+
(
|
114
|
+
_ >>
|
115
|
+
str("(") >>
|
116
|
+
words.as(:type) >>
|
117
|
+
str(")")
|
118
|
+
).maybe >>
|
119
|
+
newline
|
120
|
+
end
|
121
|
+
|
122
|
+
# @!method die_body
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# <1><2d>: Abbrev Number: 2 (DW_TAG_base_type)
|
126
|
+
# <2e> DW_AT_byte_size : 4
|
127
|
+
# <2f> DW_AT_encoding : 5 (signed)
|
128
|
+
# <30> DW_AT_name : int
|
129
|
+
#
|
130
|
+
rule(:die_body) { attribute.repeat.as :attributes }
|
131
|
+
|
132
|
+
# @!method attribute
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# <30> DW_AT_name : int
|
136
|
+
#
|
137
|
+
rule :attribute do
|
138
|
+
_ >>
|
139
|
+
str("<") >>
|
140
|
+
word.as(:order) >>
|
141
|
+
str(">") >>
|
142
|
+
_ >>
|
143
|
+
word.as(:name) >>
|
144
|
+
_ >>
|
145
|
+
colon >>
|
146
|
+
_ >>
|
147
|
+
(newline.absent? >> any).repeat.as(:description) >>
|
148
|
+
newline
|
149
|
+
end
|
150
|
+
|
151
|
+
# @!method die
|
152
|
+
rule(:die) { die_header >> die_body.maybe }
|
153
|
+
|
154
|
+
# @!method ending
|
155
|
+
rule(:ending) { any.repeat }
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "parslet"
|
4
|
+
|
5
|
+
module Dwarves
|
6
|
+
module Parser
|
7
|
+
# Shared rules common to many parsers.
|
8
|
+
#
|
9
|
+
# These can be directly included in your parser class, like so
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# class SomeParser < Parslet::Parser
|
13
|
+
# include Dwarves::Parser::BasicRules
|
14
|
+
#
|
15
|
+
# # ...
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
module BasicRules
|
19
|
+
include Parslet
|
20
|
+
|
21
|
+
# @!method colon
|
22
|
+
rule(:colon) { str ":" }
|
23
|
+
|
24
|
+
# @!method space
|
25
|
+
rule(:space) { match('\s').repeat 1 }
|
26
|
+
|
27
|
+
# @!method space?
|
28
|
+
rule(:space?) { space.maybe }
|
29
|
+
|
30
|
+
# @!method newline
|
31
|
+
rule(:newline) { match('\n').repeat 1 }
|
32
|
+
|
33
|
+
# @!method newlines
|
34
|
+
rule(:newlines) { newline.repeat }
|
35
|
+
|
36
|
+
# @!method separator
|
37
|
+
rule(:separator) { space? | space }
|
38
|
+
|
39
|
+
alias _ separator
|
40
|
+
|
41
|
+
# @!method digit
|
42
|
+
rule(:digit) { match("[0-9]").repeat 1 }
|
43
|
+
|
44
|
+
# @!method integer
|
45
|
+
rule(:integer) { digit.repeat }
|
46
|
+
|
47
|
+
# @!method word
|
48
|
+
rule(:word) { match('[a-zA-Z\._0-9]').repeat 1 }
|
49
|
+
|
50
|
+
# @!method words
|
51
|
+
rule(:words) { word >> (separator >> word).repeat }
|
52
|
+
|
53
|
+
# @!method lparen
|
54
|
+
rule(:lparen) { str "(" }
|
55
|
+
|
56
|
+
# @!method rparen
|
57
|
+
rule(:rparen) { str ")" }
|
58
|
+
|
59
|
+
# @!method semicolon
|
60
|
+
rule(:semicolon) { str ";" }
|
61
|
+
|
62
|
+
# @!method hexadecimal
|
63
|
+
rule :hexadecimal do
|
64
|
+
str("0x") >> (match("[a-f]") | match("[0-9]")).repeat
|
65
|
+
end
|
66
|
+
|
67
|
+
# @!method filename
|
68
|
+
rule :filename do
|
69
|
+
match('[^\s]').repeat
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/rakefile.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rake/clean"
|
6
|
+
require "yard"
|
7
|
+
|
8
|
+
CLEAN << FileList.new("doc/*") do |list|
|
9
|
+
list.exclude /.*\.md/
|
10
|
+
list.include "tmp/*"
|
11
|
+
end
|
12
|
+
|
13
|
+
Rake::TestTask.new :test do |t|
|
14
|
+
t.libs << "lib"
|
15
|
+
t.libs << "spec"
|
16
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
17
|
+
# Supress `circular require` error messages from minitest
|
18
|
+
t.warning = false
|
19
|
+
end
|
20
|
+
|
21
|
+
task spec: :test
|
22
|
+
task default: :spec
|
23
|
+
|
24
|
+
desc "Runs the linter"
|
25
|
+
task :lint do
|
26
|
+
sh "bundle exec rubocop"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Generates documentation"
|
30
|
+
task :doc do
|
31
|
+
sh "bundle exec yard"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dwarves
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Delk
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: awesome_print
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: parslet
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.12.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.12.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-doc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '12.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '12.3'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.72.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.72.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: redcarpet
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.4'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.4'
|
153
|
+
description:
|
154
|
+
email:
|
155
|
+
- jethrodaniel@gmail.com
|
156
|
+
executables:
|
157
|
+
- dwarves
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".github/workflows/build.yml"
|
162
|
+
- ".gitignore"
|
163
|
+
- ".rubocop.yml"
|
164
|
+
- ".ruby-version"
|
165
|
+
- ".travis.yml"
|
166
|
+
- ".yardopts"
|
167
|
+
- LICENSE.txt
|
168
|
+
- README.md
|
169
|
+
- bin/console
|
170
|
+
- bin/objdump
|
171
|
+
- bin/readelf
|
172
|
+
- bin/setup
|
173
|
+
- dwarves.gemspec
|
174
|
+
- exe/dwarves
|
175
|
+
- gems.rb
|
176
|
+
- lib/dwarves.rb
|
177
|
+
- lib/dwarves/parser.rb
|
178
|
+
- lib/dwarves/parser/4.rb
|
179
|
+
- lib/dwarves/parser/4/parser.rb
|
180
|
+
- lib/dwarves/parser/4/transformer.rb
|
181
|
+
- lib/dwarves/parser/basic_rules.rb
|
182
|
+
- lib/dwarves/version.rb
|
183
|
+
- rakefile.rb
|
184
|
+
homepage: https://github.com/jethrodaniel/dwarves
|
185
|
+
licenses:
|
186
|
+
- MIT
|
187
|
+
metadata:
|
188
|
+
allowed_push_host: https://rubygems.org
|
189
|
+
homepage_uri: https://github.com/jethrodaniel/dwarves
|
190
|
+
source_code_uri: https://github.com/jethrodaniel/dwarves
|
191
|
+
post_install_message:
|
192
|
+
rdoc_options: []
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 2.3.0
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
requirements: []
|
206
|
+
rubygems_version: 3.0.3
|
207
|
+
signing_key:
|
208
|
+
specification_version: 4
|
209
|
+
summary: DWARF parser (only the `.debug_info` section for now).
|
210
|
+
test_files: []
|