dwarftree 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/exe/dwarftree +5 -1
- data/lib/dwarftree/debug_info_parser.rb +12 -7
- data/lib/dwarftree/version.rb +1 -1
- data/lib/dwarftree.rb +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc07b0f8ac78b5bc79d5b961c13bd85a17f8560a1bba4de668a16c61c59b8e50
|
4
|
+
data.tar.gz: 9d065ba961225885c646be8727506011b52da34aa5921009d8f97b4e858b4723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55d33ac42c431d22105aae69c5c003923f102dead9054bf33820365126056a0125a9a46e6ea07d0ed002f7b0e7b84f2b9ffe2d3a7d56a29e1d229aabeee60a8e
|
7
|
+
data.tar.gz: 45a2501201183a1d49a211f6b9d089462c8f6899706a5066ea134fd3d3af130f61552172c81b83c29196791962bd56ec3f7b663f4755771b383563011ba13cc0
|
data/CHANGELOG.md
ADDED
data/exe/dwarftree
CHANGED
@@ -8,6 +8,7 @@ subprograms = Set.new
|
|
8
8
|
dies = Set.new
|
9
9
|
show_size = false
|
10
10
|
sort_size = false
|
11
|
+
flat = false
|
11
12
|
|
12
13
|
objects = OptionParser.new do |o|
|
13
14
|
o.banner = "Usage: #{$0} OBJECT"
|
@@ -24,8 +25,11 @@ objects = OptionParser.new do |o|
|
|
24
25
|
show_size = true
|
25
26
|
sort_size = true
|
26
27
|
end
|
28
|
+
o.on('--flat', 'Skip constructing a tree') do
|
29
|
+
flat = true
|
30
|
+
end
|
27
31
|
end.parse!(ARGV)
|
28
32
|
|
29
33
|
objects.each do |object|
|
30
|
-
Dwarftree.run(object, dies: dies, subprograms: subprograms, show_size: show_size, sort_size: sort_size)
|
34
|
+
Dwarftree.run(object, dies: dies, subprograms: subprograms, show_size: show_size, sort_size: sort_size, flat: flat)
|
31
35
|
end
|
@@ -18,7 +18,7 @@ class Dwarftree::DebugInfoParser
|
|
18
18
|
end
|
19
19
|
}
|
20
20
|
|
21
|
-
def self.parse(object)
|
21
|
+
def self.parse(object, flat:)
|
22
22
|
begin
|
23
23
|
offset_ranges = Dwarftree::DebugRangesParser.parse(object)
|
24
24
|
rescue Dwarftree::DebugRangesParser::CommandError => e
|
@@ -30,22 +30,28 @@ class Dwarftree::DebugInfoParser
|
|
30
30
|
unless $?.success?
|
31
31
|
raise CommandError.new("Failed to run: #{cmd.join(' ')}")
|
32
32
|
end
|
33
|
-
new(offset_ranges).parse(debug_info)
|
33
|
+
new(offset_ranges, flat: flat).parse(debug_info)
|
34
34
|
end
|
35
35
|
|
36
|
-
def initialize(offset_ranges)
|
36
|
+
def initialize(offset_ranges, flat:)
|
37
37
|
@offset_die = {} # { 12345 => #<Dwarftree::DIE:* ...> }
|
38
38
|
@offset_ranges = offset_ranges # { 12345 => [(12345..67890), ...] }
|
39
|
+
@flat = flat
|
39
40
|
end
|
40
41
|
|
41
42
|
# @param [String] debug_info
|
42
43
|
# @return [Array<Dwarftree::DIE::CompileUnit>]
|
43
44
|
def parse(debug_info)
|
44
|
-
|
45
|
+
nodes = []
|
45
46
|
each_compilation_unit(debug_info) do |compilation_unit|
|
46
|
-
|
47
|
+
dies = parse_compilation_unit(compilation_unit)
|
48
|
+
if @flat
|
49
|
+
nodes += dies
|
50
|
+
else
|
51
|
+
nodes << build_tree(dies)
|
52
|
+
end
|
47
53
|
end
|
48
|
-
|
54
|
+
nodes
|
49
55
|
end
|
50
56
|
|
51
57
|
private
|
@@ -74,7 +80,6 @@ class Dwarftree::DebugInfoParser
|
|
74
80
|
resolve_references(die)
|
75
81
|
die.freeze
|
76
82
|
end
|
77
|
-
build_tree(dies)
|
78
83
|
end
|
79
84
|
|
80
85
|
# @param [String] dies
|
data/lib/dwarftree/version.rb
CHANGED
data/lib/dwarftree.rb
CHANGED
@@ -8,9 +8,10 @@ module Dwarftree
|
|
8
8
|
# @param [Array<String>] subprograms
|
9
9
|
# @param [TrueClass,FalseClass] show_size
|
10
10
|
# @param [TrueClass,FalseClass] sort_size
|
11
|
-
|
11
|
+
# @param [TrueClass,FalseClass] flat
|
12
|
+
def self.run(object, dies:, subprograms:, show_size:, sort_size:, flat:)
|
12
13
|
begin
|
13
|
-
nodes = DebugInfoParser.parse(object)
|
14
|
+
nodes = DebugInfoParser.parse(object, flat: flat)
|
14
15
|
rescue DebugInfoParser::CommandError => e
|
15
16
|
abort "ERROR: #{e.message}"
|
16
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwarftree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A wrapper of `objdump --dwarf=info` to visualize a structure of inlined
|
14
14
|
subroutines
|
@@ -20,6 +20,7 @@ extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- ".gitignore"
|
23
|
+
- CHANGELOG.md
|
23
24
|
- Gemfile
|
24
25
|
- LICENSE.txt
|
25
26
|
- README.md
|