Commit Graph

28937 Commits

Author SHA1 Message Date
Joel Brobecker 5f4def5cbd gdb/copyright.py: Convert to Python 3
gdb/ChangeLog:

        * copyright.py: Convert to Python 3.
2020-01-01 10:12:57 +04:00
Joel Brobecker 51fd40020e gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel
gdb/ChangeLog:

	* copyright.py: Adapt after move of gnulib directory from gdb
	directory to toplevel directory.
2020-01-01 09:19:14 +04:00
Joel Brobecker 5fb651f2dd gdb/copyright.py: Exit if run from the wrong directory
We printed an error, but kept going anyway... ;-)

gdb/ChangeLog:

	* copyright.py (main): Exit if run from the wrong directory.
2020-01-01 09:11:56 +04:00
Joel Brobecker 5dd8bf886a update copyright year in version output of gdb, gdbserver and gdbreplay
gdb/ChangeLog:

        * top.c (print_gdb_version): Change copyright year to 2020.

gdb/gdbserver/ChangeLog:

        * server.c (gdbserver_version): Change copyright year to 2020.
        * gdbreplay.c (gdbreplay_version): Likewise.
2020-01-01 08:46:58 +04:00
Joel Brobecker 9f71dacbc3 Rotate gdb/ChangeLog (start of New Year procedure)
gdb/ChangeLog:

	* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2019
2020-01-01 08:40:23 +04:00
Tom Tromey 3d34df0aa7 Make some TUI globals "static"
This changes a few TUI globals to be "static".  Tested by rebuilding.

gdb/ChangeLog
2019-12-30  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_border_mode_translate)
	(tui_border_kind_translate_vline, tui_border_kind_translate_hline)
	(tui_border_kind_translate_ulcorner)
	(tui_border_kind_translate_urcorner)
	(tui_border_kind_translate_llcorner)
	(tui_border_kind_translate_lrcorner, tui_active_border_mode)
	(tui_border_mode, tui_border_kind): Now static.

Change-Id: Ibb49a0df195dfe780a5ba1f90e9125ab5f6b7ce1
2019-12-30 09:11:32 -07:00
Tom Tromey 87d557ae1b Use "bool" in more spots in TUI
This changes a few spots in the TUI to use "bool" rather than "int".
Tested on x86-64 Fedora 28.

gdb/ChangeLog
2019-12-30  Tom Tromey  <tom@tromey.com>

	* tui/tui-interp.c (tui_start_enabled): Now bool.
	(_initialize_tui_interp): Update.
	* tui/tui-hooks.c (tui_refreshing_registers): Now bool.
	(tui_register_changed)
	(tui_refresh_frame_and_register_information): Update.
	* tui/tui-win.c (tui_update_variables): Return bool.
	* tui/tui-win.h (tui_update_variables): Return bool.
	* tui/tui.c (tui_get_command_dimension): Return bool.
	* tui/tui.h (tui_get_command_dimension): Return bool.

Change-Id: I55b7f2d62d2ef88da3587dc914ada9f463ad8d2b
2019-12-30 09:07:33 -07:00
Bernd Edlinger c296cbe681 Fix setting breakpoints or stepping on line 65535
This removes code that was present from the very first git revisison
7b4ac7e1ed from 1988.  It was in the
gdb/dbxread.c at the time (and makes more sense for dbx line info format
since line numbers are 16-bit entities in that debug format and debugging
files with more than 65535 lines would not work anyway) but moved from
there to gdb/buildsym.c which is used for dwarf line info as well, and
excluding an arbitrary line number does certainly not make sense nowadays.

Add a test case for line 65535

gdb:
2019-12-29  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* buildsym.c (buildsym_compunit::record_line): Do no longer ignore
	line 65535.

gdb/testsuite:
2019-12-29  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gdb.base/line65535.exp: New file.
	* gdb.base/line65535.c: New file.
2019-12-29 22:34:29 +01:00
Tom Tromey ace206a5a5 Remove dead code from TUI
I found some dead code in the TUI -- some using #if 0, and some
commented-out code.  There's no reason to keep this, so this patch
removes it.

gdb/ChangeLog
2019-12-27  Tom Tromey  <tom@tromey.com>

	* tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove
	commented-out code.
	* tui/tui.c: Remove #if 0 code.

Change-Id: Ie00933b2ba498417ce22e5da3f62f5a40c234f33
2019-12-27 09:44:34 -07:00
Tom Tromey f9ba974dea Reorder an "if" in print_disassembly
I noticed that print_disassembly has two #if blocks for TUI code,
where one would do.  This patch rearranges the code slightly to remove
a #if.

gdb/ChangeLog
2019-12-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (print_disassembly): Reorder "if".

Change-Id: I36f3f682f5685b3d9b148da5aed26eb3cc7d598e
2019-12-27 09:33:37 -07:00
Tom Tromey a1e4dee435 Change tui_active to bool
This changes tui_active and tui_finish_init to have type "bool".

gdb/ChangeLog
2019-12-27  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_active): Now bool.
	(tui_finish_init): Likewise.
	(tui_enable): Update.
	(tui_disable): Update.
	(tui_is_window_visible): Update.
	* tui/tui.h (tui_active): Now bool.

Change-Id: Ia159ae9beb041137e34956b77f5bcf4e83eaf2b9
2019-12-27 09:33:36 -07:00
Tom Tromey 1630140dc6 Remove tui_gen_win_info::viewport_height
tui_gen_win_info::viewport_height is only used in a couple of spots,
and is redundant with "height".  This patch removes viewport_height.

gdb/ChangeLog
2019-12-27  Tom Tromey  <tom@tromey.com>

	* tui/tui-source.c (tui_source_window::maybe_update): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from):
	Update.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <viewport_height>:
	Remove.
	* tui/tui-command.c (tui_cmd_window::resize): Update.

Change-Id: I020e026fbe289adda8e2fdfebca91bdbdbc312e8
2019-12-27 09:33:36 -07:00
Christian Biesinger 4d4eaa3005 Make symbol_set_names a member function
This also renames it to make it clearer that this is not a cheap
function (to compute_and_set_names).  Also renames name to m_name
to make the implementation of the renamed function more readable.

Most of the places that access sym->m_name directly were also changed
to call linkage_name () instead, to make it clearer which name they
are accessing.

gdb/ChangeLog:

2019-12-26  Christian Biesinger  <cbiesinger@google.com>

	* ada-lang.c (ada_decode_symbol): Update.
	* buildsym.c (add_symbol_to_list): Update.
	* coffread.c (process_coff_symbol): Update.
	* ctfread.c (ctf_add_enum_member_cb): Update.
	(new_symbol): Update.
	(ctf_add_var_cb): Update.
	* dwarf2read.c (fixup_go_packaging): Update.
	(dwarf2_compute_name): Update.
	(new_symbol): Update.
	* jit.c (finalize_symtab): Update.
	* language.c (language_alloc_type_symbol): Update.
	* mdebugread.c (new_symbol): Update.
	* minsyms.c (minimal_symbol_reader::record_full): Update.
	(minimal_symbol_reader::install): Update.
	* psymtab.c (print_partial_symbols): Update.
	(psymbol_hash): Update.
	(psymbol_compare): Update.
	(add_psymbol_to_bcache): Update.
	(maintenance_check_psymtabs): Update.
	* stabsread.c (define_symbol): Update.
	* symtab.c (symbol_set_names): Rename to...
	(general_symbol_info::compute_and_set_names): ...this.
	(general_symbol_info::natural_name): Update.
	(general_symbol_info::search_name): Update.
	(fixup_section): Update.
	* symtab.h (struct general_symbol_info) <name>: Rename to...
	<m_name>: ...this.
	<compute_and_set_names>: Rename from...
	(symbol_set_names): ...this.
	(SYMBOL_SET_NAMES): Remove.
	(struct symbol) <ctor>: Update.

Change-Id: I8da1f10cab4e0b89f19d5750fa4e6e2ac8d2b24f
2019-12-27 01:41:35 -03:00
Christian Biesinger 8fb7532331 Add a NEWS entry for multithreaded symbol loading
Now that we enabled it by default, this change adds a NEWS entry for it.

gdb/ChangeLog:

2019-12-26  Christian Biesinger  <cbiesinger@google.com>

	* NEWS: Mention that multithreaded symbol loading is now on by
	default.

Change-Id: Ic344596a3b1b6e612a0071a50df49588b833c15d
2019-12-26 23:22:20 +01:00
Ruslan Kabatsayev 3142e908d0 Fix printing ULONGEST variables on x86-32
gdb/ChangeLog
2019-12-26  Ruslan Kabatsayev  <b7.10110111@gmail.com>

        * dwarf2read.c (is_valid_DW_AT_defaulted)
        (is_valid_DW_AT_calling_convention_for_type)
        (is_valid_DW_AT_calling_convention_for_subroutine): Fix printing
        ULONGEST variables on x86-32.
2019-12-26 00:12:43 +03:00
George Barrett cb73644141 Fix disabling of solib probes when LD_AUDITing
The SVR4 solib event handler determines whether an event is related to a
non-base link namespace by comparing the event's debug struct address
to the debug struct address of the initial program image. However, this
can fail when using LD_AUDIT as audit libraries are loaded before the
loader has initialised the initial program image's debug struct. When
the event handler fails to find the debug struct, the probe-based
debugger interface is disabled and a warning is flagged to the user.

This commit adds a fallback test to help determine whether an event is
for a foreign link namespace when the debug struct isn't available.

gdb/ChangeLog:
2019-12-15  George Barrett  <bob@bob131.so>

	* solib-svr4.c (svr4_handle_solib_event): Add fallback link
	namespace test for when the debug struct isn't available.
2019-12-21 16:02:19 -05:00
Eli Zaretskii 15b07e4f56 Include xxHash support status in GDB configuration report
gdb/ChangeLog
2019-12-21  Eli Zaretskii  <eliz@gnu.org>

	* top.c (print_gdb_configuration): Print "--with-xxhash" or
	"--without-xxhash" according to HAVE_LIBXXHASH.
2019-12-21 09:23:44 +02:00
Weimin Pan 1c7148dd0d Address Tom Tromey's comments on the CTF reader.
* Use the type-safe registry for ctf_file_key;
 * Drop "typedef" when defining "struct ctf_context";
 * Use ANOFFSET with SECT_OFF_TEXT to get the text base address;

gdb/ChangeLog
2019-12-20  Weimin Pan  <weimin.pan@oracle.com>
        * ctfread.c (ctf_file_key): Change type to objfile_key.
        (struct ctf_context): Remove typedef.
        (get_objfile_text_range): Use ANOFFSET to get text base.
2019-12-20 22:30:17 +00:00
Tankut Baris Aktemur d0922fcf02 Use enum bitfield for the calling_convention attribute of a subroutine
This is a refactoring.  Instead of a plain unsigned value, use an enum
bitfield.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (is_valid_DW_AT_calling_convention_for_subroutine):
	New function.
	(read_subroutine_type): Validate the parsed
	DW_AT_calling_convention value before assigning it to a
	subroutine's calling_convention attribute.
	* gdbtypes.h (struct func_type) <calling_convention>: Use
	an enum bitfield as its type, instead of plain unsigned.

Change-Id: Ibc6b2f71e885cbc5c3c9d49734f7125acbfd1bcd
2019-12-20 19:27:29 +01:00
Tankut Baris Aktemur 099a6354da infcall: handle pass-by-reference arguments appropriately
If an aggregate argument is implicitly pass-by-reference, allocate a
temporary object on the stack, initialize it via the copy constructor
(if exists) or trivially by memcpy'ing.  Pass the reference of the
temporary to the callee function.  After the callee returns, invoke
the destructor of the temporary.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	PR gdb/25054
	* infcall.c (call_function_by_hand_dummy): Update the argument-
	passing section for call-by-value parameters.
	(struct destructor_info): New struct.
	(call_destructors): New auxiliary function.

