* elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
malloc. Check for NULL return from bfd_malloc.
(rx_table_find, rx_table_map): Likewise.
(rx_set_section_contents): Check bfd_alloc return.
(rx_dump_symtab): Don't alloc internal_syms or external_syms.
gettext("") returns the header entry with meta information, not the
empty string.
* config/tc-arm.c (reg_expected_msgs[REG_TYPE_RNB]): Don't use
N_() on empty string.
Avoid a warning that the buffer may not be zero terminated.
* read.c (read_a_source_file): Call strncpy with length one
less than size of original_case_string.
This patch delays setting up DT_NEEDED dynamic tags until all object
files and libraries have been opened and their symbols processed,
rather than adding the tags while processing symbols. Tags are
ordered according to the position of the associated library on the
command line and linker scripts. It is still possible with
--as-needed libs that are mentioned more than once for tags to be
ordered according to which mention was needed. For example with
"--as-needed a.so b.so c.so b.so" when b.so is not needed by a.so or
any other prior object file but is needed by c.so, the order of tags
will be "A C B".
bfd/
PR 25593
* elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
"dyn_loaded".
(bfd_elf_add_dt_needed_tag): Declare.
* elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
* elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
from elf_add_dt_needed_tag. Remove soname and doit param.
(elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
to see whether as-needed lib is already loaded, use dyn_loaded
list instead. When saving and restoring around as-needed lib
handle possibility that dynstr has not been initialised. Don't
add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
Mark libs loaded via DT_NEEDED entries of other libs with
DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
the output.
(elf_link_check_versioned_symbol): Remove now unneccesary
DYNAMIC check when traversing dyn_loaded list.
ld/
PR 25593
* ldelf.c (ldelf_try_needed): Add DT_NEEDED lib to input_bfds.
(ldelf_after_open): Save state of input_bfds list before loading
DT_NEEDED libs. Traverse input_bfds list adding DT_NEEDED tags.
Restore input_bfds list.
* testsuite/ld-cris/gotplt1.d: Adjust for changed .dynstr order.
Archive element size is given by data in the archive, and thus is
subject to attack by fuzzers. The only harm this allows is allocation
of huge amounts of memory, but some systems don't handle that well.
So limit archive element size to archive file size.
* bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
This commit pulls in the latest changes for the include/ and
libiberty/ directories. The last sync was in commit
533da48302.
This commit also removes the file libiberty/rust-demangle.h, this file
has been removed in upstream GCC, and should have been deleted as part
of the previous sync up, which included this ChangeLog entry:
2019-11-16 Eduard-Mihai Burtescu <eddyb@lyken.rs>
....
* rust-demangle.h: Remove.
I've grep'd over the binutils-gdb source and can find no reference to
the rust-demangle.h file, and everything seems to build fine without
it, so I assume its continued existence was a mistake.
include/ChangeLog:
Import from gcc mainline:
2020-02-05 Andrew Burgess <andrew.burgess@embecosm.com>
* hashtab.h (htab_remove_elt): Make a parameter const.
(htab_remove_elt_with_hash): Likewise.
libiberty/ChangeLog:
* rust-demangle.h: Removed.
Import from gcc mainline:
2020-02-05 Andrew Burgess <andrew.burgess@embecosm.com>
* hashtab.c (htab_remove_elt): Make a parameter const.
(htab_remove_elt_with_hash): Likewise.
2020-01-23 Alexandre Oliva <oliva@adacore.com>
* argv.c (writeargv): Output empty args as "".
2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
* cp-demangle.c (cplus_demangle_operators): Add the co_await
operator.
* testsuite/demangle-expected: Test co_await operator mangling.
This commit adds support for negative Fortran array strides in one
limited case, that is the case of a single element array with a
negative array stride.
The changes in this commit will be required in order for more general
negative array stride support to work correctly, however, right now
other problems in GDB prevent negative array strides from working in
the general case.
The reason negative array strides don't currently work in the general
case is that when dealing with such arrays, the base address for the
objects data is actually the highest addressed element, subsequent
elements are then accessed with a negative offset from that address,
and GDB is not currently happy with this configuration.
The changes here can be summarised as, stop treating signed values as
unsigned, specifically, the array stride, and offsets calculated using
the array stride.
This issue was identified on the mailing list by Sergio:
https://sourceware.org/ml/gdb-patches/2020-01/msg00360.html
The test for this issue is a new one written by me as the copyright
status of the original test is currently unknown.
gdb/ChangeLog:
* gdbtypes.c (create_array_type_with_stride): Handle negative
array strides.
* valarith.c (value_subscripted_rvalue): Likewise.
gdb/testsuite/ChangeLog:
* gdb.fortran/derived-type-striding.exp: Add a new test.
* gdb.fortran/derived-type-striding.f90: Add pointer variable for
new test.
Just a trivial typo fix in a comment.
gdb/ChangeLog
2020-02-25 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (aarch64_vnv_type): Fix comment typo.
Having paths in test names makes comparing test results from two
separate runs (in different directories) harder.
gdb/testsuite/ChangeLog:
* gdb.base/cached-source-file.exp: Avoid source file paths in test
names.
Since ar and ranlib don't need to know symbol types to work properly,
we should avoid calling lto-wrapper for them to speed them up.
bfd/
PR binutils/25584
* plugin.c (need_lto_wrapper_p): New.
(bfd_plugin_set_program_name): Add an int argument to set
need_lto_wrapper_p.
(get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
set.
* plugin.h (bfd_plugin_set_program_name): Add an int argument.
binutils/
PR binutils/25584
* ar.c (main): Pass 0 to bfd_plugin_set_program_name.
* nm.c (main): Pass 1 to bfd_plugin_set_program_name.
INT_VECTOR_BASE auxiliary register is available across all ARC
architectures.
xxxx-xx-xx Claudiu Zissulescu <claziss@gmail.com>
* arc-regs.h (int_vector_base): Make it available for all ARC
CPUs.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
The test-case gdb.go/methods.exp contains an xfail for PR gcc/93866.
However, that PR has been marked resolved-wontfix, with clarification that the
gccgo symbol names for methods are correct, even if they're not the same as
for gc.
Remove the xfail.
Tested on x86_64-linux with gccgo-10.
gdb/testsuite/ChangeLog:
2020-02-25 Tom de Vries <tdevries@suse.de>
PR go/18926
* gdb.go/methods.exp: Remove gcc/93866 xfail.
Since its implementation is in dwarf2/read.c, its declaration belongs in
dwarf2/read.h. Move the documentation to the .h at the same time.
gdb/ChangeLog:
* loc.h (dwarf2_get_die_type): Move to...
* read.h (dwarf2_get_die_type): ... here.
* read.c (dwarf2_get_die_type): Move doc to header.
This will prevent this script from updating the copyright year range
for those files.
Note that aclocal.m4 and configure are already in the EXCLUDE_ALL_LIST,
so they don't need to be added to the EXCLUDE_LIST.
gdb/ChangeLog:
* copypright.py (EXCLUDE_LIST): Add 'gnulib/config.in' and
'gnulib/Makefile.in' to the list.
I noticed that setup_type_unit_groups leaks the symtab vector -- it
allocates this with XNEWVEC, but from what I can tell, nothing frees
it. This patch changes it to use XOBNEWVEC.
Also, the type_unit_unshareable::num_symtabs member is assigned but
never read. So, this removes it.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct type_unit_unshareable) <num_symtabs>:
Remove.
* dwarf2/read.c (dwarf2_cu::setup_type_unit_groups): Use
XOBNEWVEC.
This converts the IS_TYPE_UNIT_GROUP to a method on
dwarf2_per_cu_data.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_cu_data) <type_unit_group_p>:
New method.
* dwarf2/read.c (IS_TYPE_UNIT_GROUP): Remove.
(dw2_do_instantiate_symtab, dw2_get_file_names)
(build_type_psymtab_dependencies, load_full_type_unit): Update.
This simplifies the setting and clearing of reading_partial_symbols,
by using scoped_restore in the function that reads partial symbols.
gdb/ChangeLog
2020-02-24 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_build_psymtabs_hard): Use
make_scoped_restore.
(dwarf2_psymtab::read_symtab): Don't clear
reading_partial_symbols.
Fixes small white space issue in the example output of 'info threads'.
gdb/doc/ChangeLog:
* gdb.texinfo (Threads): Fix alignment in 'info threads' example
output.
Consider a test-case compiled with -g:
...
int main (void) {
static int b = 2;
return 0;
}
...
When running info locals in main, we get:
...
(gdb) info locals
No locals.
...
The info locals documentation states:
...
Print the local variables of the selected frame, each on a separate line.
These are all variables (declared either static or automatic) accessible at
the point of execution of the selected frame.
...
So, "info locals" should have printed static variable b.
The variable is present in dwarf info:
...
<2><14a>: Abbrev Number: 6 (DW_TAG_variable)
<14b> DW_AT_name : b
<153> DW_AT_const_value : 2
...
but instead of a location attribute, it has a const_value attribute, which
causes the corresponding symbol to have LOC_CONST, which causes info locals to
skip it.
Fix this by handling LOC_CONST in iterate_over_block_locals.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
PR gdb/25592
* stack.c (iterate_over_block_locals): Handle LOC_CONST.
gdb/testsuite/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
PR gdb/25592
* gdb.base/info-locals-unused-static-var.c: New test.
* gdb.base/info-locals-unused-static-var.exp: New file.
With test-case gdb.gdb/unittest.exp, I run into:
...
(gdb) maintenance selftest^M
...
Running selftest help_doc_invariants.^M
help doc broken invariant: command 'layout next' help doc first line is \
not terminated with a '.' character^M
help doc broken invariant: command 'layout prev' help doc first line is \
not terminated with a '.' character^M
help doc broken invariant: command 'layout regs' help doc first line is \
not terminated with a '.' character^M
Self test failed: self-test failed at help-doc-selftests.c:95^M
...
Fix this by adding the missing '.' character.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-02-24 Tom de Vries <tdevries@suse.de>
* tui/tui-layout.c (_initialize_tui_layout): Fix help messages for
commands layout next/prev/regs.
This is mostly to get this commit from gnulib:
e22cd2677a4b7beacbf30b93bb0559f7b89f96ce
Add ‘extern "C"’ to count-one-bits.h etc.
... which fixes this compilation problem I observed with clang++:
CXXLD gdb
arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)'
<more such undefined references>
I built-tested on GNU/Linux x86-64 (gcc-9 and clang-9) as well as with the
x86_64-w64-mingw32-gcc cross-compiler.
gnulib/ChangeLog:
* update-gnulib.sh (GNULIB_COMMIT_SHA1): Bump to
e22cd2677a4b7beacbf30b93bb0559f7b89f96ce.
* Makefile.in, config.in, configure, import/*: Re-generate.
I noticed that dwarf2_compile_expr_to_ax can be static. Nothing
outside of loc.c calls it.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* dwarf2/loc.h (dwarf2_compile_expr_to_ax): Don't declare.
* dwarf2/loc.c (dwarf2_compile_expr_to_ax): Now static.
I noticed that the TUI_DISASM_WIN macro cast the disassembly window to
a base type, rather than its correct type. This patch fixes this
oversight.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (TUI_DISASM_WIN): Cast to tui_disasm_window.
Change-Id: Ied3dbac9ef3dc48ceb9e0850fe4ada3c316dd769
This adds "usage" text to the help for all all the TUI commands. In
some cases the usage is borderline, but I tend to think being complete
is preferable.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (_initialize_tui_win): Add usage text.
* tui/tui-stack.c (_initialize_tui_stack): Add usage text.
* tui/tui-regs.c (_initialize_tui_regs): Add usage text.
* tui/tui.c (_initialize_tui): Add usage text.
Change-Id: I727f7a7cfc03efa248ef98f30a18be393819e30b
This changes a couple of TUI commands to use error_no_arg. The
commands are also simplified a bit, and changed to use other gdb CLI
utility functions like skip_to_space. This lets us removes a couple
of defines that don't interact properly with gettext.
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_focus_command)
(tui_set_win_height_command): Use error_no_arg.
(_initialize_tui_win): Update help text.
(FOCUS_USAGE, WIN_HEIGHT_USAGE): Don't define.
Change-Id: I2bf95c2e5cfe1472d068388fa39f0cf07591b76c
This patch adds support for writing new TUI windows in Python.
2020-02-22 Tom Tromey <tom@tromey.com>
* NEWS: Add entry for gdb.register_window_type.
* tui/tui-layout.h (window_factory): New typedef.
(tui_register_window): Declare.
* tui/tui-layout.c (saved_tui_windows): New global.
(tui_apply_current_layout): Use it.
(tui_register_window): New function.
* python/python.c (do_start_initialization): Call
gdbpy_initialize_tui.
(python_GdbMethods): Add "register_window_type" function.
* python/python-internal.h (gdbpy_register_tui_window)
(gdbpy_initialize_tui): Declare.
* python/py-tui.c: New file.
* Makefile.in (SUBDIR_PYTHON_SRCS): Add py-tui.c.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* python.texi (Python API): Add menu item.
(TUI Windows In Python): New node.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.python/tui-window.exp: New file.
* gdb.python/tui-window.py: New file.
Change-Id: I85fbfb923a1840450a00a7dce113a05d7f048baa
do_tui_putc has some code to remove annotations from gdb output. This
was added in 2001, see commit a198b876bb.
However, I think this code is not needed. It seems very unlikely to
enable both annotations and the TUI, and in any case I think this is
something that should not be supported.
So, this patch removes this code.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-io.c (do_tui_putc): Don't omit annotations.
Change-Id: I05728110365a362d37c9821df9c8779316100bb8
I noticed that the TUI had two functions with similar names:
tui_set_win_focus_to and tui_set_win_with_focus.
However, one was just an implementation detail of the latter. So,
this patch removes tui_set_win_with_focus entirely, to avoid any
temptation to call it.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
* tui/tui-data.c (tui_set_win_with_focus): Remove.
(tui_set_win_focus_to): Move from tui-win.c.
Change-Id: Idffddab773436bdf80d55480906d76b292981ef2
This adds a new global that maps from window names to window
constructor functions, and then changes tui_get_window_by_name and
validate_window_name to use it. This is another step toward
user-defined window types.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (make_standard_window, get_locator_window): New
functions.
(known_window_types): New global.
(tui_get_window_by_name): Reimplement.
(initialize_known_windows): New function.
(validate_window_name): Rewrite.
(_initialize_tui_layout): Call initialize_known_windows.
Change-Id: I9037aac550299b9d945899220a30c2d3af9dd0de
TUI windows no longer need to store their type -- there's only a
single spot that uses this information, and it can be changed to use
dynamic_cast. (It could be cleaned up even more, by using a virtual
method, but I haven't done so.) This patch removes the "type" field
from tui_gen_win_info, and this in turn allows removing a couple of
enumerator constants.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>:
Remove constants.
* tui/tui-winsource.h (struct tui_source_window_base)
<tui_source_window_base>: Remove parameter.
* tui/tui-winsource.c
(tui_source_window_base::tui_source_window_base): Remove
parameter.
(tui_source_window_base::refill): Update.
* tui/tui-stack.h (struct tui_locator_window)
<tui_locator_window>: Update.
* tui/tui-source.h (struct tui_source_window) <tui_source_window>:
Default the constructor.
* tui/tui-regs.h (struct tui_data_item_window)
<tui_data_item_window>: Default the constructor.
(struct tui_data_window) <tui_data_window>: Likewise.
* tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>:
Default the constructor.
* tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>:
Default the constructor.
<type>: Remove.
(struct tui_win_info) <tui_win_info>: Default the constructor.
* tui/tui-data.c (tui_win_info::tui_win_info): Remove.
* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
Default the constructor.
Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
tui_delete_invisible_windows is only needed after applying a layout,
and tui_make_all_invisible is only needed before applying a layout.
This patch removes these functions, in favor of doing this management
directly in tui_apply_current_layout. This is needed so that the
lifetimes of non-built-in windows will be properly managed.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_make_all_invisible): Don't declare.
* tui/tui-wingeneral.c (tui_make_all_invisible): Remove.
* tui/tui-win.c (tui_resize_all): Don't call
tui_delete_invisible_windows.
* tui/tui-layout.c (tui_apply_current_layout): Delete windows when
done.
(tui_set_layout): Update.
(tui_add_win_to_layout): Don't call tui_delete_invisible_windows.
* tui/tui-data.h (tui_delete_invisible_windows): Don't declare.
* tui/tui-data.c (tui_delete_invisible_windows): Remove.
Change-Id: Ia3603b021dcb7ec31700a4a32640cd09b00b8f3b
This changes tui_partial_win_by_name to correctly handle an ambiguous
name prefix. This will be important once the user can register new
window types.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_partial_win_by_name): Handle ambiguity
correctly.
Change-Id: I59aaacd697eeab649164183457ef722dae58d60d
This reimplements tui_next_win and tui_prev_win. Now they account for
the possibility of windows not on tui_win_list.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement.
Change-Id: Ifcd402f76fe0a16e0fe9275a185d550279c01660
This changes the TUI to track all the instantiated windows in a new
global vector. After this, iteration over TUI windows is done by
simply iterating over this vector.
This approach makes it simpler to define new window types. In
particular, a subsequent patch will add the ability to define a TUI
window from Python.
Note that this series will not remove tui_win_list. This will
continue to exist in parallel, only because it was simpler to leave
this alone. Perhaps it could still be removed in the future.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_iterator)
<inner_iterator>: New etytypedef.
<tui_source_window_iterator>: Take "end" parameter.
<tui_source_window_iterator>: Take iterator.
<operator*, advance>: Update.
<m_iter>: Change type.
<m_end>: New field.
(struct tui_source_windows) <begin, end>: Update.
* tui/tui-layout.c (tui_windows): New global.
(tui_apply_current_layout): Clear tui_windows.
(tui_layout_window::apply): Update tui_windows.
* tui/tui-data.h (tui_windows): Declare.
(all_tui_windows): Now inline function.
(class tui_window_iterator, struct all_tui_windows): Remove.
Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf
This changes the TUI layout engine to add horizontal splitting. Now,
windows can be side-by-side.
A horizontal split is defined using the "-horizontal" parameter to
"tui new-layout".
This also adds the first "winheight" test to the test suite. One open
question is whether we want a new "winwidth" command, now that
horizontal layouts are possible. This is easily done using the
generic layout code.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* tui/tui-win.c (tui_gen_win_info::max_width): New method.
* tui/tui-layout.h (class tui_layout_base) <get_sizes>: Add
"height" argument.
(class tui_layout_window) <get_sizes>: Likewise.
(class tui_layout_split) <tui_layout_split>: Add "vertical"
argument.
<get_sizes>: Add "height" argument.
<m_vertical>: New field.
* tui/tui-layout.c (tui_layout_split::clone): Update.
(tui_layout_split::get_sizes): Add "height" argument.
(tui_layout_split::adjust_size, tui_layout_split::apply): Update.
(tui_new_layout_command): Parse "-horizontal".
(_initialize_tui_layout): Update help string.
(tui_layout_split::specification): Add "-horizontal" when needed.
* tui/tui-layout.c (tui_layout_window::get_sizes): Add "height"
argument.
* tui/tui-data.h (struct tui_gen_win_info) <max_width, min_width>:
New methods.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* gdb.texinfo (TUI Commands): Document horizontal layouts.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
PR tui/17850:
* gdb.tui/new-layout.exp: Add horizontal layout and winheight
tests.
Change-Id: I38b35e504f34698578af86686be03c0fefd954ae
This changes tui_layout_base::adjust_size to return a new enum type.
I broke this out into a separate patch because it simplifies a
subsequent patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (enum tui_adjust_result): New.
(class tui_layout_base) <adjust_size>: Return tui_adjust_result.
(class tui_layout_window) <adjust_size>: Return
tui_adjust_result. Rewrite.
(class tui_layout_split) <adjust_size>: Return tui_adjust_result.
* tui/tui-layout.c (tui_layout_split::adjust_size): Update.
Change-Id: I821b48ab06a9b9485875e147bd08a3bc46b900a0
The new TUI layout engine has support for "sub-layouts" -- this is a
layout that includes another layout as a child. A sub-layout is
treated as a unit when allocating space.
There's not a very strong reason to use sub-layouts currently. This
patch exists to introduce the idea, and to simplify the subsequent
patch that adds horizontal layouts -- where sub-layouts are needed.
Because this patch won't go in on its own, I chose to defer
documenting this change until the subsequent horizontal layout patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-layout.h (class tui_layout_split) <add_split>: Change
parameter and return types.
(class tui_layout_base) <specification>: Add "depth".
(class tui_layout_window) <specification>: Add "depth".
(class tui_layout_split) <specification>: Add "depth".
* tui/tui-layout.c (tui_layout_split::add_split): Change parameter
and return types.
(tui_new_layout_command): Parse sub-layouts.
(_initialize_tui_layout): Update help string.
(tui_layout_window::specification): Add "depth".
(add_layout_command): Update.
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.tui/new-layout.exp: Add sub-layout tests.
Change-Id: Iddf52d067a552c168b8a67f29caf7ac86404b10c
This adds a new command, "tui new-layout". This command can be used
to define a new TUI window layout.
The command is used like:
(gdb) tui new-layout name src 1 regs 1 status 0 cmd 1
The first argument is the name of the layout. In this example, it is
"name", so the new layout could be seen by "layout name".
Subsequent arguments come in pairs, where the first item in a pair is
the name of a window, and the second item in a pair is the window's
weight. A weight is just an integer -- a window's allocated size is
proportional to the total of the weights given. So, in the above
example, all windows will have the same size (the status windows's
weight does not matter, because it has fixed height).
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* NEWS: Add "tui new-layout" item.
* tui/tui-layout.c (add_layout_command): Return cmd_list_element.
Add new-layout command to help text.
(validate_window_name): New function.
(tui_new_layout_command): New function.
(_initialize_tui_layout): Register "new-layout".
(tui_layout_window::specification): New method.
(tui_layout_window::specification): New method.
* tui/tui-layout.h (class tui_layout_base) <specification>: New
method.
(class tui_layout_window) <specification>: New method.
(class tui_layout_split) <specification>: New method.
gdb/doc/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.texinfo (TUI Overview): Mention user layouts.
(TUI Commands): Document "tui new-layout".
gdb/testsuite/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* gdb.tui/new-layout.exp: New file.
Change-Id: Id7c3ace20ab1e8924f8f4ad788f40210f58a5c05
This changes the TUI so that the available layouts are no longer
completely hard-coded. "enum tui_layout_type" is removed, and then
all the fallout from this is fixed up.
This patch also reimplements the "layout" command to be a prefix
command. The concrete layouts are simply sub-commands now. This
provides completion and correct abbreviation behavior for free.
Finally, this also changes the name of the locator window to "status".
This matches the documentation and will be exposed to the user in a
subsequent patch.
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Call tui_set_initial_layout.
* tui/tui-win.c (window_name_completer): Update comment.
* tui/tui-layout.h (class tui_layout_base) <replace_window>:
Declare method.
(class tui_layout_window) <replace_window>: Likewise.
(class tui_layout_split) <replace_window>: Likewise.
(tui_set_layout): Don't declare.
(tui_set_initial_layout): Declare function.
* tui/tui-layout.c (layouts, applied_skeleton, src_regs_layout)
(asm_regs_layout): New globals.
(tui_current_layout, show_layout): Remove.
(tui_set_layout, tui_add_win_to_layout): Rewrite.
(find_layout, tui_apply_layout): New function.
(layout_completer): Remove.
(tui_next_layout): Reimplement.
(tui_next_layout_command): New function.
(tui_set_initial_layout, tui_prev_layout_command): New functions.
(tui_regs_layout): Reimplement.
(tui_regs_layout_command): New function.
(extract_display_start_addr): Rewrite.
(next_layout, prev_layout): Remove.
(tui_layout_window::replace_window): New method.
(tui_layout_split::replace_window): New method.
(destroy_layout): New function.
(layout_list): New global.
(add_layout_command): New function.
(initialize_layouts): Update.
(tui_layout_command): New function.
(_initialize_tui_layout): Install "layout" commands.
* tui/tui-data.h (enum tui_layout_type): Remove.
(tui_current_layout): Don't declare.
Change-Id: I9b5f7ab3ce838d6b340b8c373ef649a8e0a74b73
This reimplements the low-level layout function that is used by the
"tui reg" command. Now it simply calls into the existing "layout"
command, though this will be changed again in a subsequent patch. The
rationale for this patch is that it makes it simpler to remove
"enum tui_layout_type".
gdb/ChangeLog
2020-02-22 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_reg_layout): Remove.
(tui_reg_command): Use tui_regs_layout.
* tui/tui-layout.h (tui_reg_command): Declare.
* tui/tui-layout.c (tui_reg_command): New function.
Change-Id: I0ca6884e2967005e7d3fbf5f13a0ac8f9c3298cf