Class: MilkTea::DAP::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/milk_tea/dap/session.rb

Overview

Holds mutable state for one DAP session.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSession

Returns a new instance of Session.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/milk_tea/dap/session.rb', line 10

def initialize
  @next_outgoing_seq = 1
  @next_breakpoint_id = 1
  @thread_id = 1
  @initialized = false
  @configuration_done = false
  @launched = false
  @terminated = false
  @should_exit = false
  @entry_stop_emitted = false
  @program_path = nil
  @runnable_path = nil
  @program_args = []
  @backend_kind = "process"
  @stop_on_entry = true
  @runtime_started = false
  @breakpoints_by_source = {}
  @function_breakpoints = []
  @exception_breakpoints = nil
end

Instance Attribute Details

#backend_kindObject (readonly)

Returns the value of attribute backend_kind.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def backend_kind
  @backend_kind
end

#exception_breakpointsObject (readonly)

Returns the value of attribute exception_breakpoints.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def exception_breakpoints
  @exception_breakpoints
end

#function_breakpointsObject (readonly)

Returns the value of attribute function_breakpoints.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def function_breakpoints
  @function_breakpoints
end

#program_argsObject (readonly)

Returns the value of attribute program_args.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def program_args
  @program_args
end

#program_pathObject (readonly)

Returns the value of attribute program_path.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def program_path
  @program_path
end

#runnable_pathObject (readonly)

Returns the value of attribute runnable_path.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def runnable_path
  @runnable_path
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



7
8
9
# File 'lib/milk_tea/dap/session.rb', line 7

def thread_id
  @thread_id
end

Instance Method Details

#configuration_done!Object



45
46
47
# File 'lib/milk_tea/dap/session.rb', line 45

def configuration_done!
  @configuration_done = true
end

#configuration_done?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/milk_tea/dap/session.rb', line 49

def configuration_done?
  @configuration_done
end

#each_breakpoint_sourceObject



131
132
133
134
135
# File 'lib/milk_tea/dap/session.rb', line 131

def each_breakpoint_source
  @breakpoints_by_source.each do |source_path, breakpoints|
    yield(source_path, breakpoints)
  end
end

#entry_stop_emitted?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/milk_tea/dap/session.rb', line 73

def entry_stop_emitted?
  @entry_stop_emitted
end

#initialize!Object



37
38
39
# File 'lib/milk_tea/dap/session.rb', line 37

def initialize!
  @initialized = true
end

#initialized?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/milk_tea/dap/session.rb', line 41

def initialized?
  @initialized
end

#launch!Object



61
62
63
# File 'lib/milk_tea/dap/session.rb', line 61

def launch!
  @launched = true
end

#launched?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/milk_tea/dap/session.rb', line 65

def launched?
  @launched
end

#mark_entry_stop_emitted!Object



77
78
79
# File 'lib/milk_tea/dap/session.rb', line 77

def mark_entry_stop_emitted!
  @entry_stop_emitted = true
end

#mark_runtime_started!Object



81
82
83
# File 'lib/milk_tea/dap/session.rb', line 81

def mark_runtime_started!
  @runtime_started = true
end

#next_seqObject



31
32
33
34
35
# File 'lib/milk_tea/dap/session.rb', line 31

def next_seq
  seq = @next_outgoing_seq
  @next_outgoing_seq += 1
  seq
end

#request_exit!Object



97
98
99
# File 'lib/milk_tea/dap/session.rb', line 97

def request_exit!
  @should_exit = true
end

#request_start!(program_path:, runnable_path:, program_args: [], stop_on_entry: true, backend_kind: "process") ⇒ Object



53
54
55
56
57
58
59
# File 'lib/milk_tea/dap/session.rb', line 53

def request_start!(program_path:, runnable_path:, program_args: [], stop_on_entry: true, backend_kind: "process")
  @program_path = program_path
  @runnable_path = runnable_path
  @program_args = Array(program_args).map(&:to_s)
  @backend_kind = backend_kind
  @stop_on_entry = stop_on_entry
end

#runtime_started?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/milk_tea/dap/session.rb', line 85

def runtime_started?
  @runtime_started
end

#set_breakpoints(source_path, breakpoints) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/milk_tea/dap/session.rb', line 105

def set_breakpoints(source_path, breakpoints)
  normalized = breakpoints.map do |bp|
    raw = normalize_dap_hash(bp)
    raw["id"] = next_breakpoint_id
    raw["verified"] = true
    raw["line"] = raw["line"].to_i
    raw
  end
  @breakpoints_by_source[source_path] = normalized
  normalized
end

#set_exception_breakpoints(arguments) ⇒ Object



127
128
129
# File 'lib/milk_tea/dap/session.rb', line 127

def set_exception_breakpoints(arguments)
  @exception_breakpoints = normalize_dap_hash(arguments)
end

#set_function_breakpoints(breakpoints) ⇒ Object



117
118
119
120
121
122
123
124
125
# File 'lib/milk_tea/dap/session.rb', line 117

def set_function_breakpoints(breakpoints)
  @function_breakpoints = breakpoints.map do |bp|
    raw = normalize_dap_hash(bp)
    raw["id"] = next_breakpoint_id
    raw["verified"] = true
    raw["name"] = raw["name"].to_s
    raw
  end
end

#should_exit?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/milk_tea/dap/session.rb', line 101

def should_exit?
  @should_exit
end

#stop_on_entry?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/milk_tea/dap/session.rb', line 69

def stop_on_entry?
  @stop_on_entry
end

#terminate!Object



89
90
91
# File 'lib/milk_tea/dap/session.rb', line 89

def terminate!
  @terminated = true
end

#terminated?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/milk_tea/dap/session.rb', line 93

def terminated?
  @terminated
end