Use correct stream for process record output
The process record code often emits unfiltered output. In some cases, this output ought to go to gdb_stderr (but see below). In other cases, the output is guarded by a logging variable and so ought to go to gdb_stdlog. This patch makes these changes. Note that in many cases, the output to stderr is followed by a "return -1", which is how process record indicates an error. It seems to me that calling error here would be preferable, because, in many cases, that's all the caller does when it sees a -1. However, I haven't made this change. This is part of PR gdb/7233. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
This commit is contained in:
parent
0fed74615b
commit
d68510ac19
13 changed files with 113 additions and 84 deletions
|
@ -1489,7 +1489,8 @@ aarch64_linux_syscall_record (struct regcache *regcache,
|
||||||
|
|
||||||
if (syscall_gdb < 0)
|
if (syscall_gdb < 0)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %s\n"),
|
"support syscall number %s\n"),
|
||||||
plongest (svc_number));
|
plongest (svc_number));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -4657,7 +4657,8 @@ aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
|
||||||
ret = aarch64_record_decode_insn_handler (&aarch64_record);
|
ret = aarch64_record_decode_insn_handler (&aarch64_record);
|
||||||
if (ret == AARCH64_RECORD_UNSUPPORTED)
|
if (ret == AARCH64_RECORD_UNSUPPORTED)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record does not support instruction "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support instruction "
|
||||||
"0x%0x at address %s.\n"),
|
"0x%0x at address %s.\n"),
|
||||||
aarch64_record.aarch64_insn,
|
aarch64_record.aarch64_insn,
|
||||||
paddress (gdbarch, insn_addr));
|
paddress (gdbarch, insn_addr));
|
||||||
|
|
|
@ -1496,7 +1496,8 @@ amd64_linux_syscall_record_common (struct regcache *regcache,
|
||||||
|
|
||||||
if (syscall_gdb == gdb_sys_no_syscall)
|
if (syscall_gdb == gdb_sys_no_syscall)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %s\n"),
|
"support syscall number %s\n"),
|
||||||
pulongest (syscall_native));
|
pulongest (syscall_native));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1650,7 +1650,8 @@ arm_linux_syscall_record (struct regcache *regcache, unsigned long svc_number)
|
||||||
|
|
||||||
if (syscall_gdb == gdb_sys_no_syscall)
|
if (syscall_gdb == gdb_sys_no_syscall)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %s\n"),
|
"support syscall number %s\n"),
|
||||||
plongest (svc_number));
|
plongest (svc_number));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -11328,7 +11328,8 @@ arm_record_b_bl (insn_decode_record *arm_insn_r)
|
||||||
static int
|
static int
|
||||||
arm_record_unsupported_insn (insn_decode_record *arm_insn_r)
|
arm_record_unsupported_insn (insn_decode_record *arm_insn_r)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record does not support instruction "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support instruction "
|
||||||
"0x%0x at address %s.\n"),arm_insn_r->arm_insn,
|
"0x%0x at address %s.\n"),arm_insn_r->arm_insn,
|
||||||
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
|
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
|
||||||
|
|
||||||
|
@ -11916,7 +11917,7 @@ arm_record_coproc_data_proc (insn_decode_record *arm_insn_r)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("no syscall record support\n"));
|
fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12348,7 +12349,8 @@ thumb_record_misc (insn_decode_record *thumb_insn_r)
|
||||||
record_buf[1] = ARM_LR_REGNUM;
|
record_buf[1] = ARM_LR_REGNUM;
|
||||||
thumb_insn_r->reg_rec_count = 2;
|
thumb_insn_r->reg_rec_count = 2;
|
||||||
/* We need to save SPSR value, which is not yet done. */
|
/* We need to save SPSR value, which is not yet done. */
|
||||||
printf_unfiltered (_("Process record does not support instruction "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support instruction "
|
||||||
"0x%0x at address %s.\n"),
|
"0x%0x at address %s.\n"),
|
||||||
thumb_insn_r->arm_insn,
|
thumb_insn_r->arm_insn,
|
||||||
paddress (thumb_insn_r->gdbarch,
|
paddress (thumb_insn_r->gdbarch,
|
||||||
|
@ -12440,7 +12442,7 @@ thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("no syscall record support\n"));
|
fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13351,7 +13353,8 @@ decode_insn (abstract_memory_reader &reader, insn_decode_record *arm_record,
|
||||||
{
|
{
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record: error reading memory at "
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
_("Process record: error reading memory at "
|
||||||
"addr %s len = %d.\n"),
|
"addr %s len = %d.\n"),
|
||||||
paddress (arm_record->gdbarch,
|
paddress (arm_record->gdbarch,
|
||||||
arm_record->this_addr), insn_size);
|
arm_record->this_addr), insn_size);
|
||||||
|
@ -13619,7 +13622,8 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
|
||||||
{
|
{
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record: error reading memory at "
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
_("Process record: error reading memory at "
|
||||||
"addr %s len = %d.\n"),
|
"addr %s len = %d.\n"),
|
||||||
paddress (arm_record.gdbarch,
|
paddress (arm_record.gdbarch,
|
||||||
arm_record.this_addr), 2);
|
arm_record.this_addr), 2);
|
||||||
|
|
|
@ -466,7 +466,8 @@ i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
|
||||||
|
|
||||||
if (syscall_gdb < 0)
|
if (syscall_gdb < 0)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %s\n"),
|
"support syscall number %s\n"),
|
||||||
plongest (syscall_native));
|
plongest (syscall_native));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -6864,7 +6864,8 @@ Do you want to stop the program?"),
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
case 0xcc: /* int3 */
|
case 0xcc: /* int3 */
|
||||||
printf_unfiltered (_("Process record does not support instruction "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support instruction "
|
||||||
"int3.\n"));
|
"int3.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6881,7 +6882,8 @@ Do you want to stop the program?"),
|
||||||
if (interrupt != 0x80
|
if (interrupt != 0x80
|
||||||
|| tdep->i386_intx80_record == NULL)
|
|| tdep->i386_intx80_record == NULL)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction int 0x%02x.\n"),
|
"instruction int 0x%02x.\n"),
|
||||||
interrupt);
|
interrupt);
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
|
@ -6895,7 +6897,8 @@ Do you want to stop the program?"),
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
case 0xce: /* into */
|
case 0xce: /* into */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction into.\n"));
|
"instruction into.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6906,7 +6909,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x62: /* bound */
|
case 0x62: /* bound */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction bound.\n"));
|
"instruction bound.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6942,14 +6946,16 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f30: /* wrmsr */
|
case 0x0f30: /* wrmsr */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction wrmsr.\n"));
|
"instruction wrmsr.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f32: /* rdmsr */
|
case 0x0f32: /* rdmsr */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction rdmsr.\n"));
|
"instruction rdmsr.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6970,7 +6976,8 @@ Do you want to stop the program?"),
|
||||||
}
|
}
|
||||||
if (tdep->i386_sysenter_record == NULL)
|
if (tdep->i386_sysenter_record == NULL)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction sysenter.\n"));
|
"instruction sysenter.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6982,7 +6989,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f35: /* sysexit */
|
case 0x0f35: /* sysexit */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction sysexit.\n"));
|
"instruction sysexit.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -6993,7 +7001,8 @@ Do you want to stop the program?"),
|
||||||
int ret;
|
int ret;
|
||||||
if (tdep->i386_syscall_record == NULL)
|
if (tdep->i386_syscall_record == NULL)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction syscall.\n"));
|
"instruction syscall.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -7005,7 +7014,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f07: /* sysret */
|
case 0x0f07: /* sysret */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction sysret.\n"));
|
"instruction sysret.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -7019,7 +7029,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xf4: /* hlt */
|
case 0xf4: /* hlt */
|
||||||
printf_unfiltered (_("Process record does not support "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support "
|
||||||
"instruction hlt.\n"));
|
"instruction hlt.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
|
@ -8138,7 +8149,8 @@ reswitch_prefix_add:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
no_support:
|
no_support:
|
||||||
printf_unfiltered (_("Process record does not support instruction 0x%02x "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record does not support instruction 0x%02x "
|
||||||
"at address %s.\n"),
|
"at address %s.\n"),
|
||||||
(unsigned int) (opcode),
|
(unsigned int) (opcode),
|
||||||
paddress (gdbarch, ir.orig_addr));
|
paddress (gdbarch, ir.orig_addr));
|
||||||
|
|
|
@ -492,13 +492,15 @@ record_linux_system_call (enum gdb_syscall syscall,
|
||||||
}
|
}
|
||||||
else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
|
else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support ioctl request TIOCSERGSTRUCT\n"));
|
"support ioctl request TIOCSERGSTRUCT\n"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support ioctl request 0x%s.\n"),
|
"support ioctl request 0x%s.\n"),
|
||||||
OUTPUT_REG (tmpulongest, tdep->arg2));
|
OUTPUT_REG (tmpulongest, tdep->arg2));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1008,7 +1010,8 @@ Do you want to stop the program?"),
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target "
|
||||||
"doesn't support socketcall call 0x%s\n"),
|
"doesn't support socketcall call 0x%s\n"),
|
||||||
OUTPUT_REG (tmpulongest, tdep->arg1));
|
OUTPUT_REG (tmpulongest, tdep->arg1));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1148,7 +1151,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* XXX RECORD_SEMCTL still not supported. */
|
/* XXX RECORD_SEMCTL still not supported. */
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support ipc number %s\n"),
|
"support ipc number %s\n"),
|
||||||
pulongest (tmpulongest));
|
pulongest (tmpulongest));
|
||||||
break;
|
break;
|
||||||
|
@ -2032,7 +2036,8 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %d\n"), syscall);
|
"support syscall number %d\n"), syscall);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -279,7 +279,8 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
|
||||||
if (target_read_memory (addr, buf, length))
|
if (target_read_memory (addr, buf, length))
|
||||||
{
|
{
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
printf_unfiltered (_("Process record: error reading memory at "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record: error reading memory at "
|
||||||
"addr 0x%s len = %d.\n"),
|
"addr 0x%s len = %d.\n"),
|
||||||
paddress (target_gdbarch (), addr), length);
|
paddress (target_gdbarch (), addr), length);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1427,7 +1427,8 @@ ppc_linux_syscall_record (struct regcache *regcache)
|
||||||
|
|
||||||
if (syscall_gdb < 0)
|
if (syscall_gdb < 0)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %d\n"), (int) scnum);
|
"support syscall number %d\n"), (int) scnum);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5986,7 +5986,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("no syscall record support\n"));
|
fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -815,7 +815,8 @@ s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
|
||||||
|
|
||||||
if (syscall_gdb < 0)
|
if (syscall_gdb < 0)
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("Process record and replay target doesn't "
|
||||||
"support syscall number %s\n"),
|
"support syscall number %s\n"),
|
||||||
plongest (syscall_native));
|
plongest (syscall_native));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -3103,7 +3103,7 @@ ex:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("no syscall record support\n"));
|
fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue