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,9 +1489,10 @@ 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,
|
||||||
"support syscall number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
plongest (svc_number));
|
"support syscall number %s\n"),
|
||||||
|
plongest (svc_number));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4657,10 +4657,11 @@ 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,
|
||||||
"0x%0x at address %s.\n"),
|
_("Process record does not support instruction "
|
||||||
aarch64_record.aarch64_insn,
|
"0x%0x at address %s.\n"),
|
||||||
paddress (gdbarch, insn_addr));
|
aarch64_record.aarch64_insn,
|
||||||
|
paddress (gdbarch, insn_addr));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1496,9 +1496,10 @@ 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,
|
||||||
"support syscall number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
pulongest (syscall_native));
|
"support syscall number %s\n"),
|
||||||
|
pulongest (syscall_native));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1650,9 +1650,10 @@ 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,
|
||||||
"support syscall number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
plongest (svc_number));
|
"support syscall number %s\n"),
|
||||||
|
plongest (svc_number));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11328,9 +11328,10 @@ 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,
|
||||||
"0x%0x at address %s.\n"),arm_insn_r->arm_insn,
|
_("Process record does not support instruction "
|
||||||
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
|
"0x%0x at address %s.\n"),arm_insn_r->arm_insn,
|
||||||
|
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -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,11 +12349,12 @@ 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,
|
||||||
"0x%0x at address %s.\n"),
|
_("Process record does not support instruction "
|
||||||
thumb_insn_r->arm_insn,
|
"0x%0x at address %s.\n"),
|
||||||
paddress (thumb_insn_r->gdbarch,
|
thumb_insn_r->arm_insn,
|
||||||
thumb_insn_r->this_addr));
|
paddress (thumb_insn_r->gdbarch,
|
||||||
|
thumb_insn_r->this_addr));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case 0xf:
|
case 0xf:
|
||||||
|
@ -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,10 +13353,11 @@ 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,
|
||||||
"addr %s len = %d.\n"),
|
_("Process record: error reading memory at "
|
||||||
paddress (arm_record->gdbarch,
|
"addr %s len = %d.\n"),
|
||||||
arm_record->this_addr), insn_size);
|
paddress (arm_record->gdbarch,
|
||||||
|
arm_record->this_addr), insn_size);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -13619,10 +13622,11 @@ 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,
|
||||||
"addr %s len = %d.\n"),
|
_("Process record: error reading memory at "
|
||||||
paddress (arm_record.gdbarch,
|
"addr %s len = %d.\n"),
|
||||||
arm_record.this_addr), 2);
|
paddress (arm_record.gdbarch,
|
||||||
|
arm_record.this_addr), 2);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,9 +466,10 @@ 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,
|
||||||
"support syscall number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
plongest (syscall_native));
|
"support syscall number %s\n"),
|
||||||
|
plongest (syscall_native));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6864,8 +6864,9 @@ 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,
|
||||||
"int3.\n"));
|
_("Process record does not support instruction "
|
||||||
|
"int3.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -6881,9 +6882,10 @@ 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,
|
||||||
"instruction int 0x%02x.\n"),
|
_("Process record does not support "
|
||||||
interrupt);
|
"instruction int 0x%02x.\n"),
|
||||||
|
interrupt);
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
}
|
}
|
||||||
|
@ -6895,8 +6897,9 @@ 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,
|
||||||
"instruction into.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction into.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -6906,8 +6909,9 @@ 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,
|
||||||
"instruction bound.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction bound.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -6942,15 +6946,17 @@ 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,
|
||||||
"instruction wrmsr.\n"));
|
_("Process record does not support "
|
||||||
|
"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,
|
||||||
"instruction rdmsr.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction rdmsr.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -6970,8 +6976,9 @@ 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,
|
||||||
"instruction sysenter.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction sysenter.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
}
|
}
|
||||||
|
@ -6982,8 +6989,9 @@ 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,
|
||||||
"instruction sysexit.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction sysexit.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -6993,8 +7001,9 @@ 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,
|
||||||
"instruction syscall.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction syscall.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
}
|
}
|
||||||
|
@ -7005,8 +7014,9 @@ 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,
|
||||||
"instruction sysret.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction sysret.\n"));
|
||||||
ir.addr -= 2;
|
ir.addr -= 2;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -7019,8 +7029,9 @@ 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,
|
||||||
"instruction hlt.\n"));
|
_("Process record does not support "
|
||||||
|
"instruction hlt.\n"));
|
||||||
ir.addr -= 1;
|
ir.addr -= 1;
|
||||||
goto no_support;
|
goto no_support;
|
||||||
break;
|
break;
|
||||||
|
@ -8138,10 +8149,11 @@ 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,
|
||||||
"at address %s.\n"),
|
_("Process record does not support instruction 0x%02x "
|
||||||
(unsigned int) (opcode),
|
"at address %s.\n"),
|
||||||
paddress (gdbarch, ir.orig_addr));
|
(unsigned int) (opcode),
|
||||||
|
paddress (gdbarch, ir.orig_addr));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -492,15 +492,17 @@ 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,
|
||||||
"support ioctl request TIOCSERGSTRUCT\n"));
|
_("Process record and replay target doesn't "
|
||||||
|
"support ioctl request TIOCSERGSTRUCT\n"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
"support ioctl request 0x%s.\n"),
|
_("Process record and replay target doesn't "
|
||||||
OUTPUT_REG (tmpulongest, tdep->arg2));
|
"support ioctl request 0x%s.\n"),
|
||||||
|
OUTPUT_REG (tmpulongest, tdep->arg2));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1008,9 +1010,10 @@ Do you want to stop the program?"),
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
"doesn't support socketcall call 0x%s\n"),
|
_("Process record and replay target "
|
||||||
OUTPUT_REG (tmpulongest, tdep->arg1));
|
"doesn't support socketcall call 0x%s\n"),
|
||||||
|
OUTPUT_REG (tmpulongest, tdep->arg1));
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1148,9 +1151,10 @@ 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,
|
||||||
"support ipc number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
pulongest (tmpulongest));
|
"support ipc number %s\n"),
|
||||||
|
pulongest (tmpulongest));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2032,8 +2036,9 @@ Do you want to stop the program?"),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf_unfiltered (_("Process record and replay target doesn't "
|
fprintf_unfiltered (gdb_stderr,
|
||||||
"support syscall number %d\n"), syscall);
|
_("Process record and replay target doesn't "
|
||||||
|
"support syscall number %d\n"), syscall);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,9 +279,10 @@ 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,
|
||||||
"addr 0x%s len = %d.\n"),
|
_("Process record: error reading memory at "
|
||||||
paddress (target_gdbarch (), addr), length);
|
"addr 0x%s len = %d.\n"),
|
||||||
|
paddress (target_gdbarch (), addr), length);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1427,8 +1427,9 @@ 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,
|
||||||
"support syscall number %d\n"), (int) scnum);
|
_("Process record and replay target doesn't "
|
||||||
|
"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,9 +815,10 @@ 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,
|
||||||
"support syscall number %s\n"),
|
_("Process record and replay target doesn't "
|
||||||
plongest (syscall_native));
|
"support syscall number %s\n"),
|
||||||
|
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