Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit d7e7473 ("Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy") introduced a problem when using "layout regs", that leads gdb to crash when issuing: ./gdb ./a.out -ex 'layout regs' -ex start From the backtrace, it's caused by this 'delete' on tui_restore_gdbout(): (gdb) bt #0 0x00007ffff6b962b2 in free () from /lib64/libc.so.6 #1 0x000000000059fa47 in tui_restore_gdbout (ui=0x22997b0) at ../../gdb/tui/tui-regs.c:714 #2 0x0000000000619996 in do_my_cleanups (pmy_chain=pmy_chain@entry=0x1e08320 <cleanup_chain>, old_chain=old_chain@entry=0x235b4b0) at ../../gdb/common/cleanups.c:154 #3 0x0000000000619b1d in do_cleanups (old_chain=old_chain@entry=0x235b4b0) at ../../gdb/common/cleanups.c:176 #4 0x000000000059fb0d in tui_register_format (frame=frame@entry=0x22564e0, regnum=regnum@entry=0) at ../../gdb/tui/tui-regs.c:747 #5 0x000000000059ffeb in tui_get_register (data=0x2434d18, changedp=0x0, regnum=0, frame=0x22564e0) at ../../gdb/tui/tui-regs.c:768 #6 tui_show_register_group (refresh_values_only=<optimized out>, frame=0x22564e0, group=0x1e09250 <general_group>) at ../../gdb/tui/tui-regs.c:287 #7 tui_show_registers (group=0x1e09250 <general_group>) at ../../gdb/tui/tui-regs.c:156 #8 0x00000000005a07cf in tui_check_register_values (frame=frame@entry=0x22564e0) at ../../gdb/tui/tui-regs.c:496 #9 0x00000000005a3e65 in tui_check_data_values (frame=frame@entry=0x22564e0) at ../../gdb/tui/tui-windata.c:232 #10 0x000000000059cf65 in tui_refresh_frame_and_register_information (registers_too_p=1) at ../../gdb/tui/tui-hooks.c:156 #11 0x00000000006d5c05 in generic_observer_notify (args=0x7fffffffdbe0, subject=<optimized out>) at ../../gdb/observer.c:167 #12 observer_notify_normal_stop (bs=<optimized out>, print_frame=print_frame@entry=1) at ./observer.inc:61 #13 0x00000000006a6409 in normal_stop () at ../../gdb/infrun.c:8364 #14 0x00000000006af8f5 in fetch_inferior_event (client_data=<optimized out>) at ../../gdb/infrun.c:3990 #15 0x000000000066f0fd in gdb_wait_for_event (block=block@entry=0) at ../../gdb/event-loop.c:859 #16 0x000000000066f237 in gdb_do_one_event () at ../../gdb/event-loop.c:322 #17 0x000000000066f386 in gdb_do_one_event () at ../../gdb/event-loop.c:353 #18 0x00000000007411bc in wait_sync_command_done () at ../../gdb/top.c:570 #19 0x0000000000741426 in maybe_wait_sync_command_done (was_sync=0) at ../../gdb/top.c:587 #20 execute_command (p=<optimized out>, p@entry=0x7fffffffe43a "start", from_tty=from_tty@entry=1) at ../../gdb/top.c:676 #21 0x00000000006c2048 in catch_command_errors (command=0x741200 <execute_command(char*, int)>, arg=0x7fffffffe43a "start", from_tty=1) at ../../gdb/main.c:376 #22 0x00000000006c2b60 in captured_main_1 (context=0x7fffffffde70) at ../../gdb/main.c:1119 #23 captured_main (data=0x7fffffffde70) at ../../gdb/main.c:1140 #24 gdb_main (args=args@entry=0x7fffffffdf90) at ../../gdb/main.c:1158 #25 0x0000000000408cf5 in main (argc=<optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:32 (gdb) f 1 #1 0x000000000059fa47 in tui_restore_gdbout (ui=0x22997b0) at ../../gdb/tui/tui-regs.c:714 714 delete gdb_stdout; The problem is simply that the commit mentioned above made the ui_file that gdb_stdout is temporarily set to be a stack-allocated string_file, while before it used to be a heap-allocated ui_file. The fix is simply to remove the now-incorrect delete. New test included, which exercises enabling all TUI layouts, with and without execution. (This particular crash only triggers with execution.) gdb/ChangeLog: 2017-03-07 Pedro Alves <palves@redhat.com> * tui/tui-regs.c (tui_restore_gdbout): Don't delete gdb_stdout. gdb/testsuite/ChangeLog: 2017-03-07 Pedro Alves <palves@redhat.com> * gdb.base/tui-layout.c: New file. * gdb.base/tui-layout.exp: New file.
- abbrev-sharing-in-tests
- ada-import-fix
- asan-annotations
- bfd-threading-take-4
- bitfield-size-0
- bump-py-version
- check-unused-gdbarch
- coff-pe-fixups-2
- complete-sym-qualified-fixes
- cxx-17-bools
- cxx-17-including-span
- dap-line-offset
- dw-inline-fixup-pr-symtab-30728
- dwarf-no-var-sym
- dwarf-race-relocate
- dynamic-pointer
- exception-print
- fix-framedecorator-help
- fix-run-no-detach-on-fork
- fix-various-bugs
- flags-expand-symtab
- frame-read-var-doc
- frame-show-filtered-line
- gdbarch-const-2
- gdbserver-constify
- gnat-llvm-experiment
- green-threads-v2
- info-proc-ui-out
- internal-fn-leak
- lazily-read-function-bodies
- less-utils-h
- local-env
- maint-canonicalize-command
- master
- min-py-version
- more-pre-commit
- no-vla
- pr-19009-double-lookup
- pr-28948-logging-2
- pr-28948-logging-3
- pr-31751-bg-dwarf
- pr-core-30273-m68k
- py-parse-type-safe
- reading-progress-message
- readnow-backport
- remote-fileio
- rust-8.2
- rust-tuple-op
- search-in-psyms
- signal-number-doc
- split-objfile/2023-bound-sym-and-block-nov
- split-objfile/2023-bound-sym-method
- split-objfile/2023-bound-sym-october
- split-objfile/symbol-value
- split-objfile/symbol-value-2
- std-invoke
- step-off-int3
- submit/ada-op-array
- submit/call-dummy-enum
- submit/cxxfilt-usage-reformat
- submit/cxxify-thread-fsm-2
- submit/debug-names-bfd
- submit/deprecate-stabs
- submit/dwarf-cleanups
- submit/dwz-dwarf-5
- submit/enable-cxx-debug-mode
- submit/float-fmt
- submit/gdb-12-gnulib
- submit/green-threads
- submit/help-list-style-title
- submit/htab-pp-fix
- submit/inferior-gdbref
- submit/inferior-hacks
- submit/lang-parser-return
- submit/lazy-cu-expansion-2
- submit/lazy-dwarf-block
- submit/location-cxxification
- submit/m4-dependencies
- submit/macos-entitlements
- submit/macro-crasher
- submit/makefile-shennanigans
- submit/metasyntactic
- submit/minor-dwz-cleanups
- submit/minsym-cleanups
- submit/more-val-print
- submit/motd-etc
- submit/no-realpath
- submit/per-cu-new
- submit/pr-19471-multi-inf
- submit/pr-23544-python-crash
- submit/pr-24109-early-crash
- submit/pr-26650-sigwinch
- submit/pr-27937-perf
- submit/pr-py-12816-pending
- submit/pr-symtab-25736-assert
- submit/pre-read-sections-pr-gdb-14202
- submit/procfs
- submit/ptype-o-base-class
- submit/py-bp-announce
- submit/ravenscar-fixes
- submit/reading-progress-message-2020
- submit/rename-windows-debug
- submit/sanitizers
- submit/sanitizers-2021
- submit/saving-2
- submit/sip-check
- submit/static-cast
- submit/string-printing
- submit/string-printing-save
- submit/style-selected
- submit/target-fixlet
- submit/target-shortname
- submit/ted-patch
- submit/test-critical
- submit/tui-python-terminal
- submit/uniformity
- submit/verbose-symbol-reading
- submit/wide-int-hacks
- submit/xfree-arm-tdep
- submit/zebra-style
- sw-single-step
- sym-pr-32490
- t/clang-format
- t/colorize-rules
- t/dwarf-hackery
- t/fix-includes
- t/get-8
- t/histogram-pdi-lookups
- t/hurd-attempt
- t/include-hackery
- t/less-comp-unit-heads
- t/mi-hacks
- t/objfile-hysteresis
- t/patchwork-support
- t/pch
- t/random-sim-hacking-2
- t/re-comp
- t/robin-hood-hash
- t/robin-hood-hash-more
- t/serial-cleanup
- t/solist-new
- t/solist-new-save
- t/speed-up-cu-expand
- t/symfile-cleanups
- t/target-sections-vector
- t/unused-macro-warning
- t/work-stealing
- tcl-auto-load
- tcl-no-then
- texi-on-off
- thread-pool-priorities
- type-cache
- value-return-gdbpyref
- warning-intercept
- win32-18027-dll-rebase