mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 12:51:04 +00:00
when using -trace in qcvm: print a newline after every print that doesn't end in a newline, so that the next disassembled instruction doesn't appear mid-text
This commit is contained in:
parent
be18550b02
commit
aa314ed147
1 changed files with 10 additions and 1 deletions
11
exec.c
11
exec.c
|
@ -562,9 +562,11 @@ static qcint prog_leavefunction(qc_program *prog)
|
||||||
bool prog_exec(qc_program *prog, prog_section_function *func, size_t flags, long maxjumps)
|
bool prog_exec(qc_program *prog, prog_section_function *func, size_t flags, long maxjumps)
|
||||||
{
|
{
|
||||||
long jumpcount = 0;
|
long jumpcount = 0;
|
||||||
|
size_t oldxflags = prog->xflags;
|
||||||
prog_section_statement *st;
|
prog_section_statement *st;
|
||||||
|
|
||||||
prog->vmerror = 0;
|
prog->vmerror = 0;
|
||||||
|
prog->xflags = flags;
|
||||||
|
|
||||||
st = prog->code + prog_enterfunction(prog, func);
|
st = prog->code + prog_enterfunction(prog, func);
|
||||||
--st;
|
--st;
|
||||||
|
@ -602,6 +604,7 @@ bool prog_exec(qc_program *prog, prog_section_function *func, size_t flags, long
|
||||||
};
|
};
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
prog->xflags = oldxflags;
|
||||||
prog->localstack_count = 0;
|
prog->localstack_count = 0;
|
||||||
prog->stack_count = 0;
|
prog->stack_count = 0;
|
||||||
if (prog->vmerror)
|
if (prog->vmerror)
|
||||||
|
@ -650,9 +653,15 @@ bool opts_memchk = false;
|
||||||
static int qc_print(qc_program *prog)
|
static int qc_print(qc_program *prog)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
const char *laststr = NULL;
|
||||||
for (i = 0; i < prog->argc; ++i) {
|
for (i = 0; i < prog->argc; ++i) {
|
||||||
qcany *str = (qcany*)(prog->globals + OFS_PARM0 + 3*i);
|
qcany *str = (qcany*)(prog->globals + OFS_PARM0 + 3*i);
|
||||||
printf("%s", prog_getstring(prog, str->string));
|
printf("%s", (laststr = prog_getstring(prog, str->string)));
|
||||||
|
}
|
||||||
|
if (laststr && (prog->xflags & VMXF_TRACE)) {
|
||||||
|
size_t len = strlen(laststr);
|
||||||
|
if (!len || laststr[len-1] != '\n')
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue