fix_bt.diff pasted by tilman

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<table class="sourcetable"><tr><td class="linenos"><pre> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68</pre></td><td class="code"><div class="source"><pre><span class="gh">diff --git a/kernel/common/thread.rb b/kernel/common/thread.rb</span>
index 39e52fa..25a73dc 100644
<span class="gd">--- a/kernel/common/thread.rb</span>
<span class="gi">+++ b/kernel/common/thread.rb</span>
<span class="gu">@@ -263,11 +263,13 @@ class Thread</span>
     attr_reader :ip
     attr_reader :method
     attr_reader :variables
<span class="gi">+    attr_reader :frames</span>
 
<span class="gd">-    def initialize(ip, method, variables)</span>
<span class="gi">+    def initialize(ip, method, variables, frames)</span>
       @ip = ip
       @method = method
       @variables = variables
<span class="gi">+      @frames = frames</span>
     end
 
     def file
<span class="gh">diff --git a/lib/debugger/standard_commands.rb b/lib/debugger/standard_commands.rb</span>
index 7a11c36..07bc83a 100644
<span class="gd">--- a/lib/debugger/standard_commands.rb</span>
<span class="gi">+++ b/lib/debugger/standard_commands.rb</span>
<span class="gu">@@ -478,13 +478,15 @@ class Debugger</span>
       :description =&gt; &quot;Show execution backtrace.&quot;
     
     def execute(dbg, interface, inp)
<span class="gd">-      bt = Backtrace.backtrace(interface.debug_context)</span>
<span class="gi">+      bt = Backtrace.backtrace(interface.debug_context.frames)</span>
       eval_ctxt = interface.eval_context
       output = Output.info(&quot;Backtrace:&quot;)
       output.set_columns([&#39;%*s&#39;, &#39;%|s&#39;, &#39;%-*s&#39;])
<span class="gd">-      bt.frames.each_with_index do |frame,i|</span>
<span class="gd">-        output.set_line_marker if frame == eval_ctxt</span>
<span class="gd">-        recv, loc = frame.describe, frame.location</span>
<span class="gi">+      bt.each_with_index do |location,i|</span>
<span class="gi">+        # FIXME</span>
<span class="gi">+        #output.set_line_marker if frame == eval_ctxt</span>
<span class="gi">+</span>
<span class="gi">+        recv, loc = location.describe, location.position</span>
         if i == 0
           output.set_color :green
         elsif loc =~ /kernel/
<span class="gh">diff --git a/vm/builtin/thread.cpp b/vm/builtin/thread.cpp</span>
index 85f6bb4..aa4d2c9 100644
<span class="gd">--- a/vm/builtin/thread.cpp</span>
<span class="gi">+++ b/vm/builtin/thread.cpp</span>
<span class="gu">@@ -6,6 +6,9 @@</span>
 #include &quot;builtin/symbol.hpp&quot;
 #include &quot;builtin/float.hpp&quot;
 #include &quot;builtin/channel.hpp&quot;
<span class="gi">+#include &quot;builtin/staticscope.hpp&quot;</span>
<span class="gi">+#include &quot;builtin/compiledmethod.hpp&quot;</span>
<span class="gi">+#include &quot;builtin/system.hpp&quot;</span>
 
 #include &quot;objectmemory.hpp&quot;
 #include &quot;arguments.hpp&quot;
<span class="gu">@@ -112,7 +115,9 @@ namespace rubinius {</span>
 
     cf-&gt;promote_scope(state);
 
<span class="gd">-    return Tuple::from(state, 3, Fixnum::from(cf-&gt;ip), cf-&gt;cm, cf-&gt;scope);</span>
<span class="gi">+    Array* frames = System::vm_backtrace(state, Fixnum::from(0), cf);</span>
<span class="gi">+</span>
<span class="gi">+    return Tuple::from(state, 4, Fixnum::from(cf-&gt;ip), cf-&gt;cm, cf-&gt;scope, frames);</span>
   }
 
 }
</pre></div>
</td></tr></table>