diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2016-07-25 11:01:54 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-07-25 11:01:54 -0400 |
commit | 8194e927cc66e8cceb9890240ad75363b3ca6d53 (patch) | |
tree | 78d5de04cfbaff40c14511416e12885a4295527f /gdb/top.h | |
parent | 0e1a6a5169023ee0c19de2c9160b469e43634b21 (diff) | |
download | gdb-8194e927cc66e8cceb9890240ad75363b3ca6d53.zip gdb-8194e927cc66e8cceb9890240ad75363b3ca6d53.tar.gz gdb-8194e927cc66e8cceb9890240ad75363b3ca6d53.tar.bz2 |
Handle correctly passing a bad interpreter name to new-ui
When a bad interpreter name is passed to new-ui, such as:
(gdb) new-ui bloop /dev/pts/10
A partially created UI is left in the UI list, with interp set to NULL.
Trying to do anything that will print on this UI (such as "start") will
cause a segmentation fault.
Changes in v2:
- Use with_test_prefix to namespace test procedures
- Give an explicit stable test name
- Add a "bad terminal path" test
- Remove useless runto_main
- Add missing intro comments
I did not factor out the pty spawn, as there is some magic involved I
don't quite understand. But it wouldn't bring that much anyway.
gdb/ChangeLog:
* top.h (make_delete_ui_cleanup): New declaration.
* top.c (delete_ui_cleanup): New function.
(make_delete_ui_cleanup): New function.
(new_ui_command): Create restore_ui cleanup earlier, create a
delete_ui cleanup and discard it on success.
gdb/testsuite/ChangeLog:
* gdb.base/new-ui.exp (do_test_invalid_args): New
procedure.
Diffstat (limited to 'gdb/top.h')
-rw-r--r-- | gdb/top.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -185,6 +185,9 @@ extern void switch_thru_all_uis_next (struct switch_thru_all_uis *state); extern struct ui *new_ui (FILE *instream, FILE *outstream, FILE *errstream); extern void delete_ui (struct ui *todel); +/* Cleanup that deletes a UI. */ +extern struct cleanup *make_delete_ui_cleanup (struct ui *ui); + /* Cleanup that restores the current UI. */ extern void restore_ui_cleanup (void *data); |