Commit Graph

100603 Commits

Author SHA1 Message Date
Luis Machado 09624f1fec [AArch64] Fix typo in comment
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.
2020-02-25 11:59:14 -03:00
Andrew Burgess 2078dbb210 gdb/testsuite: Remove source file path from test name
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.
2020-02-25 14:39:44 +00:00
H.J. Lu ecda90163e Don't call lto-wrapper for ar and ranlib
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.
2020-02-25 03:31:40 -08:00
Claudiu Zissulescu 265b467340 [ARC][committed] Update int_vector_base aux register.
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>
2020-02-25 10:27:07 +02:00
Tom de Vries 70d497007d [gdb/testsuite] Remove gcc/93866 xfail in methods.exp
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.
2020-02-25 08:14:41 +01:00
Simon Marchi 8cb5117ccf Move dwarf2_get_die_type declaration to dwarf2/read.h
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.
2020-02-25 00:13:31 -05:00
Joel Brobecker c325c44ef6 gdb/copyright.py: Add generated files in gnulib/ to exclude list
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.
2020-02-25 07:36:45 +04:00
GDB Administrator a60419c8c9 Automatic date update in version.in 2020-02-25 00:00:33 +00:00
Tom Tromey 4ac9383206 Fix a memory leak and remove an unused member
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.
2020-02-24 15:50:58 -07:00
Tom Tromey 197400e800 Convert IS_TYPE_UNIT_GROUP to method
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.
2020-02-24 15:50:57 -07:00
Tom Tromey 7693576838 Simplify setting of reading_partial_symbols
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.
2020-02-24 15:50:57 -07:00
Andrew Burgess e56d7f1e19 gdb/doc: Fix header alignment of 'info threads' example output
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.
2020-02-24 16:41:02 +00:00
Nick Clifton 45c63c0fe8 Updated translations for some of the binutils sub-directories. 2020-02-24 14:52:34 +00:00
Nick Clifton 83d4d556e2 Fix a spelling mistake in the binutils documentation.
PR 25499
	* doc/binutils.texi (objdump): Fix typo in description of
	objdump's -g option.
2020-02-24 14:39:34 +00:00
Tom de Vries a88ef40d0f [gdb] Ensure listing of unused static var in info locals
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.
2020-02-24 15:32:36 +01:00
Tom de Vries c9af65210c [gdb/testsuite] Fix layout next/prev/regs help message
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.
2020-02-24 12:30:48 +01:00
Alan Modra a98c743fdf Re: vms buffer overflows and large memory allocation
The last patch wasn't quite correct.  I'd missed the fact that sbm_off
had been updated.

	* vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
2020-02-24 13:21:48 +10:30
Alan Modra c893ce360a vms buffer overflows and large memory allocation
* vms-lib.c (struct carsym_mem): Add limit.
	(vms_add_index): Heed limit.
	(vms_traverse_index): Catch buffer overflows.  Remove outdated fixme.
	(vms_lib_read_index): Set up limit.  Catch 32-bit overflow.
	Always return actual number read.
	(_bfd_vms_lib_archive_p): Catch buffer overflows.  Replace
	assertion with error exit.
2020-02-24 12:35:05 +10:30
GDB Administrator 23c4ec6f02 Automatic date update in version.in 2020-02-24 00:00:33 +00:00
Simon Marchi 5df4cba632 gdb: update gnulib import
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.
2020-02-22 20:37:18 -05:00
GDB Administrator 7e702065b4 Automatic date update in version.in 2020-02-23 00:01:37 +00:00
Tom Tromey 5707a07af2 Make dwarf2_compile_expr_to_ax static
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.
2020-02-22 13:49:56 -07:00
Tom Tromey 3b0fb49e30 Fix cast in TUI_DISASM_WIN
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
2020-02-22 12:57:25 -07:00
Tom Tromey 283be8bfa4 Add "usage" text to all TUI command help
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
2020-02-22 12:57:25 -07:00
Tom Tromey ca793b969c Use error_no_arg in TUI
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
2020-02-22 12:57:25 -07:00
Tom Tromey 432b5c4022 Make some tui_source_window_base members "protected"
This renames a few members of tui_source_window_base, and makes them
"protected".

2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (extract_display_start_addr): Rewrite.
	* tui/tui-disasm.h (struct tui_disasm_window)
	<display_start_addr>: Declare.
	* tui/tui-source.h (struct tui_source_window)
	<display_start_addr>: Declare.
	* tui/tui-winsource.h (struct tui_source_window_base)
	<show_source_line, display_start_addr>: New methods.
	<m_horizontal_offset, m_start_line_or_addr, m_gdbarch, m_content>:
	Rename and move to protected section.
	* tui/tui-winsource.c (tui_source_window_base::update_source_window)
	(tui_source_window_base::do_erase_source_content): Update.
	(tui_source_window_base::show_source_line): Now a method.
	(tui_source_window_base::show_source_content)
	(tui_source_window_base::tui_source_window_base)
	(tui_source_window_base::rerender)
	(tui_source_window_base::refill)
	(tui_source_window_base::do_scroll_horizontal)
	(tui_source_window_base::set_is_exec_point_at)
	(tui_source_window_base::update_breakpoint_info)
	(tui_source_window_base::update_exec_info): Update.
	* tui/tui-source.c (tui_source_window::set_contents)
	(tui_source_window::showing_source_p)
	(tui_source_window::do_scroll_vertical)
	(tui_source_window::location_matches_p)
	(tui_source_window::line_is_displayed): Update.
	(tui_source_window::display_start_addr): New method.
	* tui/tui-disasm.c (tui_disasm_window::set_contents)
	(tui_disasm_window::do_scroll_vertical)
	(tui_disasm_window::location_matches_p): Update.
	(tui_disasm_window::display_start_addr): New method.

Change-Id: I74d72b9da5f458664427db643a108634690c6e19
2020-02-22 12:57:25 -07:00
Tom Tromey 01b1af321f Allow TUI windows in Python
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
2020-02-22 12:57:25 -07:00
Tom Tromey fc96d20b2c Remove the TUI annotation hack
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
2020-02-22 11:48:39 -07:00
Tom Tromey 935c78c046 Remove tui_set_win_with_focus
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
2020-02-22 11:48:38 -07:00
Tom Tromey 0240c8f11b Change how TUI windows are instantiated
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
2020-02-22 11:48:38 -07:00
Tom Tromey fdb01f0ce4 TUI windows do not need to store their type
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
2020-02-22 11:48:37 -07:00
Tom Tromey 865a5aec04 Remove tui_delete_invisible_windows and tui_make_all_invisible
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
2020-02-22 11:48:37 -07:00
Tom Tromey e098d18cfc Handle ambiguity in tui_partial_win_by_name
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
2020-02-22 11:48:36 -07:00
Tom Tromey eb9c887456 Reimplement tui_next_win and tui_prev_win
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
2020-02-22 11:48:35 -07:00
Tom Tromey 7eed1a8e83 Change TUI window iteration
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
2020-02-22 11:48:34 -07:00
Tom Tromey 7c043ba695 Add horizontal splitting to TUI layout
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
2020-02-22 11:48:33 -07:00
Tom Tromey 6bc5664858 Change return type of tui_layout_base::adjust_size
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
2020-02-22 11:48:33 -07:00
Tom Tromey c22fef7e4c Allow TUI sub-layouts in "new-layout" command
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
2020-02-22 11:48:32 -07:00
Tom Tromey ee325b61cd Add the "tui new-layout" command
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
2020-02-22 11:48:31 -07:00
Tom Tromey 416eb92d84 Remove hard-coded TUI layouts
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
2020-02-22 11:48:30 -07:00
Tom Tromey 0dbc2fc759 Reimplement "tui reg" command
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
2020-02-22 11:48:29 -07:00
Tom Tromey 5afe342e2a Reimplement TUI "C-x 1" binding
The TUI "C-x 1" key binding removes TUI windows, based on the current
layout.  With user-defined layouts, this is no longer easy to do.

This patch changes "C-x 1" to simply delete windows, leaving just the
focus window, the locator, and the command window.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_rl_delete_other_windows): Call
	tui_remove_some_windows.
	* tui/tui-layout.h (class tui_layout_base) <remove_windows>:
	Declare method.
	(class tui_layout_window) <remove_windows>: New method.
	(class tui_layout_split) <remove_windows>: Declare.
	(tui_remove_some_windows): Declare.
	* tui/tui-layout.c (tui_remove_some_windows): New function.
	(tui_layout_split::remove_windows): New method.

Change-Id: If186f9c3f263913e963b965204481d1b4385c6d4
2020-02-22 11:48:29 -07:00
Tom Tromey 427326a826 Simplify TUI C-x 2 binding
The TUI "C-x 2" binding tries to switch to a different layout based on
the current layout.  Once user-defined layouts are available, this
won't really make sense.  I wasn't entirely sure how to handle this.

This patch changes the binding to simply cycle through the existing
layouts.  I considered this a reasonable, though not ideal,
compromise.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_rl_change_windows): Call tui_next_layout.
	* tui/tui-layout.h (tui_next_layout): Declare.
	* tui/tui-layout.c (tui_next_layout): New function.

