binutils-gdb/gdb/testsuite/gdb.mi
Pedro Alves 5be5dbf0ce Fix "-gdb-set logging redirect on" crash
This commit fixes a "-gdb-set logging redirect on" crash by not
handling "logging redirect on" on the fly.

Previous discussion here:
 https://sourceware.org/ml/gdb-patches/2017-01/msg00467.html

Code for handling "logging redirect on" on the fly was added here:
 https://sourceware.org/ml/gdb-patches/2010-08/msg00202.html

Meanwhile, MI gained support for logging, but flipping redirect "on"
on the fly was not considered.  The result is that this sequence of
commands crashes GDB:

 -gdb-set logging on
 -gdb-set logging redirect on

 Program received signal SIGSEGV, Segmentation fault.
 0x00000000008dd7bc in gdb_flush (file=0x2a097f0) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/ui-file.c:95
 194       file->to_flush (file);
 (top-gdb) bt
 #0  0x00000000008dd7bc in gdb_flush(ui_file*) (file=0x2a097f0) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/ui-file.c:95
 #1  0x00000000007b5f34 in gdb_wait_for_event(int) (block=0) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/event-loop.c:752
 #2  0x00000000007b52b6 in gdb_do_one_event() () at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/event-loop.c:322
 #3  0x00000000007b5362 in start_event_loop() () at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/event-loop.c:371
 #4  0x000000000082704a in captured_command_loop(void*) (data=0x0) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/main.c:325
 #5  0x00000000007b8d7c in catch_errors(int (*)(void*), void*, char*, return_mask) (func=0x827008 <captured_command_loop(void*)>, func_args=0x0, errstring=0x11dee51 "", mask=RETURN_MASK_ALL) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/exceptions.c:236
 #6  0x000000000082839b in captured_main(void*) (data=0x7fffffffd820) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/main.c:1148
 During symbol reading, cannot get low and high bounds for subprogram DIE at 24065.
 #7  0x00000000008283c4 in gdb_main(captured_main_args*) (args=0x7fffffffd820) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/main.c:1158
 #8  0x0000000000412d4d in main(int, char**) (argc=4, argv=0x7fffffffd928) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/gdb.c:32

The handling of redirect on the fly is not really a use case we need
to handle, IMO.  Its inconsistent (other "set logging foo" commands
aren't handled on the fly), and complicates the code significantly.
Instead of complicating it further for MI, go back to the original
idea of warning, only:

  https://sourceware.org/ml/gdb-patches/2010-08/msg00083.html

New test included.

gdb/ChangeLog:
2017-02-02  Pedro Alves  <palves@redhat.com>

	* cli/cli-logging.c (maybe_warn_already_logging): New factored out
	from ...
	(set_logging_overwrite): ... here.
	(logging_no_redirect_file): Delete.
	(set_logging_redirect): Don't handle redirection on the fly.
	Instead warn that "logging off" / "logging on" is necessary.
	(pop_output_files): Delete references to logging_no_redirect_file.
	(show_logging_command): Always speak in terms of what will happen
	once logging is reenabled.

gdb/testsuite/ChangeLog:
2017-02-02  Pedro Alves  <palves@redhat.com>

	* gdb.mi/mi-logging.exp: Add "redirect while already logging"
	tests.
2017-02-02 11:39:56 +00:00
..
array.f update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
basics.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ChangeLog-1999-2003
dw2-ref-missing-frame-func.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
dw2-ref-missing-frame-main.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
dw2-ref-missing-frame.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
dw2-ref-missing-frame.S update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb669.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb680.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb701.c
gdb701.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb792.cc
gdb792.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb2549.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi2-amd64-entry-value.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi2-amd64-entry-value.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi2-amd64-entry-value.s update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi2-prompt.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi2-var-child.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-async-run.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-async-run.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-async.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-basics.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-break.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-breakpoint-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-catch-load-so.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-catch-load.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-catch-load.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-cli.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-cmd-error.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-cmd-param-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-condbreak-call-thr-state-mt.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-condbreak-call-thr-state-st.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-condbreak-call-thr-state.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-condbreak-call-thr-state.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-console.c
mi-console.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-detach.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-disassemble.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-dprintf-pending.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-dprintf-pending.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-dprintf-pendshr.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-dprintf.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-dprintf.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-editing.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-eval.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-exec-run.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-exit-code.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-exit-code.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-file-transfer.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-file.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-fill-memory.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-fullname-deleted.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-hack-cli.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-i-cmd.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-info-os.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-inheritance-syntax-error.cc
mi-inheritance-syntax-error.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-language.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-linespec-err-cp.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-linespec-err-cp.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-logging.exp Fix "-gdb-set logging redirect on" crash 2017-02-02 11:39:56 +00:00
mi-memory-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-nonstop-exit.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-nonstop.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-ns-stale-regcache.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-nsintrall.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-nsmoribund.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-nsthrexec.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-pending.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-pending.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-pendshr2.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-pendshr.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-pthreads.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-read-memory.c
mi-read-memory.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-record-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-reg-undefined.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-reg-undefined.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-reg-undefined.S update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-regs.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-return.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-reverse.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-simplerun.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-solib.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-stack.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-stack.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-start.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-start.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-stepi.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-stepn.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-stepn.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-syn-frame.c
mi-syn-frame.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-threads-interrupt.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-threads-interrupt.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-undefined-cmd.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-until.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-block.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-child-f.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-child.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-child.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-cmd.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-cp.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-cp.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-create-rtti.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-create-rtti.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-display.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-invalidate.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-list-children-invalid-grandchild.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-list-children-invalid-grandchild.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-rtti.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-var-rtti.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-vla-c99.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-vla-fortran.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-watch-nonstop.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-watch.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
new-ui-mi-sync.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
new-ui-mi-sync.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
non-stop-exit.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
non-stop.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ns-stale-regcache.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nsintrall.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nsmoribund.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nsthrexec.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pending.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pendshr1.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pendshr2.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pr11022.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pr11022.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pthreads.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
solib-lib.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
solib-main.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
testcmds
until.c
user-selected-context-sync.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
user-selected-context-sync.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
var-cmd.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
vla.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
vla.f90 update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
watch-nonstop.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00