dwarftree 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cbf8325c9c3f5a37a6a0db7c15291ae52269ef3555e669c087f01079ca7fd6b
4
- data.tar.gz: 5ce3c1fd1da182a3747cc6fdfad54287939e8c7ae49b4788cec65a474fd4563b
3
+ metadata.gz: bc07b0f8ac78b5bc79d5b961c13bd85a17f8560a1bba4de668a16c61c59b8e50
4
+ data.tar.gz: 9d065ba961225885c646be8727506011b52da34aa5921009d8f97b4e858b4723
5
5
  SHA512:
6
- metadata.gz: b564269e0d418225f1fe2a66aa5e9a3589ec6307c47592d2bc4393f20693b8540149628445cad3c3addaa5f3f9eec270a75d5a455d41e4415eef587f691eee1c
7
- data.tar.gz: 2b94b9c633e312d751fdb9a3423f0d5359628ed3d3643978564dd1a38dbbe61225ca0c5133557956cf515ee41f78d4265f051fe28f5771f62a0130fccd4ec593
6
+ metadata.gz: 55d33ac42c431d22105aae69c5c003923f102dead9054bf33820365126056a0125a9a46e6ea07d0ed002f7b0e7b84f2b9ffe2d3a7d56a29e1d229aabeee60a8e
7
+ data.tar.gz: 45a2501201183a1d49a211f6b9d089462c8f6899706a5066ea134fd3d3af130f61552172c81b83c29196791962bd56ec3f7b663f4755771b383563011ba13cc0
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ ## v0.1.1
2
+
3
+ * Add `--flat` option
4
+
5
+ ## v0.1.0
6
+
7
+ * Initial release
8
+ * Features: `--die`, `--subprogram`, `--show-size`, `--sort-size`
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
- compile_units = []
45
+ nodes = []
45
46
  each_compilation_unit(debug_info) do |compilation_unit|
46
- compile_units << parse_compilation_unit(compilation_unit)
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
- compile_units
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
@@ -1,3 +1,3 @@
1
1
  module Dwarftree
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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
- def self.run(object, dies:, subprograms:, show_size:, sort_size:)
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.0
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 00:00:00.000000000 Z
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