Skip to content

anonymous /typescript
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
dmd segfault
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.