summaryrefslogtreecommitdiff
path: root/gdb/linux-record.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-04-12 16:49:32 +0100
committerPedro Alves <palves@redhat.com>2016-04-12 17:00:01 +0100
commit651ce16aa7c2bd5e9f634e91e73790dc3e01a5c0 (patch)
tree1f2f3ba10a62fb0054b191fa16ee315239a8f9cb /gdb/linux-record.c
parent80dbc9fdc7a7929c16f58852e45196a32877b013 (diff)
downloadbinutils-gdb-651ce16aa7c2bd5e9f634e91e73790dc3e01a5c0.tar.gz
Do target_terminal_ours in query & friends instead of in all callers
Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
Diffstat (limited to 'gdb/linux-record.c')
-rw-r--r--gdb/linux-record.c54
1 files changed, 14 insertions, 40 deletions
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index bf2041996e1..fda7ada5499 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -254,17 +254,10 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_exit:
- {
- int q;
-
- target_terminal_ours ();
- q = yquery (_("The next instruction is syscall exit. "
- "It will make the program exit. "
- "Do you want to stop the program?"));
- target_terminal_inferior ();
- if (q)
- return 1;
- }
+ if (yquery (_("The next instruction is syscall exit. "
+ "It will make the program exit. "
+ "Do you want to stop the program?")))
+ return 1;
break;
case gdb_sys_fork:
@@ -663,17 +656,10 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_reboot:
- {
- int q;
-
- target_terminal_ours ();
- q = yquery (_("The next instruction is syscall reboot. "
- "It will restart the computer. "
- "Do you want to stop the program?"));
- target_terminal_inferior ();
- if (q)
- return 1;
- }
+ if (yquery (_("The next instruction is syscall reboot. "
+ "It will restart the computer. "
+ "Do you want to stop the program?")))
+ return 1;
break;
case gdb_old_readdir:
@@ -693,17 +679,12 @@ record_linux_system_call (enum gdb_syscall syscall,
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
if (record_full_memory_query)
{
- int q;
-
- target_terminal_ours ();
- q = yquery (_("\
+ if (yquery (_("\
The next instruction is syscall munmap.\n\
It will free the memory addr = 0x%s len = %u.\n\
It will make record target cannot record some memory change.\n\
Do you want to stop the program?"),
- OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
- target_terminal_inferior ();
- if (q)
+ OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
return 1;
}
}
@@ -1764,17 +1745,10 @@ Do you want to stop the program?"),
break;
case gdb_sys_exit_group:
- {
- int q;
-
- target_terminal_ours ();
- q = yquery (_("The next instruction is syscall exit_group. "
- "It will make the program exit. "
- "Do you want to stop the program?"));
- target_terminal_inferior ();
- if (q)
- return 1;
- }
+ if (yquery (_("The next instruction is syscall exit_group. "
+ "It will make the program exit. "
+ "Do you want to stop the program?")))
+ return 1;
break;
case gdb_sys_lookup_dcookie: