SCP: Prioritize memory buffer writes over debug output

This commit is contained in:
Mark Pizzolato 2018-11-24 06:17:09 -08:00
parent 712f9c9e3a
commit 4fc7950afa

11
scp.c
View file

@ -12874,12 +12874,10 @@ if (sim_mfile || (f == sim_deb)) {
break;
}
/* Store the formatted data */
/* Store the formatted data with priority to a
memory file vs debug de-duplication*/
if (f == sim_deb) {
_sim_debug_write (buf, len);
}
else {
if (sim_mfile) {
if (sim_mfile->pos + len > sim_mfile->size) {
sim_mfile->size = sim_mfile->pos + 2 * MAX(bufsize, 512);
sim_mfile->buf = (char *)realloc (sim_mfile->buf, sim_mfile->size);
@ -12887,6 +12885,9 @@ if (sim_mfile || (f == sim_deb)) {
memcpy (sim_mfile->buf + sim_mfile->pos, buf, len);
sim_mfile->pos += len;
}
else {
_sim_debug_write (buf, len);
}
if (buf != stackbuf)
free (buf);