Change-Id: I18fa5d0df814dfa0defe9e862a88a6dbf1d99d01
2019-12-20 17:43:06 +01:00
Tankut Baris Aktemur 62bf63d74d infcall, c++: collect more pass-by-reference information
Walk through a given type to collect information about whether the
type is copy constructible, destructible, trivially copyable,
trivially copy constructible, trivially destructible.  The previous
algorithm returned only a boolean result about whether the type is
trivially copyable.  This patch computes more info.  Additionally, it
utilizes DWARF attributes that were previously not taken into account;
namely, DW_AT_deleted, DW_AT_defaulted, and DW_AT_calling_convention.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gnu-v3-abi.c (enum definition_style): New enum type.
	(get_def_style): New function.
	(is_user_provided_def): New function.
	(is_implicit_def): New function.
	(is_copy_or_move_constructor_type): New function.
	(is_copy_constructor_type): New function.
	(is_move_constructor_type): New function.
	(gnuv3_pass_by_reference): Collect language_pass_by_ref_info
	for a given type.

Change-Id: Ic05bd98a962d07ec3c1ad041f709687eabda3bb9
2019-12-20 17:43:06 +01:00
Tankut Baris Aktemur 9d084466d7 infcall, c++: allow more info to be computed for pass-by-reference values
In C++, call-by-value arguments that cannot be trivially copied are
implicitly passed by reference.  When making an infcall, GDB needs to
find out if an argument is pass-by-reference or not, so that the
correct semantics can be followed.  This patch enriches the
information computed by the language ops for pass-by-reference
arguments.  Instead of a plain binary result, the computed information
now includes whether the argument is

  - copy constructible
  - destructible
  - trivially copyable
  - trivially copy constructible
  - trivially destructible

This information is stored in a struct named 'language_pass_by_ref_info'.

This patch paves the way for GDB's infcall mechanism to call the copy
ctor and the destructor of a pass-by-ref argument appropriately.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* language.h (struct language_pass_by_ref_info): New struct.
	(struct language_defn)<la_pass_by_reference>: Change the signature
	to return a language_pass_by_ref_info instead of an int.
	(language_pass_by_reference): Ditto.
	(default_pass_by_reference): Ditto.
	Adjust the users listed below.
	* arch-utils.c (default_return_in_first_hidden_param_p):
	Update.
	* cp-abi.c (cp_pass_by_reference): Update.
	* cp-abi.h (cp_pass_by_reference): Update declaration.
	(struct cp_abi_ops)<pass_by_reference>: Update.
	* gnu-v3-abi.c (gnuv3_pass_by_reference): Update.
	* infcall.c (call_function_by_hand_dummy): Update.
	* language.c (language_pass_by_reference): Update.
	(default_pass_by_reference): Update.
	* tic6x-tdep.c (tic6x_return_value): Update.

Change-Id: Ib1c1f87f2490a5737c469f7b7185ddc7f6a164cb
2019-12-20 17:43:06 +01:00
Tankut Baris Aktemur e35000a7f8 gdb: recognize new DWARF attributes: defaulted, deleted, calling conv.
Extend GDB's internal representation of types to include the
DW_AT_calling_convention, DW_AT_defaulted, and DW_AT_deleted attributes
that were introduced in DWARF5.

These attributes will be helpful in a future patch about infcall'ing
functions with call-by-value parameters.  GDB will use the attributes
to decide whether the type of a call-by-value parameter is implicitly
pass-by-reference.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (dwarf2_add_member_fn): Read the DW_AT_defaulted
	and DW_AT_deleted attributes of a function.
	(read_structure_type): Read the DW_AT_calling_convention attribute
	of a type.
	(is_valid_DW_AT_defaulted): New function.
	(is_valid_DW_AT_calling_convention_for_type): New function.
	* gdbtypes.h: Include dwarf2.h.
	(struct fn_field)<defaulted>: New field to store the
	DW_AT_defaulted attribute.
	(struct fn_field)<is_deleted>: New field to store the
	DW_AT_deleted attribute.
	(struct cplus_struct_type)<calling_convention>: New field to store
	the DW_AT_calling_convention attribute.
	(TYPE_FN_FIELD_DEFAULTED): New macro.
	(TYPE_FN_FIELD_DELETED): New macro.
	(TYPE_CPLUS_CALLING_CONVENTION): New macro.
	* gdbtypes.c (dump_fn_fieldlists): Update for the changes made
	to the .h file.
	(print_cplus_stuff): Likewise.

