mirror of https://github.com/stella-emu/stella.git
Fixed segfaults when using commands that take a filename.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@692 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
d1a7f5f75d
commit
c768b9256a
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerParser.cxx,v 1.69 2005-07-23 19:07:15 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.70 2005-07-23 21:16:57 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -1167,7 +1167,7 @@ bool DebuggerParser::saveScriptFile(string file) {
|
|||
|
||||
StringList conds = debugger->cpuDebug().m6502().getCondBreakNames();
|
||||
for(unsigned int i=0; i<conds.size(); i++)
|
||||
out << "breakif " << conds[i] << endl;
|
||||
out << "breakif {" << conds[i] << "}" << endl;
|
||||
|
||||
bool ok = out.good();
|
||||
out.close();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: YaccParser.cxx,v 1.18 2005-07-21 03:26:59 urchlay Exp $
|
||||
// $Id: YaccParser.cxx,v 1.19 2005-07-23 21:16:57 urchlay Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -77,6 +77,7 @@ const string& errorMessage() {
|
|||
|
||||
Expression *getResult() {
|
||||
return result.exp;
|
||||
lastExp = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,6 +100,7 @@ void setInput(const char *in) {
|
|||
}
|
||||
|
||||
int parse(const char *in) {
|
||||
lastExp = 0;
|
||||
errMsg = "(no error)";
|
||||
setInput(in);
|
||||
return yyparse();
|
||||
|
|
|
@ -12,8 +12,12 @@ void yyerror(char *e) {
|
|||
//fprintf(stderr, "%s at token \"%s\"\n", e, yytext);
|
||||
fprintf(stderr, "%s\n", e);
|
||||
errMsg = e;
|
||||
if(lastExp)
|
||||
|
||||
// be extra paranoid about deletion
|
||||
if(lastExp && dynamic_cast<Expression*>(lastExp))
|
||||
delete lastExp;
|
||||
|
||||
lastExp = 0;
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
@ -36,12 +36,16 @@ void yyerror(char *e) {
|
|||
//fprintf(stderr, "%s at token \"%s\"\n", e, yytext);
|
||||
fprintf(stderr, "%s\n", e);
|
||||
errMsg = e;
|
||||
if(lastExp)
|
||||
|
||||
// be extra paranoid about deletion
|
||||
if(lastExp && dynamic_cast<Expression*>(lastExp))
|
||||
delete lastExp;
|
||||
|
||||
lastExp = 0;
|
||||
}
|
||||
|
||||
|
||||
#line 21 "stella.y"
|
||||
#line 25 "stella.y"
|
||||
#ifndef YYSTYPE
|
||||
typedef union {
|
||||
int val;
|
||||
|
@ -130,10 +134,10 @@ static const short yyrhs[] =
|
|||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
{
|
||||
0, 57, 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
|
||||
0, 61, 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
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -969,139 +973,139 @@ yyreduce:
|
|||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 57 "stella.y"
|
||||
#line 61 "stella.y"
|
||||
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
|
||||
break;
|
||||
case 2:
|
||||
#line 60 "stella.y"
|
||||
#line 64 "stella.y"
|
||||
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 3:
|
||||
#line 61 "stella.y"
|
||||
#line 65 "stella.y"
|
||||
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 4:
|
||||
#line 62 "stella.y"
|
||||
#line 66 "stella.y"
|
||||
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 5:
|
||||
#line 63 "stella.y"
|
||||
#line 67 "stella.y"
|
||||
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 6:
|
||||
#line 64 "stella.y"
|
||||
#line 68 "stella.y"
|
||||
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 7:
|
||||
#line 65 "stella.y"
|
||||
#line 69 "stella.y"
|
||||
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 8:
|
||||
#line 66 "stella.y"
|
||||
#line 70 "stella.y"
|
||||
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 9:
|
||||
#line 67 "stella.y"
|
||||
#line 71 "stella.y"
|
||||
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 10:
|
||||
#line 68 "stella.y"
|
||||
#line 72 "stella.y"
|
||||
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 11:
|
||||
#line 69 "stella.y"
|
||||
#line 73 "stella.y"
|
||||
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 12:
|
||||
#line 70 "stella.y"
|
||||
#line 74 "stella.y"
|
||||
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 13:
|
||||
#line 71 "stella.y"
|
||||
#line 75 "stella.y"
|
||||
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 14:
|
||||
#line 72 "stella.y"
|
||||
#line 76 "stella.y"
|
||||
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 15:
|
||||
#line 73 "stella.y"
|
||||
#line 77 "stella.y"
|
||||
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 16:
|
||||
#line 74 "stella.y"
|
||||
#line 78 "stella.y"
|
||||
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 17:
|
||||
#line 75 "stella.y"
|
||||
#line 79 "stella.y"
|
||||
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 18:
|
||||
#line 76 "stella.y"
|
||||
#line 80 "stella.y"
|
||||
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 19:
|
||||
#line 77 "stella.y"
|
||||
#line 81 "stella.y"
|
||||
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 20:
|
||||
#line 78 "stella.y"
|
||||
#line 82 "stella.y"
|
||||
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 21:
|
||||
#line 79 "stella.y"
|
||||
#line 83 "stella.y"
|
||||
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 22:
|
||||
#line 80 "stella.y"
|
||||
#line 84 "stella.y"
|
||||
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 23:
|
||||
#line 81 "stella.y"
|
||||
#line 85 "stella.y"
|
||||
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 24:
|
||||
#line 82 "stella.y"
|
||||
#line 86 "stella.y"
|
||||
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 25:
|
||||
#line 83 "stella.y"
|
||||
#line 87 "stella.y"
|
||||
{ fprintf(stderr, " U<"); yyval.exp = new LoByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 26:
|
||||
#line 84 "stella.y"
|
||||
#line 88 "stella.y"
|
||||
{ fprintf(stderr, " U>"); yyval.exp = new HiByteExpression(yyvsp[0].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 27:
|
||||
#line 85 "stella.y"
|
||||
#line 89 "stella.y"
|
||||
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; lastExp = yyval.exp; }
|
||||
break;
|
||||
case 28:
|
||||
#line 86 "stella.y"
|
||||
#line 90 "stella.y"
|
||||
{ fprintf(stderr, " []"); yyval.exp = new ByteDerefOffsetExpression(yyvsp[-3].exp, yyvsp[-1].exp); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 29:
|
||||
#line 87 "stella.y"
|
||||
#line 91 "stella.y"
|
||||
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 30:
|
||||
#line 88 "stella.y"
|
||||
#line 92 "stella.y"
|
||||
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 31:
|
||||
#line 89 "stella.y"
|
||||
#line 93 "stella.y"
|
||||
{ fprintf(stderr, " (CpuMethod)"); yyval.exp = new CpuMethodExpression(yyvsp[0].cpuMethod); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 32:
|
||||
#line 90 "stella.y"
|
||||
#line 94 "stella.y"
|
||||
{ fprintf(stderr, " (TiaMethod)"); yyval.exp = new TiaMethodExpression(yyvsp[0].tiaMethod); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 33:
|
||||
#line 91 "stella.y"
|
||||
#line 95 "stella.y"
|
||||
{ fprintf(stderr, " (function)"); yyval.exp = new FunctionExpression(yyvsp[0].function); lastExp = yyval.exp; }
|
||||
break;
|
||||
case 34:
|
||||
#line 92 "stella.y"
|
||||
#line 96 "stella.y"
|
||||
{ fprintf(stderr, " ERR"); yyerror("Invalid label or constant"); return 1; }
|
||||
break;
|
||||
}
|
||||
|
@ -1337,5 +1341,5 @@ yyreturn:
|
|||
#endif
|
||||
return yyresult;
|
||||
}
|
||||
#line 94 "stella.y"
|
||||
#line 98 "stella.y"
|
||||
|
||||
|
|
Loading…
Reference in New Issue