Class: MrbParser::DebugSection

Inherits:
Section
  • Object
show all
Defined in:
lib/mrb_parser/debug_section.rb

Constant Summary

Constants inherited from Section

Section::BINARY_EOF, Section::DEBUG_IDENTIFIER, Section::IREP_IDENTIFIER, Section::LINENO_IDENTIFIER

Instance Attribute Summary collapse

Attributes inherited from Section

#signature, #size

Instance Method Summary collapse

Methods inherited from Section

#end?, #parse, parse

Constructor Details

#initializeDebugSection

Returns a new instance of DebugSection.



10
11
12
# File 'lib/mrb_parser/debug_section.rb', line 10

def initialize(*)
  super
end

Instance Attribute Details

#debug_infoObject

Returns the value of attribute debug_info.



7
8
9
# File 'lib/mrb_parser/debug_section.rb', line 7

def debug_info
  @debug_info
end

#filenamesObject

Returns the value of attribute filenames.



8
9
10
# File 'lib/mrb_parser/debug_section.rb', line 8

def filenames
  @filenames
end

Instance Method Details

#dumpObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mrb_parser/debug_section.rb', line 30

def dump
  printf "*** DEBUG SECTION ***\n"
  printf "secID: %s\n", @signature
  printf "size : %s\n", @size
  printf "files: %d\n", @filenames.size
  @filenames.each do |fname|
    printf "  filename: %s\n", fname
  end
  @debug_info.dump
  printf "*** ***\n"
end

#parse_body(parser) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/mrb_parser/debug_section.rb', line 20

def parse_body(parser)
  filenames_len = parser.read_uint16
  @filenames = []
  filenames_len.times do
    @filenames << parser.read_n16string
  end
  parse_record(parser)
  self
end

#parse_record(parser) ⇒ Object



14
15
16
17
18
# File 'lib/mrb_parser/debug_section.rb', line 14

def parse_record(parser)
  rec = parser.irep_section.rec
  @debug_info = MrbParser::DebugInfo.new(self, rec)
  @debug_info.parse_record(parser)
end