Change-Id: I54192f363115b78ec7435a8563b73fcace420765
2019-12-20 17:43:06 +01:00
Tom Tromey b4b49dcbff Don't call tui_show_source from tui_ui_out
This removes the call to tui_show_source from tui_ui_out.  This always
seemed like a hack, and now that the TUI is using the proper
observers, it seems not to be needed.

The rest of the logic remains, unfortunately, because it is needed to
suppress some gdb output in the TUI case.  We could probably find a
nicer way to do this (maybe a ui_out_flag), but I haven't attempted
this.

This was the last caller of tui_show_source, so this is removed as
well.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_show_source): Remove.
	* tui/tui.h (tui_show_source): Don't declare.
	* tui/tui-out.c (tui_ui_out::do_field_string): Don't call
	tui_show_source.

Change-Id: Id71098e597ee4ebfef0429562baa45f537bd2c2b
2019-12-20 09:15:59 -07:00
Tom Tromey eb390f499b Change tui_show_frame_info to return bool
This changes tui_show_frame_info to return bool.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.h (tui_show_frame_info): Return bool.
	* tui/tui-stack.c (tui_show_frame_info): Return bool.
	* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
	Update.

Change-Id: Id1374f04f919c30a9f50c1beeb70cbc10b9a8f3b
2019-12-20 09:15:58 -07:00
Tom Tromey fc9d2d724f Fix "list" command in the TUI
PR tui/18932 notes that "list" no longer works in the TUI.  At some
point in the past, it switched the TUI source window to show the
specified source; but now this source briefly flashes before the TUI
reverts to showing the current stack frame's source.

This patch fixes this bug by introducing a new observer that notices
when the user selected context has changed.  Then, the existing
before-prompt observer is updated to request the correct update:
either one based on the current stack frame, or one based on the
user's source symtab_and_line.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	PR tui/18932:
	* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
	Rename parameters.  Handle the not-from-stack-frame case.
	(from_stack, from_source_symtab): New globals.
	(tui_before_prompt, tui_normal_stop): Update.
	(tui_context_changed, tui_symtab_changed): New functions.
	(tui_attach_detach_observers): Attach new observers.

gdb/testsuite/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* gdb.tui/list-before.exp: New file.

Change-Id: I62013825f6c1afdd568a1c7a8c019b0c881131af
2019-12-20 09:15:58 -07:00
Tom Tromey a75cd9a2c1 Add observable to watch current source symtab
This patch adds an observable, so that a later patch can change the
TUI to notice when the user has selected a new source symtab, say via
"list".

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* source.c (struct current_source_location) <set, symtab, line>:
	New methods.
	<m_symtab, m_line>: Rename.  Now private.
	(get_current_source_symtab_and_line)
	(set_default_source_symtab_and_line)
	(set_current_source_symtab_and_line)
	(clear_current_source_symtab_and_line, select_source_symtab)
	(info_source_command, print_source_lines_base)
	(info_line_command, search_command_helper): Update.
	* observable.h (current_source_symtab_and_line_changed): Declare
	observable.
	* observable.c (current_source_symtab_and_line_changed): Define
	observable.

Change-Id: I3c0f6b40f2df84b590bdf5b5ec5ccd8423bb7f22
2019-12-20 09:15:57 -07:00
Tom Tromey 2dfd3df48d Use bool in tui_before_prompt
This changes tui_before_prompt to take a bool rather than an int.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-hooks.c (tui_before_prompt): Change parameter to bool.
	(tui_before_prompt, tui_normal_stop): Update.

Change-Id: I9c7f2b764748fe19621851dc4fed4775a6db211a
2019-12-20 09:15:57 -07:00
Tom Tromey 54217b84bd Don't call set_current_source_symtab_and_line from TUI
update_source_window_as_is calls set_current_source_symtab_and_line,
but I don't think there is any reason it should be doing this.  This
patch removes the call.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window_as_is): Don't call
	set_current_source_symtab_and_line.

Change-Id: I1152fc7c78150974bd3d555b8568a6f88b65dbe6
2019-12-20 09:15:56 -07:00
Tom Tromey 0ab92974ab Change set_locator_info to take a symtab_and_line
This changes set_locator_info to take a symtab_and_line, rather than
the individual components.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.h (struct tui_locator_window) <set_locator_info>:
	Take a symtab_and_line.
	* tui/tui-stack.c (tui_locator_window::set_locator_info): Take a
	symtab_and_line.
	(tui_show_frame_info): Update.

Change-Id: Icb58d67e6c5bdc034eede9e5bbe8c1d1e633fbb5
2019-12-20 09:15:56 -07:00
Tom Tromey ae4393e22c Remove a call to update_exec_info
tui_show_frame_info calls update_exec_info after calling
erase_source_content, but there's no need to do this, as
erase_source_content already clears the exec info.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.c (tui_show_frame_info): Don't call
	update_exec_info.

Change-Id: I63d658561028ac1bc0a0a2b7ac17da1b9c6134fe
2019-12-20 09:15:55 -07:00
Tom Tromey 77b97e0062 Display "main" on initial TUI startup
I noticed that even when there's a symbol file, "tui enable" won't
show "main" by default.  I think it should, and this patch fixes this.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable): Call tui_display_main.

gdb/testsuite/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* gdb.tui/list.exp: Check for source on initial listing.

Change-Id: Ic7bfc930e1179f5b61111e30a2dae46a98b00064
2019-12-20 09:15:55 -07:00
Tom Tromey 52469d7673 Reimplement tui_get_begin_asm_address
tui_get_begin_asm_address looks for the inferior's "main" to display
it.  I think this is incorrect in two ways.

First, it should probably instead use the user's most recent source
context, if one has been set.

Second, it uses a hard-coded list of "main" names, but gdb already has
a better approach to handling this.

This patch fixes both of these problems.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.c (tui_get_begin_asm_address): Use
	get_current_source_symtab_and_line, and main_name.

Change-Id: I77dc13d49148e8dec5aa3eeb357ce3968a68d0bd
2019-12-20 09:15:54 -07:00
Tom Tromey 5d49bf1b69 Simplify tui_update_source_windows_with_line
This changes tui_update_source_windows_with_line to take a
symtab_and_line, rather than separate parameters, and then updates the
caller.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_show_source): Update.
	* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
	* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
	a symtab_symbol_info, not a separate symtab and line.  Simplify.

Change-Id: I8803a0a6fd2938ceee859aea53a57ce582f3e80d
2019-12-20 09:15:54 -07:00
Tom Tromey 88180c0824 Simplify tui_update_source_windows_with_addr
After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each.  So, it can be simplified by using a loop instead.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
	Simplify.

Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
2019-12-20 09:15:53 -07:00
Tom Tromey 9f7540a5de Use symtab_and_line when updating TUI windows
This changes a few TUI source window methods to take a symtab_and_line
rather than separate symtab and tui_line_or_address parameters.  A
symtab_and_line already incorporates the same information, so this
seemed simpler.  Also, it helps avoid the problem that the source and
disassembly windows need different information -- both forms are
present in the SAL.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<set_contents, update_source_window_as_is, update_source_window>:
	Take a sal, not a separate symtab and tui_line_or_address.
	* tui/tui-winsource.c (tui_source_window_base::update_source_window)
	(tui_source_window_base::update_source_window_as_is): Take a sal,
	not a separate symtab and tui_line_or_address.
	(tui_update_source_windows_with_addr)
	(tui_update_source_windows_with_line)
	(tui_source_window_base::rerender)
	(tui_source_window_base::refill): Update.
	* tui/tui-source.h (struct tui_source_window) <set_contents>: Take
	a sal, not a separate symtab and tui_line_or_address.
	* tui/tui-source.c (tui_source_window::set_contents): Take a sal,
	not a separate symtab and tui_line_or_address.
	(tui_source_window::maybe_update): Update.
	* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Take
	a sal, not a separate symtab and tui_line_or_address.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Take a sal,
	not a separate symtab and tui_line_or_address.
	(tui_disasm_window::do_scroll_vertical)
	(tui_disasm_window::maybe_update): Update.

