SCP: Prioritize memory buffer writes over debug output
This commit is contained in:
parent
712f9c9e3a
commit
4fc7950afa
1 changed files with 6 additions and 5 deletions
11
scp.c
11
scp.c
|
@ -12874,12 +12874,10 @@ if (sim_mfile || (f == sim_deb)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the formatted data */
|
/* Store the formatted data with priority to a
|
||||||
|
memory file vs debug de-duplication*/
|
||||||
|
|
||||||
if (f == sim_deb) {
|
if (sim_mfile) {
|
||||||
_sim_debug_write (buf, len);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (sim_mfile->pos + len > sim_mfile->size) {
|
if (sim_mfile->pos + len > sim_mfile->size) {
|
||||||
sim_mfile->size = sim_mfile->pos + 2 * MAX(bufsize, 512);
|
sim_mfile->size = sim_mfile->pos + 2 * MAX(bufsize, 512);
|
||||||
sim_mfile->buf = (char *)realloc (sim_mfile->buf, sim_mfile->size);
|
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);
|
memcpy (sim_mfile->buf + sim_mfile->pos, buf, len);
|
||||||
sim_mfile->pos += len;
|
sim_mfile->pos += len;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_sim_debug_write (buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
if (buf != stackbuf)
|
if (buf != stackbuf)
|
||||||
free (buf);
|
free (buf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue