Reenable Break(), use a string buffer for safe formatting.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5642 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-04-03 17:35:34 +00:00
parent b5d4321a4b
commit 032c16dda4

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2002-2003 Ullrich von Bassewitz */ /* (C) 2003-2012, Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -41,7 +41,7 @@
#include "abend.h" #include "abend.h"
#include "attrib.h" #include "attrib.h"
#include "print.h" #include "print.h"
#include "xsprintf.h" #include "strbuf.h"
/* sim65 */ /* sim65 */
#include "cpuregs.h" #include "cpuregs.h"
@@ -75,7 +75,7 @@ int HaveIRQRequest = 0;
int CPUHalted = 0; int CPUHalted = 0;
/* Break message */ /* Break message */
static char BreakMsg[1024]; static StrBuf BreakMsg = STATIC_STRBUF_INITIALIZER;
@@ -2518,12 +2518,10 @@ void RESET (void)
void Break (const char* Format, ...) void Break (const char* Format, ...)
/* Stop running and display the given message */ /* Stop running and display the given message */
{ {
#if 0
va_list ap; va_list ap;
va_start (ap, Format); va_start (ap, Format);
xvsprintf (BreakMsg, sizeof (BreakMsg), Format, ap); SB_VPrintf (&BreakMsg, Format, ap);
va_end (ap); va_end (ap);
#endif
} }
@@ -2570,9 +2568,9 @@ void CPURun (void)
/* Count cycles */ /* Count cycles */
TotalCycles += Cycles; TotalCycles += Cycles;
if (BreakMsg[0]) { if (SB_GetLen (&BreakMsg) > 0) {
printf ("%s\n", BreakMsg); printf ("%.*s\n", SB_GetLen (&BreakMsg), SB_GetConstBuf (&BreakMsg));
BreakMsg[0] = '\0'; SB_Clear (&BreakMsg);
} }
} }