Commit 2bde0683 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: fixed indentation of multiline debug strings (-d debugmsg)

--HG--
branch : qemu
parent ea90e9af2d78
......@@ -36,8 +36,9 @@ void DebugMsg_log(EOSState * s)
int arg_i = 0;
char c;
uint32_t address = r2;
eos_print_location_gdb(s);
int spaces = eos_print_location_gdb(s);
APPEND("(%02x:%02x) ", r0, r1);
spaces += len;
c = eos_get_mem_b(s, address++);
while (c)
......@@ -46,10 +47,14 @@ void DebugMsg_log(EOSState * s)
while (c != '\0' && c != '%')
{
if (c == '\n') {
APPEND("\n ");
APPEND("\n");
for (int i = 0; i < spaces; i++) {
APPEND(" ");
}
}
else if (c != '\r')
else if (c != '\r') {
APPEND("%c", c);
}
c = eos_get_mem_b(s, address++);
}
......
......@@ -650,6 +650,7 @@ int eos_print_location(EOSState *s, uint32_t pc, uint32_t lr, const char * prefi
int eos_print_location_gdb(EOSState *s)
{
int len = 0;
uint32_t ret = CURRENT_CPU->env.regs[14] - 4;
if (qemu_loglevel_mask(EOS_LOG_CALLSTACK)) {
......@@ -661,16 +662,18 @@ int eos_print_location_gdb(EOSState *s)
/* on multicore machines, print CPU index for each message */
if (CPU_NEXT(first_cpu)) {
fprintf(stderr, "[CPU%d] ", current_cpu->cpu_index);
len += fprintf(stderr, "[CPU%d] ", current_cpu->cpu_index);
}
if (interrupt_level) {
return fprintf(stderr, "[%s INT-%02Xh:%08x %s] ", KCYN, s->irq_id, ret, KRESET);
len += fprintf(stderr, "[%s INT-%02Xh:%08x %s] ", KCYN, s->irq_id, ret, KRESET) - strlen(KCYN KRESET);
} else {
const char * task_name = eos_get_current_task_name(s);
if (!task_name) task_name = "";
return fprintf(stderr, "[%s%12s:%08x %s] ", KCYN, task_name, ret, KRESET);
len += fprintf(stderr, "[%s%12s:%08x %s] ", KCYN, task_name, ret, KRESET) - strlen(KCYN KRESET);
}
return len;
}
static int print_call_location(EOSState *s, uint32_t pc, uint32_t lr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment