Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/cgcv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ unsigned cv4_typidx(type *t)
{
// This is a hack to duplicate bugs in VC, so that the VC
// debugger will work.
tymnext = t->Tnext->Tty;
tymnext = t->Tnext ? t->Tnext->Tty : 0;
if (tymnext & (mTYconst | mTYimmutable | mTYvolatile) &&
!tycv &&
tyarithmetic(tymnext) &&
Expand Down
6 changes: 5 additions & 1 deletion src/mars.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,12 @@ int tryMain(size_t argc, const char *argv[])
global.params.map = true;
else if (strcmp(p + 1, "multiobj") == 0)
global.params.multiobj = true;
else if (strcmp(p + 1, "g") == 0)
else if (strcmp(p + 1, "g") == 0 || strcmp(p + 1, "g1") == 0)
global.params.symdebug = 1;
else if (strcmp(p + 1, "g2") == 0)
{ global.params.symdebug = 1;
global.params.symdebugref = 1;
}
else if (strcmp(p + 1, "gc") == 0)
global.params.symdebug = 2;
else if (strcmp(p + 1, "gs") == 0)
Expand Down
1 change: 1 addition & 0 deletions src/mars.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct Param
char vgc; // identify gc usage
bool vfield; // identify non-mutable field variables
char symdebug; // insert debug symbolic information
bool symdebugref; // insert debug symbolic information for referenced classes/structs/enums
bool alwaysframe; // always emit standard stack frame
bool optimize; // run optimizer
bool map; // generate linker .map file
Expand Down
16 changes: 16 additions & 0 deletions src/toctype.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void slist_add(Symbol *s);
void slist_reset();
unsigned totym(Type *tx);

void toDebug(TypedefDeclaration *tdd);
void toDebug(EnumDeclaration *ed);
void toDebug(StructDeclaration *sd);
void toDebug(ClassDeclaration *cd);

/***************************************
* Convert from D type to C type.
* This is done so C debug info can be generated.
Expand Down Expand Up @@ -160,6 +165,9 @@ class ToCtypeVisitor : public Visitor
}
}

if (global.params.symdebugref)
toDebug(t->sym);

//printf("t = %p, Tflags = x%x\n", ctype, ctype->Tflags);
}

Expand Down Expand Up @@ -211,13 +219,19 @@ class ToCtypeVisitor : public Visitor
{
t->ctype = Type_toCtype(t->sym->memtype);
}

if (global.params.symdebugref)
toDebug(t->sym);

//printf("t = %p, Tflags = x%x\n", t, t->Tflags);
}

void visit(TypeTypedef *t)
{
t->ctype = Type_toCtype(t->sym->basetype);

if (global.params.symdebugref)
toDebug(t->sym);
}

void visit(TypeClass *t)
Expand All @@ -243,6 +257,8 @@ class ToCtypeVisitor : public Visitor
symbol_struct_addField(tc->Ttag, v->ident->toChars(), Type_toCtype(v->type), v->offset);
}
}
if (global.params.symdebugref)
toDebug(t->sym);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/tocvdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ unsigned cv4_Denum(EnumDeclaration *e)
{
//dbg_printf("cv4_Denum(%s)\n", e->toChars());
unsigned property = 0;
if (!e->members || !e->memtype || !e->memtype->isintegral())
if (!e->members || !e->memtype || !e->memtype->isintegral())
property |= 0x80; // enum is forward referenced or non-integer

// Compute the number of fields, and the length of the fieldlist record
Expand Down
21 changes: 16 additions & 5 deletions src/toobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void ClassDeclaration_toDt(ClassDeclaration *cd, dt_t **pdt);
void StructDeclaration_toDt(StructDeclaration *sd, dt_t **pdt);
Symbol *toSymbol(Dsymbol *s);

type *Type_toCtype(Type *t);
void toDebug(TypedefDeclaration *tdd);
void toDebug(EnumDeclaration *ed);
void toDebug(StructDeclaration *sd);
Expand Down Expand Up @@ -230,7 +231,9 @@ void ClassDeclaration::toObjFile(bool multiobj)
return;
}

if (global.params.symdebug)
if (global.params.symdebugref)
Type_toCtype(type); // calls toDebug() only once
else if (global.params.symdebug)
toDebug(this);

assert(!scope); // semantic() should have been run to completion
Expand Down Expand Up @@ -670,7 +673,9 @@ void InterfaceDeclaration::toObjFile(bool multiobj)
if (!members)
return;

if (global.params.symdebug)
if (global.params.symdebugref)
Type_toCtype(type); // calls toDebug() only once
else if (global.params.symdebug)
toDebug(this);

scclass = SCglobal;
Expand Down Expand Up @@ -849,7 +854,9 @@ void StructDeclaration::toObjFile(bool multiobj)
// do not output forward referenced structs's
if (!isAnonymous() && members)
{
if (global.params.symdebug)
if (global.params.symdebugref)
Type_toCtype(type); // calls toDebug() only once
else if (global.params.symdebug)
toDebug(this);

type->genTypeInfo(NULL);
Expand Down Expand Up @@ -1020,7 +1027,9 @@ void TypedefDeclaration::toObjFile(bool multiobj)
return;
}

if (global.params.symdebug)
if (global.params.symdebugref)
Type_toCtype(type); // calls toDebug() only once
else if (global.params.symdebug)
toDebug(this);

type->genTypeInfo(NULL);
Expand Down Expand Up @@ -1060,7 +1069,9 @@ void EnumDeclaration::toObjFile(bool multiobj)
if (isAnonymous())
return;

if (global.params.symdebug)
if (global.params.symdebugref)
Type_toCtype(type); // calls toDebug() only once
else if (global.params.symdebug)
toDebug(this);

type->genTypeInfo(NULL);
Expand Down