Change-Id: Ic101f0e3831a4235a048b3090ef60f025f7449bb
2020-02-22 11:48:28 -07:00
Tom Tromey 3fe12b6d67 Fix latent display bug in tui_data_window
tui_data_window creates new curses windows, but does not pass in
coordinates relative to the data window's origin.  This means that the
data window could only ever be displayed as the topmost window in a
layout.  This is not a currently problem, because all the existing
layouts do this; but a subsequent patch will add user-defined layouts,
which could do otherwise.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_data_window::display_registers_from): Use
	correct coordinates.

Change-Id: I5101f2b2869557b87381ebdeebd9b7fd28687831
2020-02-22 11:48:28 -07:00
Tom Tromey 59b8b5d247 Simplify tui_add_win_to_layout
tui_add_win_to_layout is only ever called for the source or assembly
windows.  This simplifies the function by removing the DATA_WIN case.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.h (tui_add_win_to_layout): Add comment.
	* tui/tui-layout.c (tui_add_win_to_layout): Add assert.  Remove
	DATA_WIN case.

Change-Id: Idfca902c6c90153acc5d19af4c33aa74bc3caf31
2020-02-22 11:48:27 -07:00
Tom Tromey 2a3d458be3 Use TUI_DISASM_WIN instead of tui_win_list array
This is a minor cleanup to change tui_get_low_disassembly_address to
use TUI_DISASM_WIN, rather than the tui_win_list array.  This is more
in line with what the rest of the TUI code does.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.c (tui_get_low_disassembly_address): Use
	TUI_DISASM_WIN, not tui_win_list.

Change-Id: I999335ee3f63a4b570e84f320236b78f2bd5b780
2020-02-22 11:48:27 -07:00
Tom Tromey 3f0cbb04d0 Style field names in "print"
This changes gdb to use the "variable" style when printing field
names.  I've added new tests for C and Rust, but not other languages.

I chose "variable" because that seemed most straightforward.  However,
another option would be to introduce a new "field" style.  Similarly,
this patch uses the variable style for enumerator constants -- but
again, a new style could be used if that's preferred.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print_enum_1)
	(val_print_type_code_flags): Style member names.
	* rust-lang.c (val_print_struct, rust_print_enum)
	(rust_print_struct_def, rust_internal_print_type): Style member
	names.
	* p-valprint.c (pascal_object_print_value_fields): Style member
	names.  Only call fprintf_symbol_filtered for static members.
	* m2-typeprint.c (m2_record_fields, m2_enum): Style member names.
	* f-valprint.c (f_val_print): Style member names.
	* f-typeprint.c (f_type_print_base): Style member names.
	* cp-valprint.c (cp_print_value_fields): Style member names.  Only
	call fprintf_symbol_filtered for static members.
	(cp_print_class_member): Style member names.
	* c-typeprint.c (c_print_type_1, c_type_print_base_1): Style
	member names.
	* ada-valprint.c (ada_print_scalar): Style enum names.
	(ada_val_print_enum): Likewise.
	* ada-typeprint.c (print_enum_type): Style enum names.

gdb/testsuite/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* gdb.rust/rust-style.rs: New file.
	* gdb.rust/rust-style.exp: New file.
	* gdb.base/style.exp: Test structure printing.
	* gdb.base/style.c (struct some_struct): New type.
	(enum etype): New type.
	(struct_value): New global.

Change-Id: I070e1293c6cc830c9ea916af8243410aa384e944
2020-02-22 10:12:52 -07:00
Alan Modra 7b3c27152b PR25585, PHDR segment not covered by LOAD segment
I closed this bug as invalid, but I think it is worth mentioning in NEWS
that older linkers didn't check PT_PHDR very well.  The patch also allows
people to force an output file with --noinhibit-exec after the error.

bfd/
	PR 25585
	* elf.c (assign_file_positions_for_load_sections): Continue linking
	on "PHDR segment not covered by LOAD segment" errors.
ld/
	PR 25585
	* NEWS: Mention better "PHDR segment not covered by LOAD segment"
	checking.
2020-02-22 12:53:52 +10:30
Tom Tromey dda42c0b7b Add a mostlyclean target to gdbserver
I noticed gdbserver's Makefile doesn't have a mostlyclean target.  I
use this sometimes, so this patch adds it.  Adding it as a synonym of
"clean" seemed to make sense, given the contents of that rule.

gdbserver/ChangeLog
2020-02-21  Tom Tromey  <tom@tromey.com>

	* Makefile.in (mostlyclean): New target.
2020-02-21 18:30:10 -07:00
GDB Administrator 5522c15d39 Automatic date update in version.in 2020-02-22 00:00:38 +00:00