Skip to content

Commit 625270b

Browse files
committed
Maybe fixed a bug which caused SEGFAULT when using gcDo on a -g *.ozf.
1 parent 40944fe commit 625270b

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

platform-test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ endforeach()
3333

3434
# debug folder
3535
set(DEBUG_FUNCTORS
36-
"stacktrace_line_num.oz"
36+
"stacktrace_line_num.oz" "gc.oz"
3737
)
3838
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/debug")
3939
foreach(FUNCTOR ${DEBUG_FUNCTORS})

platform-test/debug/gc.oz

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
%%%
2+
%%% Authors:
3+
%%% kennytm
4+
%%%
5+
%%% Copyright:
6+
%%% Kenny Chan, 2014
7+
%%%
8+
%%% Last change:
9+
%%% $Date$ by $Author$
10+
%%% $Revision$
11+
%%%
12+
%%% This file is part of Mozart, an implementation
13+
%%% of Oz 3
14+
%%% http://www.mozart-oz.org
15+
%%%
16+
%%% See the file "LICENSE" or
17+
%%% http://www.mozart-oz.org/LICENSE.html
18+
%%% for information on usage and redistribution
19+
%%% of this file, and for a DISCLAIMER OF ALL
20+
%%% WARRANTIES.
21+
%%%
22+
23+
functor
24+
25+
import
26+
System(gcDo)
27+
28+
export
29+
Return
30+
31+
define
32+
Return = gcDebug([
33+
gcDebugTest(proc {$}
34+
{System.gcDo}
35+
{System.gcDo} % <-- should not crash at this point.
36+
end)
37+
])
38+
39+
end
40+

vm/vm/main/emulate.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ DebugEntry::DebugEntry(GR gr, const DebugEntry& from):
7575
// StackEntry //
7676
////////////////
7777

78-
StackEntry::StackEntry(GR gr, StackEntry& from) {
78+
StackEntry::StackEntry(GR gr, StackEntry& from):
79+
debugEntry(gr, from.debugEntry)
80+
{
7981
if (from.abstraction == nullptr)
8082
abstraction = nullptr;
8183
else
@@ -92,8 +94,6 @@ StackEntry::StackEntry(GR gr, StackEntry& from) {
9294
gr->copyUnstableNode(yregs[i], from.yregs[i]);
9395
}
9496

95-
debugEntry = DebugEntry(gr, from.debugEntry);
96-
9797
// gregs and kregs are irrelevant
9898
}
9999

@@ -373,10 +373,10 @@ void Thread::run() {
373373
case OpDebugEntry:
374374
case OpDebugExit: {
375375
debugEntry.valid = true;
376-
debugEntry.file = new (vm) StableNode(vm, KPC(1));
376+
debugEntry.file = & KPC(1);
377377
debugEntry.lineNumber = IntPC(2);
378378
debugEntry.columnNumber = IntPC(3);
379-
debugEntry.kind = new (vm) StableNode(vm, KPC(4));
379+
debugEntry.kind = & KPC(4);
380380
advancePC(4);
381381
break;
382382
}

0 commit comments

Comments
 (0)