From b0ed115fa5895ccb20d73e26d89a3b8430fe0f0a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 Jul 2014 08:30:34 -0600 Subject: fix PR gdb/17130 This fixes PR gdb/17130. The bug is that some code in utils.c was not updated during the target delegation change: if (job_control /* If there is no terminal switching for this target, then we can't possibly get screwed by the lack of job control. */ || current_target.to_terminal_ours == NULL) fatal ("Quit"); else fatal ("Quit (expect signal SIGINT when the program is resumed)"); After the delegation change, to_terminal_ours will never be NULL. I think this bug can be seen before the target delegation change by enabling target debugging -- this would also cause to_terminal_ours to be non-NULL. The fix is to introduce a new target_supports_terminal_ours function, that properly checks the target stack. This is not perhaps ideal, but I think is a reasonable-enough approach, and in keeping with some other existing code of the same form. This patch also fixes a similar bug in target_supports_delete_record. 2014-07-18 Tom Tromey PR gdb/17130: * utils.c (quit): Use target_supports_terminal_ours. * target.h (target_supports_terminal_ours): Declare. * target.c (target_supports_delete_record): Don't check to_delete_record against NULL. (target_supports_terminal_ours): New function. --- gdb/target.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index 8c8ce00..35a7d7d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1397,6 +1397,11 @@ extern void target_terminal_inferior (void); #define target_terminal_ours() \ (*current_target.to_terminal_ours) (¤t_target) +/* Return true if the target stack has a non-default + "to_terminal_ours" method. */ + +extern int target_supports_terminal_ours (void); + /* Save our terminal settings. This is called from TUI after entering or leaving the curses mode. Since curses modifies our terminal this call is here -- cgit v1.1