aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-12-26 13:41:36 -0700
committerTom Tromey <tom@tromey.com>2021-12-29 10:40:10 -0700
commitd68510ac191cb8b4b662a5fd1f3bcf9f4b136971 (patch)
treeab8d361f18255facf28e086d9a102515e123fa13
parent0fed74615b0f263c359a13a7a17ade36a986ddd1 (diff)
downloadgdb-d68510ac191cb8b4b662a5fd1f3bcf9f4b136971.zip
gdb-d68510ac191cb8b4b662a5fd1f3bcf9f4b136971.tar.gz
gdb-d68510ac191cb8b4b662a5fd1f3bcf9f4b136971.tar.bz2
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
-rw-r--r--gdb/aarch64-linux-tdep.c7
-rw-r--r--gdb/aarch64-tdep.c9
-rw-r--r--gdb/amd64-linux-tdep.c7
-rw-r--r--gdb/arm-linux-tdep.c7
-rw-r--r--gdb/arm-tdep.c40
-rw-r--r--gdb/i386-linux-tdep.c7
-rw-r--r--gdb/i386-tdep.c66
-rw-r--r--gdb/linux-record.c31
-rw-r--r--gdb/moxie-tdep.c7
-rw-r--r--gdb/ppc-linux-tdep.c5
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/s390-linux-tdep.c7
-rw-r--r--gdb/s390-tdep.c2
13 files changed, 113 insertions, 84 deletions
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 7a9cf0c..2480c03 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1489,9 +1489,10 @@ aarch64_linux_syscall_record (struct regcache *regcache,
if (syscall_gdb < 0)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (svc_number));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (svc_number));
return -1;
}
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 3287499..1dd5a51 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -4657,10 +4657,11 @@ aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ret = aarch64_record_decode_insn_handler (&aarch64_record);
if (ret == AARCH64_RECORD_UNSUPPORTED)
{
- printf_unfiltered (_("Process record does not support instruction "
- "0x%0x at address %s.\n"),
- aarch64_record.aarch64_insn,
- paddress (gdbarch, insn_addr));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support instruction "
+ "0x%0x at address %s.\n"),
+ aarch64_record.aarch64_insn,
+ paddress (gdbarch, insn_addr));
ret = -1;
}
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 3fe3d39..d9b8b7f 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1496,9 +1496,10 @@ amd64_linux_syscall_record_common (struct regcache *regcache,
if (syscall_gdb == gdb_sys_no_syscall)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- pulongest (syscall_native));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ pulongest (syscall_native));
return -1;
}
else
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 025ecf0..82a1b4c 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1650,9 +1650,10 @@ arm_linux_syscall_record (struct regcache *regcache, unsigned long svc_number)
if (syscall_gdb == gdb_sys_no_syscall)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (svc_number));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (svc_number));
return -1;
}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index e0ef1d2..e4af38c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -11328,9 +11328,10 @@ arm_record_b_bl (insn_decode_record *arm_insn_r)
static int
arm_record_unsupported_insn (insn_decode_record *arm_insn_r)
{
- printf_unfiltered (_("Process record does not support instruction "
- "0x%0x at address %s.\n"),arm_insn_r->arm_insn,
- paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support instruction "
+ "0x%0x at address %s.\n"),arm_insn_r->arm_insn,
+ paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
return -1;
}
@@ -11916,7 +11917,7 @@ arm_record_coproc_data_proc (insn_decode_record *arm_insn_r)
}
else
{
- printf_unfiltered (_("no syscall record support\n"));
+ fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
return -1;
}
}
@@ -12348,11 +12349,12 @@ thumb_record_misc (insn_decode_record *thumb_insn_r)
record_buf[1] = ARM_LR_REGNUM;
thumb_insn_r->reg_rec_count = 2;
/* We need to save SPSR value, which is not yet done. */
- printf_unfiltered (_("Process record does not support instruction "
- "0x%0x at address %s.\n"),
- thumb_insn_r->arm_insn,
- paddress (thumb_insn_r->gdbarch,
- thumb_insn_r->this_addr));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support instruction "
+ "0x%0x at address %s.\n"),
+ thumb_insn_r->arm_insn,
+ paddress (thumb_insn_r->gdbarch,
+ thumb_insn_r->this_addr));
return -1;
case 0xf:
@@ -12440,7 +12442,7 @@ thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
}
else
{
- printf_unfiltered (_("no syscall record support\n"));
+ fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
return -1;
}
}
@@ -13351,10 +13353,11 @@ decode_insn (abstract_memory_reader &reader, insn_decode_record *arm_record,
{
if (record_debug)
{
- printf_unfiltered (_("Process record: error reading memory at "
- "addr %s len = %d.\n"),
- paddress (arm_record->gdbarch,
- arm_record->this_addr), insn_size);
+ fprintf_unfiltered (gdb_stdlog,
+ _("Process record: error reading memory at "
+ "addr %s len = %d.\n"),
+ paddress (arm_record->gdbarch,
+ arm_record->this_addr), insn_size);
}
return -1;
}
@@ -13619,10 +13622,11 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
{
if (record_debug)
{
- printf_unfiltered (_("Process record: error reading memory at "
- "addr %s len = %d.\n"),
- paddress (arm_record.gdbarch,
- arm_record.this_addr), 2);
+ fprintf_unfiltered (gdb_stdlog,
+ _("Process record: error reading memory at "
+ "addr %s len = %d.\n"),
+ paddress (arm_record.gdbarch,
+ arm_record.this_addr), 2);
}
return -1;
}
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 7c62745..e4e0e6c 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -466,9 +466,10 @@ i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
if (syscall_gdb < 0)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (syscall_native));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (syscall_native));
return -1;
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 7bb0dd4..802205e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -6864,8 +6864,9 @@ Do you want to stop the program?"),
/* XXX */
case 0xcc: /* int3 */
- printf_unfiltered (_("Process record does not support instruction "
- "int3.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support instruction "
+ "int3.\n"));
ir.addr -= 1;
goto no_support;
break;
@@ -6881,9 +6882,10 @@ Do you want to stop the program?"),
if (interrupt != 0x80
|| tdep->i386_intx80_record == NULL)
{
- printf_unfiltered (_("Process record does not support "
- "instruction int 0x%02x.\n"),
- interrupt);
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction int 0x%02x.\n"),
+ interrupt);
ir.addr -= 2;
goto no_support;
}
@@ -6895,8 +6897,9 @@ Do you want to stop the program?"),
/* XXX */
case 0xce: /* into */
- printf_unfiltered (_("Process record does not support "
- "instruction into.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction into.\n"));
ir.addr -= 1;
goto no_support;
break;
@@ -6906,8 +6909,9 @@ Do you want to stop the program?"),
break;
case 0x62: /* bound */
- printf_unfiltered (_("Process record does not support "
- "instruction bound.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction bound.\n"));
ir.addr -= 1;
goto no_support;
break;
@@ -6942,15 +6946,17 @@ Do you want to stop the program?"),
break;
case 0x0f30: /* wrmsr */
- printf_unfiltered (_("Process record does not support "
- "instruction wrmsr.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction wrmsr.\n"));
ir.addr -= 2;
goto no_support;
break;
case 0x0f32: /* rdmsr */
- printf_unfiltered (_("Process record does not support "
- "instruction rdmsr.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction rdmsr.\n"));
ir.addr -= 2;
goto no_support;
break;
@@ -6970,8 +6976,9 @@ Do you want to stop the program?"),
}
if (tdep->i386_sysenter_record == NULL)
{
- printf_unfiltered (_("Process record does not support "
- "instruction sysenter.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction sysenter.\n"));
ir.addr -= 2;
goto no_support;
}
@@ -6982,8 +6989,9 @@ Do you want to stop the program?"),
break;
case 0x0f35: /* sysexit */
- printf_unfiltered (_("Process record does not support "
- "instruction sysexit.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction sysexit.\n"));
ir.addr -= 2;
goto no_support;
break;
@@ -6993,8 +7001,9 @@ Do you want to stop the program?"),
int ret;
if (tdep->i386_syscall_record == NULL)
{
- printf_unfiltered (_("Process record does not support "
- "instruction syscall.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction syscall.\n"));
ir.addr -= 2;
goto no_support;
}
@@ -7005,8 +7014,9 @@ Do you want to stop the program?"),
break;
case 0x0f07: /* sysret */
- printf_unfiltered (_("Process record does not support "
- "instruction sysret.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction sysret.\n"));
ir.addr -= 2;
goto no_support;
break;
@@ -7019,8 +7029,9 @@ Do you want to stop the program?"),
break;
case 0xf4: /* hlt */
- printf_unfiltered (_("Process record does not support "
- "instruction hlt.\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support "
+ "instruction hlt.\n"));
ir.addr -= 1;
goto no_support;
break;
@@ -8138,10 +8149,11 @@ reswitch_prefix_add:
return 0;
no_support:
- printf_unfiltered (_("Process record does not support instruction 0x%02x "
- "at address %s.\n"),
- (unsigned int) (opcode),
- paddress (gdbarch, ir.orig_addr));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record does not support instruction 0x%02x "
+ "at address %s.\n"),
+ (unsigned int) (opcode),
+ paddress (gdbarch, ir.orig_addr));
return -1;
}
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 4dfd3cf..4be187c 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -492,15 +492,17 @@ record_linux_system_call (enum gdb_syscall syscall,
}
else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support ioctl request TIOCSERGSTRUCT\n"));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support ioctl request TIOCSERGSTRUCT\n"));
return 1;
}
else
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support ioctl request 0x%s.\n"),
- OUTPUT_REG (tmpulongest, tdep->arg2));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support ioctl request 0x%s.\n"),
+ OUTPUT_REG (tmpulongest, tdep->arg2));
return 1;
}
break;
@@ -1008,9 +1010,10 @@ Do you want to stop the program?"),
}
break;
default:
- printf_unfiltered (_("Process record and replay target "
- "doesn't support socketcall call 0x%s\n"),
- OUTPUT_REG (tmpulongest, tdep->arg1));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target "
+ "doesn't support socketcall call 0x%s\n"),
+ OUTPUT_REG (tmpulongest, tdep->arg1));
return -1;
break;
}
@@ -1148,9 +1151,10 @@ Do you want to stop the program?"),
break;
default:
/* XXX RECORD_SEMCTL still not supported. */
- printf_unfiltered (_("Process record and replay target doesn't "
- "support ipc number %s\n"),
- pulongest (tmpulongest));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support ipc number %s\n"),
+ pulongest (tmpulongest));
break;
}
break;
@@ -2032,8 +2036,9 @@ Do you want to stop the program?"),
break;
default:
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %d\n"), syscall);
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %d\n"), syscall);
return -1;
break;
}
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 459bfb8..949a18d 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -279,9 +279,10 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
if (target_read_memory (addr, buf, length))
{
if (record_debug)
- printf_unfiltered (_("Process record: error reading memory at "
- "addr 0x%s len = %d.\n"),
- paddress (target_gdbarch (), addr), length);
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record: error reading memory at "
+ "addr 0x%s len = %d.\n"),
+ paddress (target_gdbarch (), addr), length);
return -1;
}
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 9e89542..e5206b5 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1427,8 +1427,9 @@ ppc_linux_syscall_record (struct regcache *regcache)
if (syscall_gdb < 0)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %d\n"), (int) scnum);
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %d\n"), (int) scnum);
return 0;
}
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index ce98dc2..ad80c69 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -5986,7 +5986,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
else
{
- printf_unfiltered (_("no syscall record support\n"));
+ fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
return -1;
}
break;
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 3fa0b65..7a43e27 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -815,9 +815,10 @@ s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
if (syscall_gdb < 0)
{
- printf_unfiltered (_("Process record and replay target doesn't "
- "support syscall number %s\n"),
- plongest (syscall_native));
+ fprintf_unfiltered (gdb_stderr,
+ _("Process record and replay target doesn't "
+ "support syscall number %s\n"),
+ plongest (syscall_native));
return -1;
}
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index abbb094..2637d71 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -3103,7 +3103,7 @@ ex:
}
else
{
- printf_unfiltered (_("no syscall record support\n"));
+ fprintf_unfiltered (gdb_stderr, _("no syscall record support\n"));
return -1;
}
break;