diff options
author | Tom Tromey <tromey@redhat.com> | 2014-07-11 08:30:34 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-07-18 09:48:02 -0600 |
commit | b0ed115fa5895ccb20d73e26d89a3b8430fe0f0a (patch) | |
tree | 2d2ef5e82595bbd4b7bbf890845a72ce97cd4950 /gdb/target.c | |
parent | e75fdfcad1c868eae5396a95be9dd18010406306 (diff) | |
download | gdb-b0ed115fa5895ccb20d73e26d89a3b8430fe0f0a.zip gdb-b0ed115fa5895ccb20d73e26d89a3b8430fe0f0a.tar.gz gdb-b0ed115fa5895ccb20d73e26d89a3b8430fe0f0a.tar.bz2 |
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 <tromey@redhat.com>
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.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gdb/target.c b/gdb/target.c index 07d029a..d77542a 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -499,6 +499,23 @@ target_terminal_inferior (void) (*current_target.to_terminal_inferior) (¤t_target); } +/* See target.h. */ + +int +target_supports_terminal_ours (void) +{ + struct target_ops *t; + + for (t = current_target.beneath; t != NULL; t = t->beneath) + { + if (t->to_terminal_ours != delegate_terminal_ours + && t->to_terminal_ours != tdefault_terminal_ours) + return 1; + } + + return 0; +} + static void tcomplain (void) { @@ -3457,7 +3474,8 @@ target_supports_delete_record (void) struct target_ops *t; for (t = current_target.beneath; t != NULL; t = t->beneath) - if (t->to_delete_record != NULL) + if (t->to_delete_record != delegate_delete_record + && t->to_delete_record != tdefault_delete_record) return 1; return 0; |