Change-Id: I6974a03589930a0f910c657ef50b7f6f7397c87d
2019-12-20 09:15:53 -07:00
Tom Tromey 57e4b379e9 Use start_line_or_addr in TUI windows
A few spots in the TUI source and disassembly windows referred to
content[0], where start_line_or_addr is equivalent.  This patch makes
this substitution.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_source_window_base::refill): Use
	start_line_or_addr.
	* tui/tui-source.c (tui_source_window::do_scroll_vertical): Use
	start_line_or_addr.
	* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Use
	start_line_or_addr.

Change-Id: I1fa807321cd7ad88b3cc5e41cc50f4d4e2d46271
2019-12-20 09:15:52 -07:00
Tom Tromey 61c33f105c Change tui_source_window_base::set_contents to return bool
This changes tui_source_window_base::set_contents to return bool,
rather than tui_status.  It also changes one implementation of
set_contents to use early returns rather than a variable, which IMO
makes it easier to follow.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<set_contents>: Return bool.
	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window_as_is): Update.
	* tui/tui-source.h (struct tui_source_window) <set_contents>:
	Return bool.
	* tui/tui-source.c (tui_source_window::set_contents): Return
	bool.  Simplify.
	* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
	Return bool.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Return
	bool.

Change-Id: I8c5212400cd7aadf35760c22d5344cd3b9435674
2019-12-20 09:15:52 -07:00
Tom Tromey 469b073133 Remove tui_source_window::show_symtab_source
tui_source_window::show_symtab_source is identical to
update_source_window, so remove the former.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr)
	(tui_update_source_windows_with_line): Call update_source_window.
	* tui/tui-source.h (struct tui_source_window)
	<show_symtab_source>: Don't declare.
	* tui/tui-source.c (tui_source_window::show_symtab_source):
	Remove.

Change-Id: I41781df2126e8bafad46d058532d52602a288e06
2019-12-20 09:15:51 -07:00
Tom Tromey 855f89b3da Remove tui_show_disassem
tui_show_disassem is just a wrapper for the update_source_window
method, and it only has a single caller.  This removes the function
and inlines the logic into that caller.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
	update_source_window directly.
	* tui/tui-disasm.h (tui_show_disassem): Don't declare.
	* tui/tui-disasm.c (tui_show_disassem): Remove.

Change-Id: I7ae7a3309f64a4a949c07a80c46e1664c7f12913
2019-12-20 09:15:51 -07:00
Tom Tromey d4669c0fc7 Remove some unnecessary focus switches
A couple of lower-level utility functions can change the TUI focus.
This seems incorrect to me -- focus switches should only be done
either by explicit user request, or ass a side effect of changing the
layout.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window_as_is): Don't switch focus.
	* tui/tui-disasm.c (tui_show_disassem): Don't switch focus.

Change-Id: I0a5bb8a407cf8d52e2fd23b0598eb9bce56b1251
2019-12-20 09:15:51 -07:00
Tom Tromey 1ae58f0c64 Simplify tui_source_window_base::maybe_update method
tui_source_window_base::maybe_update takes a symtab_and_line, plus a
separate line number and PC.  Because a symtab_and_line already holds
a line number and a PC, it is possible to remove these extra
parameters.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<maybe_update>: Remove line_no and addr parameters.
	* tui/tui-stack.c (tui_show_frame_info): Set PC on sal.  Update.
	* tui/tui-source.h (struct tui_source_window) <maybe_update>:
	Update.
	* tui/tui-source.c (tui_source_window::maybe_update): Remove
	line_no and addr parameters.
	* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
	Update.
	* tui/tui-disasm.c (tui_disasm_window::maybe_update): Remove
	line_no and addr parameters.

Change-Id: I33d8e1a669a179544edb4197f5f7c5429dfc368e
2019-12-20 09:15:50 -07:00
Tom Tromey 039298ec45 Remove some TUI asserts
This removes a few asserts from the TUI.  These asserts aren't useful,
because they simply check an invariant that's already ensured by the
type system.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_source_window_base::set_is_exec_point_at)
	(tui_source_window_base::update_breakpoint_info): Remove asserts.

Change-Id: I807e1e9bdb0cfa475e70375ceca3a5d4f2eb8d0b
2019-12-20 09:15:50 -07:00
Tom Tromey 8acfefcc8f Remove tui_show_disassem_and_update_source
tui_show_disassem_and_update_source only has a single caller.  This
patch simplifies that caller, by having it call tui_show_disassem, and
then removes tui_show_disassem_and_update_source.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
	tui_show_disassem.
	* tui/tui-disasm.h (tui_show_disassem_and_update_source): Don't
	declare.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Remove.

Change-Id: I7554eca8e259f3539ea7710f2ff369b4a630dd9d
2019-12-20 09:15:49 -07:00
Tom Tromey 5ebd54023c Remove parameters from tui_show_source
tui_show_source does not need its parameters, so this removes them.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.h (tui_show_source): Remove parameters.
	* tui/tui.c (tui_show_source): Remove parameters.
	* tui/tui-out.c (tui_ui_out::do_field_string): Update.

Change-Id: I7cbcf20175b459c269549f1832d4fb844cc573db
2019-12-20 09:15:49 -07:00
Tom Tromey c1b167d76e Change tui_update_locator_fullname to take a symtab
This changes tui_update_locator_fullname to take a symtab.  This
somewhat consolidates the "??" handling.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_show_source): Update.
	* tui/tui-winsource.c (tui_display_main): Update.
	* tui/tui-stack.h (tui_update_locator_fullname): Change parameter
	to symtab.
	* tui/tui-stack.c (tui_update_locator_fullname): Change parameter
	to symtab.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Update.

Change-Id: Ic61749517b44ac68561d829ff81f16976b830dec
2019-12-20 09:15:48 -07:00
Tom Tromey 364d710448 Make isearch change readline prompt in TUI
PR tui/23619 points out that isearch changes the prompt in the CLI gdb
(and in Bash) -- but not in the TUI.  This turns out to be easily
fixed by removing tui_rl_saved_prompt and instead using the prompt
that readline computes.

This is stored in rl_display_prompt, which according to git was added
in readline 6.2.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	PR tui/23619:
	* tui/tui-io.c (tui_rl_saved_prompt): Remove.
	(tui_redisplay_readline): Use rl_display_prompt.
	(tui_prep_terminal): Update.

Change-Id: Iae97e9776a5540bbe52c73b05e4707941d9cd11a
2019-12-20 08:49:52 -07:00
Christian Biesinger 0ad6b8ee70 Consistently quote variables used with "test"
This ensures that empty variables and variables with spaces are handled
correctly.

Code was inconsistent on whether the constant string (e.g. yes/no)
should also be quoted; I tried to be consistent with surrounding code.

This fixes the error Eli reported during configure with mingw (though that
was not fatal).

gdb/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.
	* configure.ac: Quote variable arguments of test.
	* gdbsupport/common.m4: Likewise.

gdb/gdbserver/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.
	* configure.ac: Quote variable arguments of test.

Change-Id: I220e78b52c7db88b9dd058eda604635b03464fac
2019-12-19 13:30:50 -06:00
Christian Biesinger d411762c45 Make the literal argument to pow a double, not an integer
Since pow takes doubles, pass 2.0 instead of 2 to pow ().

Conveniently, this fixes the ambiguous call to pow on Solaris 11
with gcc 5.5 (gcc211 on the compile farm), which has a "using std::pow"
directive in a system header, which brings in float/double/long double
overloads.  Fixes the build on Solaris with enable-targets=all.

gdb/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* score-tdep.c (score7_analyze_prologue): Pass 2.0 instead of
	2 to pow ().

Change-Id: Ib18e7e4749ddcbff0727b72a31198f8cb84d1993
2019-12-19 13:12:30 -06:00
Christian Biesinger 1cd4a20a27 Cast the log10 argument to double to disambiguate it
On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a
using std::log10; directive. This is unfortunate because std::log10 has
overloads for float/double/long double. To disambiguate this call,
cast the argument to double to fix the build.

gdb/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* tui/tui-source.c (tui_source_window::set_contents): Cast argument of
	log10 to double to fix Solaris 11 with gcc 5.5.

Change-Id: I6c0c52e9c172b529c899a435d430e5916aeef69f
2019-12-19 13:11:29 -06:00