Exception: Tem::SecExecError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tem/sec_exec_error.rb

Overview

raised when executing a SEC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line_info, tem_trace, buffer_state, key_state) ⇒ SecExecError

Returns a new instance of SecExecError.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tem/sec_exec_error.rb', line 7

def initialize(line_info, tem_trace, buffer_state, key_state)
  super 'SEC execution failed on the TEM'
  @line_info = line_info
  line_ip, atom, backtrace = *line_info
  @atom = atom
  if tem_trace and tem_trace[:ip]
    @ip_delta = tem_trace[:ip] - line_ip
  else
    @ip_delta = 0
  end
  @trace = tem_trace
  @buffer_state = buffer_state
  @key_state = key_state
  set_backtrace backtrace
end

Instance Attribute Details

#buffer_stateObject (readonly)

Returns the value of attribute buffer_state.



4
5
6
# File 'lib/tem/sec_exec_error.rb', line 4

def buffer_state
  @buffer_state
end

#key_stateObject (readonly)

Returns the value of attribute key_state.



4
5
6
# File 'lib/tem/sec_exec_error.rb', line 4

def key_state
  @key_state
end

#line_infoObject (readonly)

Returns the value of attribute line_info.



3
4
5
# File 'lib/tem/sec_exec_error.rb', line 3

def line_info
  @line_info
end

#traceObject (readonly)

Returns the value of attribute trace.



5
6
7
# File 'lib/tem/sec_exec_error.rb', line 5

def trace
  @trace
end

Instance Method Details

#bstat_strObject



23
24
25
26
27
28
29
# File 'lib/tem/sec_exec_error.rb', line 23

def bstat_str
  if @buffer_state.nil?
    "no buffer state available"
  else
    @buffer_state.inspect
  end
end

#inspectObject



60
61
62
# File 'lib/tem/sec_exec_error.rb', line 60

def inspect
  trace_str + "\n" + bstat_str + "\n" + kstat_str
end

#kstat_strObject



31
32
33
34
35
36
37
# File 'lib/tem/sec_exec_error.rb', line 31

def kstat_str
  if @key_state.nil?
    "no key state available"
  else
    @key_state.inspect
  end
end

#to_sObject



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tem/sec_exec_error.rb', line 47

def to_s
  string = <<ENDSTRING
SECpack execution generated an exception on the TEM

TEM Trace: #{trace_str}
TEM Buffer Status:#{bstat_str}
TEM Key Status:#{kstat_str}

TEM execution error at #{@atom}+#{@ip_delta}
ENDSTRING
  string.strip
end

#trace_strObject



39
40
41
42
43
44
45
# File 'lib/tem/sec_exec_error.rb', line 39

def trace_str
  if @trace.nil?
    "no trace available"
  else
    "ip=#{'%04x' % @trace[:ip]} sp=#{'%04x' % @trace[:sp]} out=#{'%04x' % @trace[:out]} pscell=#{'%04x' % @trace[:pscell]}"
  end
end