public
anonymous / typescript
Created

dmd segfault

  • Download Gist
typescript
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
Script started on Wed Jan 2 19:45:21 2013
[ % > ls
Makefile obj src
[ % > ls src/*
src/game.d
 
src/asset:
Unit.d
 
src/control:
 
src/core:
Asset.d GameState.d User.d
 
src/model:
 
src/state:
 
src/util:
FSM.d MVC.d
 
src/view:
[ % > cat src/util/MVC.d
interface MVC {
class Model {
abstract void update();
}
class View {
abstract void draw();
}
class Controller {
abstract void input();
}
}
[ % > cat src/util/MVC.d
class FSM {
class State {
abstract void enter();
abstract void exit();
abstract void reset();
}
 
class Transition {
this(ref State f, ref State t) {
from = &f;
to = &t;
}
void transition() {
from.exit();
this.outer.curr_state = to;
to.enter();
}
 
protected {
State* from, to;
}
}
 
void addState(ref State s) {
states[&s] = &s;
}
void addStartState(ref State s) {
addState(s);
start_state = &s;
}
void addAcceptState(ref State s) { addState(s); accept_states[&s] = &s;
}
 
void addTransition(ref Transition t) {
transitions[t.from][&t] = &t;
}
 
void begin() {
reset();
}
void reset() {
foreach (State* s; states) {
s.reset();
}
 
curr_state = start_state;
curr_state.enter();
}
bool accept() {
return accept_states.get(curr_state, null) != null;
}
 
protected {
State*[State*] states;
State* start_state, curr_state;
State*[State*] accept_states;
Transition*[State*][Transition*] transitions;
}
}
[ % > cat src/core/GameState.d
import util.FSM;
import util.MVC;
 
class GameState : FSM.State, MVC {
// FSM.State
override abstract void enter();
override abstract void exit();
override abstract void reset();
 
// MVC
class GameModel : MVC.Model {
override abstract void update();
}
class GameView : MVC.View {
override abstract void draw();
}
class GameController : MVC.Controller {
override abstract void input();
}
 
this(ref GameModel m, ref GameView v, ref GameController c) {
model = &m;
view = &v;
controller = &c;
}
 
protected {
GameModel* model;
GameView* view;
GameController* controller;
}
}
[ % > make
dmd -w -Isrc -g -debug -c -ofobj/asset/Unit.o src/asset/Unit.d
dmd -w -Isrc -g -debug -c -ofobj/core/Asset.o src/core/Asset.d
dmd -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
make: *** [obj/core/GameState.o] Segmentation fault: 11
[ % > gdb make
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug 5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done
 
(gdb) run
Starting program: /usr/bin/make
Reading symbols for shared libraries +........................ done
dmd -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
 
Program received signal EXC_SOFTWARE, Software generated exception.
<signal handler called>
(gdb) q
The program is running. Exit anyway? (y or n) y
error while killing target (killing anyway): assertion failure on line 219 of "/SourceCache/gdb/gdb-1822/src/gdb/macosx/macosx-nat-inferior-util.c" in function "kern_return_t macosx_inferior_suspend_mach(macosx_inferior_status *)": macosx_task_valid (s->task)
 
warning: error on line 2184 of "/SourceCache/gdb/gdb-1822/src/gdb/macosx/macosx-nat-inferior.c" in function "void macosx_kill_inferior_safe()": (os/kern) invalid argument (0x4x)
[ % > gdb dmd
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug 5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .... done
 
(gdb) run -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
Starting program: /usr/local/bin/dmd -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
Reading symbols for shared libraries +++............................................................... done
 
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001000a7e3e in Package::~Package ()
(gdb) q
The program is running. Exit anyway? (y or n) y
[ % > valgrind dmd -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
==58478== Memcheck, a memory error detector
==58478== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==58478== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==58478== Command: dmd -w -Isrc -g -debug -c -ofobj/core/GameState.o src/core/GameState.d
==58478==
==58478== Invalid read of size 8
==58478== at 0x2A4F54: bcmp (in /usr/lib/system/libsystem_c.dylib)
==58478== by 0x1000ACF3A: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x1000ACD07: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x1000AC185: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x10006E914: ComplexExp::~ComplexExp() (in /usr/local/bin/dmd)
==58478== by 0x100004893: ??? (in /usr/local/bin/dmd)
==58478== by 0x100002E1E: ??? (in /usr/local/bin/dmd)
==58478== by 0x10009E203: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x10008DEDC: Identifier::~Identifier() (in /usr/local/bin/dmd)
==58478== by 0x10009E203: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x10009C994: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x100000B81: ??? (in /usr/local/bin/dmd)
==58478== Address 0x10029cc58 is 40 bytes inside a block of size 46 alloc'd
==58478== at 0x58DE: calloc (in /usr/local/Cellar/valgrind/3.8.1/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==58478== by 0x10009D430: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x1000E410D: ArrayBase<CompoundStatement>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x1000E41E3: ArrayBase<CompoundStatement>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x100094FE7: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x1000B4A66: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x10009C270: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x100000B81: ??? (in /usr/local/bin/dmd)
==58478== by 0x100000AA0: ??? (in /usr/local/bin/dmd)
==58478== by 0x7: ???
==58478== by 0x7FFF5FBFF81A: ???
==58478== by 0x7FFF5FBFF81E: ???
==58478==
==58478== Invalid read of size 8
==58478== at 0x2A4F54: bcmp (in /usr/lib/system/libsystem_c.dylib)
==58478== by 0x1000ACF56: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x1000ACD07: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x1000AC185: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x10006E914: ComplexExp::~ComplexExp() (in /usr/local/bin/dmd)
==58478== by 0x100004893: ??? (in /usr/local/bin/dmd)
==58478== by 0x100002E1E: ??? (in /usr/local/bin/dmd)
==58478== by 0x10009E203: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x10008DEDC: Identifier::~Identifier() (in /usr/local/bin/dmd)
==58478== by 0x10009E203: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x10009C994: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x100000B81: ??? (in /usr/local/bin/dmd)
==58478== Address 0x10029cb88 is 40 bytes inside a block of size 45 alloc'd
==58478== at 0x58DE: calloc (in /usr/local/Cellar/valgrind/3.8.1/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==58478== by 0x10009D430: ArrayBase<Module>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x1000E410D: ArrayBase<CompoundStatement>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x1000E41E3: ArrayBase<CompoundStatement>::~ArrayBase() (in /usr/local/bin/dmd)
==58478== by 0x100094FE7: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x1000B4A66: Package::~Package() (in /usr/local/bin/dmd)
==58478== by 0x10009C270: VarDeclaration::operator=(VarDeclaration const&) (in /usr/local/bin/dmd)
==58478== by 0x100000B81: ??? (in /usr/local/bin/dmd)
==58478== by 0x100000AA0: ??? (in /usr/local/bin/dmd)
==58478== by 0x7: ???
==58478== by 0x7FFF5FBFF81A: ???
==58478== by 0x7FFF5FBFF81E: ???
==58478==
src/core/GameState.d(4): Error: class GameState.GameState is nested within GameState, but super class State is nested within FSM
==58478==
==58478== HEAP SUMMARY:
==58478== in use at exit: 854,103 bytes in 7,507 blocks
==58478== total heap usage: 9,361 allocs, 1,854 frees, 1,055,467 bytes allocated
==58478==
==58478== LEAK SUMMARY:
==58478== definitely lost: 90,836 bytes in 1,117 blocks
==58478== indirectly lost: 24,110 bytes in 384 blocks
==58478== possibly lost: 36,282 bytes in 700 blocks
==58478== still reachable: 702,875 bytes in 5,306 blocks
==58478== suppressed: 0 bytes in 0 blocks
==58478== Rerun with --leak-check=full to see details of leaked memory
==58478==
==58478== For counts of detected and suppressed errors, rerun with: -v
==58478== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 1 from 1)
Script done on Wed Jan 2 19:50:43 2013

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.