diff options
author | Tom Tromey <tom@tromey.com> | 2021-12-26 13:41:36 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-12-29 10:40:10 -0700 |
commit | d68510ac191cb8b4b662a5fd1f3bcf9f4b136971 (patch) | |
tree | ab8d361f18255facf28e086d9a102515e123fa13 /gdb/i386-tdep.c | |
parent | 0fed74615b0f263c359a13a7a17ade36a986ddd1 (diff) | |
download | fsf-binutils-gdb-d68510ac191cb8b4b662a5fd1f3bcf9f4b136971.zip fsf-binutils-gdb-d68510ac191cb8b4b662a5fd1f3bcf9f4b136971.tar.gz fsf-binutils-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
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r-- | gdb/i386-tdep.c | 66 |
1 files changed, 39 insertions, 27 deletions
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; } |