Class: ElfUtils::Section::DebugLine::LineNumberProgram
- Inherits:
-
Object
- Object
- ElfUtils::Section::DebugLine::LineNumberProgram
show all
- Includes:
- CTypes::Helpers
- Defined in:
- lib/elf_utils/section/debug_line/line_number_program.rb
Defined Under Namespace
Classes: Header, StateMachine
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(file:, offset:, header:, body:) ⇒ LineNumberProgram
Returns a new instance of LineNumberProgram.
5
6
7
8
9
10
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 5
def initialize(file:, offset:, header:, body:)
@file = file
@offset = offset
@header =
@body = body
end
|
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11
12
13
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 11
def body
@body
end
|
#file ⇒ Object
Returns the value of attribute file.
11
12
13
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 11
def file
@file
end
|
Returns the value of attribute header.
11
12
13
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 11
def
@header
end
|
Instance Method Details
#addr_type ⇒ Object
13
14
15
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 13
def addr_type
@header.addr_type
end
|
#address_table ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 38
def address_table
@address_table ||= begin
state = StateMachine.new(self)
state.process(body).each_with_object({}) do |entry, o|
o[entry.address] = entry.freeze
end.freeze
end
end
|
#directories ⇒ Object
22
23
24
25
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 22
def directories
unless @directories
@directories
end
|
#file_name(index) ⇒ Object
32
33
34
35
36
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 32
def file_name(index)
file_name = file_names[index]
dir = directories[file_name[:directory_index]]
File.join(dir[:path], file_name[:path])
end
|
#file_names ⇒ Object
27
28
29
30
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 27
def file_names
unless @file_names
@file_names
end
|
#source_location(addr) ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 47
def source_location(addr)
entry = address_table[addr] || return
{
file: file_name(entry.file),
line: entry.line,
column: entry.column
}
end
|
#standard_opcode_lengths ⇒ Object
17
18
19
20
|
# File 'lib/elf_utils/section/debug_line/line_number_program.rb', line 17
def standard_opcode_lengths
unless @standard_opcode_lengths
@standard_opcode_lengths
end
|