Commit Graph

43437 Commits

Author SHA1 Message Date
Ali Tamur 9cab7ecda2 Fix float to LONGEST conversion.
The code used to have undefined behaviour when template parameter is float and
host_float is NaN, because it attempted to convert NaN value to LONGEST at the
last statement. This frequently caused crashes on tests that checked "info
all-registers" (at least when the code is compiled with clang; I didn't test
with gdb).

gdb/ChangeLog:

	*target-float.c (host_float_ops<T>::to_longest): Update
	implementation.
2019-09-11 12:21:50 -07:00
Christian Biesinger 67547d896b Change the type of copy_names from int to bool
This parameter is really a boolean, so change the type accordingly
and update the callers.

This is for symbol_set_names, add_psymbol_to_bcache, and
add_psymbol_to_list.

minimal_symbol_reader::record_full was already passing a bool
to symbol_set_names.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

	* dbxread.c (read_dbx_symtab): Update.
	* dwarf2read.c (load_partial_dies): Update.
	* mdebugread.c (parse_partial_symbols): Update.
	(handle_psymbol_enumerators): Update.
	* psympriv.h (add_psymbol_to_list): Change type of copy_names to bool.
	* psymtab.c (add_psymbol_to_bcache): Likewise.
	(add_psymbol_to_list): Likewise.
	* symtab.c (symbol_set_names): Likewise.
	* symtab.h (symbol_set_names): Likewise.
	* xcoffread.c (scan_xcoff_symtab): Update.
2019-09-11 12:43:45 -05:00
Tom Tromey 64b2d4a0a4 Introduce bfd_set_filename
This introduces a new bfd_set_filename function, which is then used in
various spots in gdb.  This allows for the removal of some casts.

bfd/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

	* opncls.c (bfd_set_filename): New function.
	* bfd-in2.h: Regenerate.

gdb/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

	* symfile-mem.c (symbol_file_add_from_memory): Use
	bfd_set_filename.
	* solib-darwin.c (darwin_bfd_open): Use bfd_set_filename.
	* solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.
2019-09-11 07:02:46 -06:00
Tom Tromey 2d60161648 Update "save gdb-index" documentation
This updates the "save gdb-index" documentation to reflect the new
state of Ada support.  It also corrects an existing grammatical error.

gdb/doc/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* gdb.texinfo (Index Files): Update Ada text.
2019-09-10 08:30:45 -06:00
Tom Tromey 8a51616424 Add Ada support to cc-with-tweaks.exp
This adds Ada support to the cc-with-tweaks.exp board file, so that we
can test Ada this way.  The cc-with-tweaks.sh script already works
reasonably well as a wrapper for gnatmake.

gdb/testsuite/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* boards/cc-with-tweaks.exp: Set GNATMAKE_FOR_TARGET.
2019-09-10 08:30:45 -06:00
Tom Tromey 3b00ef10a2 Add Ada support for .debug_names
This patch adds support for Ada to .debug_names.  I opted to leave
.gdb_index alone, because in my view it is a defunct format.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* dwarf-index-write.c (write_psymbols): Extend error message.
	(debug_names::insert): Add Ada code.
	(debug_names::write_psymbols): Remove Ada check.
	(debug_names) <m_string_obstack>: New member.
	* dwarf2read.c (gdb_index_symbol_name_matcher): Remove.
	(gdb_index_symbol_name_matcher::matches): Remove.
	(mapped_index_base::find_name_components_bounds): Add "lang"
	parameter.
	(mapped_index_base::build_name_components): Also split names
	according to Ada syntax.
	(dw2_expand_symtabs_matching_symbol): Loop over languages.  Change
	type of "match_callback".
	(check_match, check_find_bounds_finds)
	(dw2_expand_symtabs_matching): Update.
	(dw2_debug_names_iterator): Add new constructor.
	(dw2_debug_names_map_matching_symbols): New function.
	(dw2_debug_names_expand_symtabs_matching): Update.
	(dwarf2_debug_names_functions): Use
	dw2_debug_names_map_matching_symbols.
2019-09-10 08:30:45 -06:00
Tom Tromey aa39165480 Fix latent bug in .debug_names file-name handling
An internal Ada test case showed that the .debug_names code does not
compute the same list of file names as the partial symbol reader.  In
particular, the partial symbol reader uses the DW_AT_name of the CU:

  /* Allocate a new partial symbol table structure.  */
  filename = dwarf2_string_attr (comp_unit_die, DW_AT_name, cu);
  if (filename == NULL)
    filename = "";

  pst = create_partial_symtab (per_cu, filename);

This patch changes the .debug_names reader to follow.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* dwarf2read.c (dw2_get_file_names_reader): Add the
	CU's file name to the results.

gdb/testsuite/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/dgopt.exp: New file.
	* gdb.ada/dgopt/x.adb: New file.
2019-09-10 08:30:45 -06:00
Tom Tromey b054970d54 Change map_matching_symbols to take a lookup_name_info
This patch further simplifies the map_matching_symbols callback, by
having it take a lookup_name_info rather than a plain string.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (add_nonlocal_symbols): Combine calls to
	map_matching_symbols.  Update.
	* dwarf2read.c (dw2_map_matching_symbols): Update.
	* psymtab.c (match_partial_symbol): Change type; update.
	(psym_map_matching_symbols): Likewise.
	* symfile-debug.c (debug_qf_map_matching_symbols): Change
	type; update.
	* symfile.h (struct quick_symbol_functions)
	<map_matching_symbols>: Change "name" to be a lookup_name_info.
	Remove "match".
2019-09-10 08:30:45 -06:00
Tom Tromey 6a3dbf1bc6 Simplify psym_map_matching_symbols
This introduces a new helper function,
iterate_over_symbols_terminated, and changes psym_map_matching_symbols
to use it.  A subsequent patch will introduce a new user of this
function in the DWARF reader.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* psymtab.c (map_block): Remove.
	(psym_map_matching_symbols): Use iterate_over_symbols_terminated.
	* symtab.c (iterate_over_symbols_terminated): New function.
	* symtab.c (iterate_over_symbols_terminated): Declare.
2019-09-10 08:30:45 -06:00
Tom Tromey 6969f124b9 Change iterate_over_symbols to return bool
This changes iterate_over_symbols to return a bool.  This allows it to
be reused in another context in a subsequent patch.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (ada_iterate_over_symbols): Return bool.
	* language.h (struct language_defn) <la_iterate_over_symbols>:
	Return bool.
	* symtab.c (iterate_over_symbols): Return bool.
	* symtab.h (iterate_over_symbols): Return bool.
2019-09-10 08:30:45 -06:00
Tom Tromey 199b4314ef Change map_matching_symbols to take a symbol_found_callback_ftype
This changes map_matching_symbols to take a
symbol_found_callback_ftype, rather than separate callback and data
parameters.  This enables a future patch to clean up some existing
code so that it can more readily be shared.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (aux_add_nonlocal_symbols): Change type.
	(add_nonlocal_symbols): Update.
	* dwarf2read.c (dw2_map_matching_symbols): Change type.
	* psymtab.c (map_block, psym_map_matching_symbols): Change type.
	* symfile-debug.c (debug_qf_map_matching_symbols): Change type.
	* symfile.h (struct quick_symbol_functions) <map_matching_symbols>:
	Change type of "callback".  Remove "data".
2019-09-10 08:30:45 -06:00
Ali Tamur a084a2a6a1 DWARF 5 support: Handle dwo_id
* DW_UT_skeleton and DW_UT_split_compile compilation units have dwo ids
to match the compilation unit in the skeleton and .dwo files. The dwo_id is
in the header.

Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails.

This is part of an effort to support DWARF 5 in gdb.

gdb/ChangeLog:

        * dwarf2read.c (comp_unit_head): Update comment.
        (dwarf2_dwo_name): New function declaration.
        (dwarf_unit_type_name): New function declaration.
        (read_comp_unit_head): Add support for new compilation units,
        DW_UT_partial, DW_UT_skeleton, DW_UT_split_compile, DW_UT_split_type.
        Particularly, DW_UT_skeleton and DW_UT_split_compile have dwo_id
        (currently named as "signature") in their header. Also clarify error
        messages.
        (lookup_dwo_id): New function. Returns the dwo id of the given
        compile unit.
        (lookup_dwo_unit): Use the new lookup_dwo_id function.
        (init_cutu_and_read_dies): Use the new dwarf2_dwo_name and lookup_dwo_id
        functions.
        (create_dwo_cu_reader): Use the added lookup_dwo_id function.
        (dwarf2_dwo_name): Get the dwo name if present.
        (dwarf_unit_type_name): Convert DW_UT_* types to string for diagnostic
        purposes.
2019-09-09 18:35:43 -07:00
Tom Tromey 25a2915e8d Use ui_out for "info win"
This changes the "info win" command to use ui-out.  This yields
somewhat nicer table output.

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

	* tui/tui-win.c (tui_all_windows_info): Use ui_out.
2019-09-09 17:06:22 -06:00
Philippe Waroquiers e4df087431 Fix leak detected in python.c initialization code.
Valgrind reports the below leak.
Make the variable progname_copy static, so that Valgrind continues
to find a pointer to the memory given to Python.
Note that the comment in do_start_initialization and the Python documentation
indicates that the progname given to Py_SetProgramName cannot be freed.
However, in Python 3.7.4, Py_SetProgramName does:
void
Py_SetProgramName(const wchar_t *program_name)
{
    ...
    PyMem_RawFree(_Py_path_config.program_name);
    _Py_path_config.program_name = _PyMem_RawWcsdup(program_name);

So, it looks like 3.7.4 Python duplicates its argument, which explains
the leak found by Valgrind.
It looks better to respect the doc and not have GDB freeing the string
given to Py_SetProgramName, and avoid the leak error by declaring
the progname_copy static.
This will work with Python versions that really use this string without
duplicating it, and avoids a leak report for Python version that duplicates
it.

==4023== 200 bytes in 1 blocks are definitely lost in loss record 4,545 of 7,116^M
==4023==    at 0x4C29F33: malloc (vg_replace_malloc.c:307)^M
==4023==    by 0x446D27: xmalloc (alloc.c:60)^M
==4023==    by 0x657C77: do_start_initialization (python.c:1610)^M
==4023==    by 0x657C77: _initialize_python() (python.c:1823)^M
==4023==    by 0x75FE24: initialize_all_files() (init.c:231)^M
==4023==    by 0x708A94: gdb_init(char*) (top.c:2242)^M
==4023==    by 0x5E7460: captured_main_1 (main.c:857)^M
==4023==    by 0x5E7460: captured_main (main.c:1161)^M
==4023==    by 0x5E7460: gdb_main(captured_main_args*) (main.c:1186)^M
==4023==    by 0x4122D4: main (gdb.c:32)^M

gdb/ChangeLog
2019-09-09  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* python/python.c (do_start_initialization): Make progname_copy static,
	to avoid a leak report.
2019-09-09 23:50:37 +02:00
Tom Tromey 8634b4628e Truncate long TUI window titles
If a TUI window has a long title, it can overflow the title line.
This changes the TUI to use just the tail part of the title in this
case.

gdb/ChangeLog
2019-09-08  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (box_win): Truncate long window titles.

gdb/testsuite/ChangeLog
2019-09-08  Tom Tromey  <tom@tromey.com>

	* gdb.tui/resize.exp: Remove setup_xfail.
	* gdb.tui/regs.exp: Remove setup_xfail.
	* gdb.tui/basic.exp: Remove setup_xfail.
2019-09-08 14:06:54 -06:00
Simon Marchi c7f839cbf0 Change lookup_symbol's block_index parameter type to block_enum
The only two values valid to pass to the block_index parameter of
quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK,
part of enum block_enum.  Change the type of that parameter to
block_enum.

Change also the block_index field of dw2_symtab_iterator in the same
way..  This makes it consistent with dw2_debug_names_iterator, which
already uses block_enum for its block_index field.

This is a follow-up to this thread:

https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html

gdb/ChangeLog:

	* dwarf2read.c (struct dw2_symtab_iterator) <block_index>:
	Change type to gdb::optional<block_enum>.
	(dw2_symtab_iter_init): Change block_index parameter type
	to gdb::optional<block_enum>.
	(dw2_lookup_symbol): Change block_index parameter
	type to block_enum.c
	(dw2_debug_names_lookup_symbol): Likewise.
	* psymtab.c (psym_lookup_symbol): Likewise.
	* symfile-debug.c (debug_qf_lookup_symbol): Likewise.
	* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
	Likewise.
2019-09-07 12:06:01 -04:00
David Blaikie 736b0f7618 un-XFAIL under Clang tests using labels
gdb/testsuite/
	* gdb.base/label.exp: un-XFAIL label related tests under Clang.
	* gdb.cp/cplabel.exp: Ditto.
	* gdb.linespec/ls-errs.exp: Ditto.
2019-09-06 14:17:36 -07:00
Christian Biesinger ead0e69a4a Change int to bool for the relocate_* functions
These parameters are only used as bools. This also
renames "flag" to "relocatable" to make it clearer
what it does.

gdb/ChangeLog:

2019-09-06  Christian Biesinger  <cbiesinger@google.com>

	* defs.h (relocate_gdb_directory): Change int to bool in
	signature and rename flag to relocatable.
	* main.c (relocate_path): Likewise.
	(relocate_gdb_directory): Likewise.
2019-09-06 14:34:00 -05:00
Alan Modra b16c44debc bfd_get_filename
This macro says:
/* Cast from const char * to char * so that caller can assign to
   a char * without a warning.  */

I reckon that isn't such a good idea since it can result in char*
variables where const char* is appropriate.  Not very many places
need the char* cast.

bfd/
	* aout-target.h (object_p): Formatting.
	* bfd-in.h (bfd_get_filename): Don't cast to char*.
	* corefile.c (generic_core_file_matches_executable_p): Constify
	variables and remove cast.
	* bfd-in2.h: Regenerate.
binutils/
	* nm.c (print_object_filename_bsd, print_object_filename_sysv),
	(print_object_filename_posix, print_archive_filename_bsd),
	(print_archive_filename_sysv, print_archive_filename_posix),
	(print_archive_member_bsd, print_archive_member_sysv),
	(print_archive_member_posix): Constify parameter.
	(struct output_fns <print_object_filename, print_archive_filename>),
	(<print_archive_member>): Likewise.
	* objcopy.c (copy_archive): Add cast for make_tempdir.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify
	variable.
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
gdb/
	* coffread.c (coff_symfile_read): Constify filename variable.
	* dbxread.c (dbx_symfile_init, coffstab_build_psymtabs),
	(elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise.
	* gdb_bfd.c (gdb_bfd_close_or_warn): Likewise.
	* solib.c (reload_shared_libraries_1): Likewise.
	* symfile.c (reread_symbols): Likewise.
	* solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename.
	* solib-darwin.c (darwin_bfd_open): Likewise.
	* symfile-mem.c (symbol_file_add_from_memory): Likewise.
sim/cris/
	* sim-if.c (sim_open): Constify filename variable.
2019-09-06 12:22:59 +09:30
Tom de Vries 30331a6ca0 [gdb/testsuite] Restore breakpoint command in ui-redirect.exp
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write
the current breakpoints to a file, but the actual output is not verified.

Consequently, the test has regressed in that the "print 1" command associated
with a breakpoint on main is removed by a subsequent runto_main, which first
deletes all breakpoints:
...
(gdb) break main
Breakpoint 1 at 0x4004d7: file start.c, line 34.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
> PASS: gdb.base/ui-redirect.exp: commands
print 1
> PASS: gdb.base/ui-redirect.exp: print 1
end
(gdb) PASS: gdb.base/ui-redirect.exp: end
delete breakpoints
Delete all breakpoints? (y or n) y
...
and consequently the "save breakpoint" output is missing the breakpoint
command for main:
...
 break main
-  commands
-    print 1
-  end
 break foo
 break bar
...

Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the
"save breakpoints" output.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-05  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (cmp_file_string): New proc.
	* gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with
	runto_main.  Verify save breakpoints output.
2019-09-05 14:33:10 +02:00
Philippe Waroquiers 98b0ebab0a Avoid expect's buffer overflow in info-var.exp test.
Once the executable is started, info variables can show thousands
of variables belonging to glibc (see below).

This long list of variables then causes the test to fail, due
to expect's buffer overflow:
  Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ...
  ERROR: internal buffer is full.
  ERROR: internal buffer is full.
  ERROR: internal buffer is full.

Fix this by testing 'info variables' without running the executable.

gdb ./info-var
...
Reading symbols from ./info-var...
(gdb) |info variables|wc
     27      54     971
(gdb) start
Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23.
Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var

Temporary breakpoint 1, main ()
    at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23
23	  return global_var + get_offset() + f1_var;
(gdb) |info variables|wc
   4334   14581  130738
(gdb)

gdb/testsuite/ChangeLog
2019-09-04  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/info-var.exp: Test info variables without running
	to main, to avoid expect's buffer overflow.
2019-09-04 22:16:56 +02:00
Andrew Burgess 06ff036ed2 gdb: Handle missing domain types in: maintenance print psymbols
Some domain_enum values were not handled in print_partial_symbols
which means that 'maintenance print psymbols' would print '<invalid
domain>' when it shouldn't have.

gdb/ChangeLog:

	* psymtab.c (print_partial_symbols): Handle missing domain_enum
	values MODULE_DOMAIN and COMMON_BLOCK_DOMAIN.
2019-09-03 22:29:07 +01:00
Tom Tromey 4e962e74e4 Handle biased types
In Ada, the programmer can request that a range type with a non-zero
base be stored in the minimal number of bits required for the range.
This is done by biasing the values; so, for example, a range of -7..-4
may be stored as two bits with a bias of -7.

This patch implements this for gdb.  It is done by adding a bias to
struct range_bounds and then adjusting a few spots to handle this.

The test case is written to use -fgnat-encodings=minimal, but a future
compiler patch will change the compiler to emit DW_AT_GNU_bias with
-fgnat-encodings=gdb.  It seemed good to get the gdb patch in first.

Tested on x86-64 Fedora 29; plus a variety of targets using AdaCore's
internal test suite.

gdb/ChangeLog
2019-09-03  Tom Tromey  <tromey@adacore.com>

	* ada-valprint.c (ada_val_print_num): Don't recurse for range
	types.
	(has_negatives): Unbias a range type bound.
	* dwarf2read.c (read_subrange_type): Handle DW_AT_GNU_bias.
	* gdbtypes.c (operator==): Handle new field.
	(create_range_type): Add "bias" parameter.
	(create_static_range_type, resolve_dynamic_range): Update.
	* gdbtypes.h (struct range_bounds) <bias>: New member.
	(create_range_type): Add bias parameter.
	* printcmd.c (print_scalar_formatted): Unbias range types.
	* value.c (unpack_long): Unbias range types.
	(pack_long): Bias range types.

gdb/testsuite/ChangeLog
2019-09-03  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/bias.exp: New file.
	* gdb.ada/bias/bias.adb: New file.
	* gdb.ada/print_chars.exp: Add regression test.
	* gdb.ada/print_chars/foo.adb (My_Character): New type.
	(MC): New variable.
2019-09-03 10:20:40 -06:00
Alan Hayward d90b8f2632 Check arguments for all probes before using them
There is a long standing bug in the Arm toolchain where invalid
stap probes get created due to the probes referring to symbols which
have been resolved away.

More details are here:
https://bugzilla.redhat.com/show_bug.cgi?id=1196181

When these invalid probes are present, GDB will create the breakpoints
and then fail to stop. The errors are only spotted the first time
GDB stops, which is too late.

The solution is to ensure the arguments for all the probes are
resolved before using them.

This fixes >100 timeouts when running break-interp.exp when using
bad probes.

gdb/ChangeLog:

	* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Check all
	probe arguments.
2019-09-02 14:00:42 +01:00
Alan Hayward fe01123efb Use gdbarch for probe::get_argument_count
The probe function get_argument_count does not need a frame, only
the current gdbarch.  Switch the code to pass gdbarch instead.
No functional changes.

gdb/ChangeLog:

	* break-catch-throw.c (fetch_probe_arguments): Use gdbarch.
	* dtrace-probe.c (dtrace_probe::get_argument_count): Likewise.
	* probe.c (probe_safe_evaluate_at_pc) (compute_probe_arg)
	(compile_probe_arg): Likewise.
	* probe.h (get_argument_count): Likewise.
	* solib-svr4.c (solib_event_probe_action): Likewise.
	* stap-probe.c (stap_probe::get_argument_count): Likewise.
2019-09-02 13:58:48 +01:00
Alan Hayward e661ef01e5 Refactor svr4_create_solib_event_breakpoints
Move the bulk of svr4_create_solib_event_breakpoints into a new
function to simplify the logic. No functional changes.

gdb/ChangeLog:

	* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Move
	code to here...
	(svr4_create_solib_event_breakpoints): ...from here.
2019-09-02 13:57:12 +01:00
Sergio Durigan Junior 47a536d940 Remove "\nError: " suffix from nat/fork-inferior.c:trace_start_error warning message
Rationale: https://sourceware.org/ml/gdb-patches/2019-08/msg00651.html

This very simple patch removes the "\nError: " suffix from the warning
message printed by nat/fork-inferior.c:trace_start_error.  This proved
to just pollute the screen, causing things like:

  Starting program: /usr/bin/true
  warning: Could not trace the inferior process.
  Error:
  warning: ptrace: Permission denied

This "Error: " string is not useful at all, and can confuse things,
therefore let's just remove it and simplify the resulting messages:

  Starting program: /usr/bin/true
  warning: Could not trace the inferior process.
  warning: ptrace: Permission denied

gdb/ChangeLog:
2019-08-30  Sergio Durigan Junior  <sergiodj@redhat.com>

	* nat/fork-inferior.c (trace_start_error): Remove "\nError: "
	suffix from warning message.
2019-08-30 17:04:37 -04:00
Tom Tromey d6a00eba2a Remove tui_win_info::refresh_all
The TUI has two duplicate "re-render this window" methods, "rerender"
and "refresh_all".  They differ only slightly in semantics, so I
wanted to see if they could be unified.

After looking into this, I decided that refresh_all was not needed.
There are 4 calls to tui_refresh_all_win (the only caller of this
method):

1. tui_enable.  This sets the layout, which renders the windows.

2. tui_cont_sig.  Here, I think it's sufficient to simply redraw the
   current window contents from the curses backing store, because gdb
   state didn't change while it was suspended

3. tui_dispatch_ctrl_char.  This is the C-l handler, and here it's
   explicitly enough to just refresh the screen (as above).

4. tui_refresh_all_command.  This is the command equivalent of C-l.

So, this patch removes this method entirely and simplifies
tui_refresh_all_win.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<refresh_all>: Don't declare.
	* tui/tui-winsource.c (tui_source_window_base::refresh_all):
	Remove.
	* tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or
	tui_show_locator_content.
	* tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't
	declare.
	* tui/tui-regs.c (tui_data_window::refresh_all): Remove.
	* tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't
	declare.
2019-08-30 12:57:10 -06:00
Tom Tromey 55b2657bdc Don't call wrefresh from tui_cont_sig
tui_cont_sig does not need to call wrefresh, because this is already
done by tui_refresh_all_win.

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

	* tui/tui-io.c (tui_cont_sig): Don't call wrefresh.
2019-08-30 12:57:10 -06:00
Tom Tromey 12a8555a54 Minor rearrangement of tui-stack.c
This move _initialize_tui_stack to the end of tui-stack.c, per the gdb
style; and then removes two unnecessary forward declarations.

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

	* tui/tui-stack.c (_initialize_tui_stack): Move later.
	Remove unnecessary forward declarations.
2019-08-30 12:57:09 -06:00
Tom Tromey 900ac24287 Make tui_locator_window::set_locator_fullname re-render
This changes tui_locator_window::set_locator_fullname to re-render the
locator window, so that the callers don't need to do this.

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

	* tui/tui-stack.c (tui_locator_window::set_locator_fullname): Call
	rerender.
	(tui_update_locator_fullname, tui_show_frame_info): Don't call
	tui_show_locator_content.
2019-08-30 12:57:09 -06:00
Tom Tromey 99ab33fb2d Swap tui_show_locator_content and tui_locator_window::rerender
This swaps the bodies ot tui_show_locator_content and
tui_locator_window::rerender, so that the latter does the work, and
the former is now just an exported convenience wrapper.

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

	* tui/tui-stack.c (tui_show_locator_content): Move lower.  Rewrite.
	(tui_locator_window::rerender): Rewrite using body of previous
	tui_show_locator_content.
2019-08-30 12:57:08 -06:00
Tom Tromey e594a5d19e Turn two locator functions into methods
This changes tui_set_locator_fullname and tui_set_locator_info to be
methods on tui_locator_window.  This enables some subsequent
cleannups.

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

	* tui/tui-stack.h (struct tui_locator_window) <set_locator_info,
	set_locator_fullname>: New methods.
	* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
	Rename from tui_set_locator_fullname.
	(tui_locator_window::set_locator_info): Rename from
	tui_set_locator_info.  Return bool.
	(tui_update_locator_fullname, tui_show_frame_info): Update.
2019-08-30 12:57:07 -06:00
Tom Tromey 715bb467fe Don't call tui_refresh_all from show_layout
show_layout calls tui_refresh_all in one case.  However, it doesn't
need to any more, because the resize method on each window will also
update the contents.

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

	* tui/tui-layout.c (show_layout): Don't call tui_refresh_all.
2019-08-30 12:57:07 -06:00
Tom Tromey 772f3f0398 Don't call touchwin in tui_gen_win_info::refresh_window
The call to touchwin in tui_gen_win_info::refresh_window was an
artifact of some earlier refactorings.  Testing shows it isn't needed
any more -- I believe it was only ever needed for the data item window
display problem; but that's been solved more locally.

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

	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Don't
	call touchwin.
2019-08-30 12:57:06 -06:00
Tom Tromey 108e13abdf Remove NULL checks from box_win
box_win can't be called with a NULL window, or with an invisible
window.  So, the NULL checks in that function can be removed.

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

	* tui/tui-wingeneral.c (box_win): Assume win_info and
	win_info->handle cannot be NULL.
2019-08-30 12:57:05 -06:00
Tom Tromey cdaa6eb439 Simplify register display
This patch starts with the observation that the code in
tui_data_window::display_registers_from can all be replaced with a
call to resize.  To make this work propertly, it also changes
tui_display_register to be the "rerender" method on
tui_data_item_window.

The refresh_window method is needed due to the use of nested windows
here.  The ncurses man page makes it sound like this is not very well
supported; and experience bears this out: negelecting the touchwin
call in this path will cause the register window to blank when
switching focus.

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

	* tui/tui-regs.h (struct tui_data_item_window) <rerender,
	refresh_window>: Declare.
	* tui/tui-regs.c (tui_data_window::display_registers_from): Call
	resize.
	(tui_data_item_window::rerender): Rename from
	tui_display_register.
	(tui_data_item_window::refresh_window): New method.
	* tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on
	no-op.
2019-08-30 12:57:05 -06:00
Tom Tromey 89df7f9056 Private data members in tui_data_window
This changes tui_data_window so that the data members are private.
This required the addition of a simple accessor method in one case.

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

	* tui/tui-regs.h (struct tui_data_window) <regs_content,
	regs_column_count, current_group>: Move later.  Now private.
	<get_current_group>: New method.
	* tui/tui-regs.c (tui_reg_command): Update.
	* tui/tui-layout.c (tui_set_layout): Update.
2019-08-30 12:57:04 -06:00
Tom Tromey 1bf2866a59 Remove some calls in tui_data_window
This patch removes a call to erase_data_content in refresh_all and
then removes some other calls that are more clearly unnecessary once
one follows calls from that point.

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

	* tui/tui-regs.c (tui_data_window::display_registers_from_line)
	(tui_data_window::rerender): Don't call
	check_and_display_highlight_if_needed.
	(tui_data_window::refresh_all): Remove call to
	erase_data_content.
2019-08-30 12:57:04 -06:00
Tom Tromey 0670413d0e Remove some checks of .empty()
A few methods in tui_data_window check whether the contents are empty;
but all the callers already check this, so these calls can be removed.

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

	* tui/tui-regs.c (tui_data_window::last_regs_line_no)
	(tui_data_window::display_registers_from)
	(tui_data_window::display_reg_element_at_line)
	(tui_data_window::display_registers_from_line): Remove checks of
	"empty".
2019-08-30 12:57:03 -06:00
Tom Tromey 18bb55c722 Remove tui_data_window::display_all_data
tui_data_window::rerender clears the data item windows, and then calls
display_all_data.  However, that method only does anything if the
contents are not empty.  So, display_all_data can be renamed and the
wrapper removed.

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

	* tui/tui-regs.h (struct tui_data_window) <display_all_data>:
	Don't declare.
	* tui/tui-regs.c (tui_data_window::show_registers): Call
	rerender.
	(tui_data_window::rerender): Rename from display_all_data.
	(tui_data_window::rerender): Remove old implementation.
2019-08-30 12:57:02 -06:00
Tom Tromey 1f6d2f100a Remove NO_DATA_STRING
NO_DATA_STRING shouldn't be used.  It's referenced in a single spot,
in tui_data_window::display_all_data.  This patch removes the use and
replaces it with the more correct text.  A later patch (though not in
this series) will remove this call entirely, when it's more obviously
correct to do so.

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

	* tui/tui-regs.c (tui_data_window::display_all_data): Change
	text.
	* tui/tui-data.h (NO_DATA_STRING): Remove define.
2019-08-30 12:57:02 -06:00
Sandra Loosemore 2ea1a07a0a Run argv0-symlink.exp only on native target and local host.
This testcase was originally for PR gdb/15415, a problem with the
"run" command expanding symlinks in the name of the program being run.
It does not correctly distinguish between files on build, host, and
target, and it is not clear if it would be testing anything useful in
configurations where "run" is not being used.

2019-08-29  Sandra Loosemore  <sandra@codesourcery.com>

	* gdb.base/argv0-symlink.exp: Run only on native target
	and local host.
2019-08-29 14:48:05 -07:00
Bernhard Wodok 16d01f9cd4 Fix PR win32/24284: tcp_auto_retry doesn't work in MinGW
This was reported by Bernhard Wodok, along with a patch to fix the
issue.  I adjusted the patch a bit, and I'm submitting the patch on
his behalf.

According to Bernhard, the issue can be reproduced by doing:

  1. start gdb
  2. enter 'target remote :2345'
  3. observe that it throws a "connection refused" error immediately
  instead of waiting and throwing a timeout error

I.e., I believe it can be reproduced by our current tests, which is
why I'm not proposing any extra tests here (well, I don't use nor have
any Windows system to test this, so...).

The problem happens because, on ser-tcp:wait_for_connect, we call
'gdb_select' passing 0 as its first argument, which, when using MinGW,
ends up using the 'gdb_select' version from mingw-hdep.c, and when the
first argument is 0 this means that WaitForMultipleObjects will be
called with 0 as its first argument as well.  According to the MS API
docs, this is forbidden:

  https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects

The proposed fix is simple: we just call Sleep when N == 0 (and when
TIMEOUT is non-NULL), and return 0.  It makes sense to me.

Both Bernhard and Paul Carroll confirmed that the fix works.  I'm
Cc'ing Bernhard in case you have any questions about the patch.

OK?

gdb/ChangeLog:
2019-08-29  Bernhard Wodok  <barto@gmx.net>
	    Sergio Durigan Junior  <sergiodj@redhat.com>

	PR win32/24284
	* mingw-hdep.c (gdb_select): Handle case when 'n' is zero.
2019-08-29 12:35:58 -04:00
Tom de Vries 8077c50dbb [gdb/testsuite] Fix gdb.fortran/info-types.exp regexp
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on
openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8.

Fix the gdb_test regexp to fix all those cases.

gdb/testsuite/ChangeLog:

2019-08-29  Tom de Vries  <tdevries@suse.de>

	* gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more
	diverse debug info.
	* lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
2019-08-29 14:43:11 +02:00
Tom de Vries 48352473b1 [gdb/testsuite] Fix info-var.exp for debug info from other files
On openSUSE Leap 15.1, I get:
...
FAIL: gdb.base/info-var.exp: info variables
FAIL: gdb.base/info-var.exp: info variables -n
...
because the info variables command prints info also for init.c:
...
File init.c:^M
24:     const int _IO_stdin_used;^M
...
while the regexps in the test-case only expect info for info-var-f1.c and
info-var-f2.c.

Fix this by extending the regexps.

Tested on x86_64-linux, both openSUSE Leap 15.1 and Fedora 30.

gdb/testsuite/ChangeLog:

2019-08-28  Tom de Vries  <tdevries@suse.de>

	* gdb.base/info-var.exp: Allow info variables to print info for files
	other than info-var-f1.c and info-var-f2.c.
2019-08-28 19:13:29 +02:00
Andrew Burgess d8f27c6018 gdb/fortran: Don't include module symbols when searching for types
Currently the 'info types' command will return symbols that correspond
to Fortran modules.  This is because the symbols are created with
domain MODULE_DOMAIN and address_class LOC_TYPEDEF.  The address_class
LOC_TYPEDEF is the same address_class used for type symbols which is
why the modules show up when listing types.

This commit explicitly prevents symbols in the MODULE_DOMAIN from
appearing when we search for symbols in the TYPES_DOMAIN, this
prevents the Fortran module symbols from appearing in the output of
'info types'.

gdb/ChangeLog:

	* symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols
	when searching for types.

gdb/testsuite/ChangeLog:

	* gdb.fortran/info-types.exp: Add module.
	* gdb.fortran/info-types.f90: Update expected results.
2019-08-28 13:33:55 +01:00
Andrew Burgess 1f20c35ea4 gdb/fortran: Implement la_print_typedef for Fortran
Implement an la_print_typedef method for Fortran, this allows 'info
types' to work for Fortran.  The implementation is just copied from
ada_print_typedef (with the appropriate changes).

To support the testing of this patch I added a new proc,
fortran_character1, to lib/fortran.exp which returns a regexp to match
a 1-byte character type.  The regexp returned is correct for current
versions of gFortran.  All of the other regexp are guesses based on
all of the other support procs in lib/fortran.exp, I haven't tested
them myself.

gdb/ChangeLog:

	* f-lang.c (f_language_defn): Use f_print_typedef.
	* f-lang.h (f_print_typedef): Declare.
	* f-typeprint.c (f_print_typedef): Define.

gdb/testsuite/ChangeLog:

	* gdb.fortran/info-types.exp: New file.
	* gdb.fortran/info-types.f90: New file.
	* lib/fortran.exp (fortran_character1): New proc.
2019-08-28 13:33:54 +01:00
Christian Biesinger 550105b779 Fix compiler warning in linux-namespaces.c
../../gdb/nat/linux-namespaces.c: In function ‘void mnsh_main(int)’:
../../gdb/nat/linux-namespaces.c:604:8: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  close (fd);
  ~~~~~~^~~~

And the warning is correct -- mnsh_recv_message can return -1 and leave fd
uninitialized, and mnsh_main will still call close (fd) if that happens.

Initialize fd to -1 to avoid that.

gdb/ChangeLog:

2019-08-27  Christian Biesinger  <cbiesinger@google.com>

	* nat/linux-namespaces.c (mnsh_main): Initialize fd (to -1).
2019-08-27 13:53:05 -05:00
Andrew Burgess 4acfdd20c9 gdb: Add new -n flag to some info commands
The 'info variables', its alias 'whereis', and 'info functions' all
include non-debug symbols in the output by default.  The list of
non-debug symbols can sometimes be quite long, resulting in the
debug symbol based results being scrolled off the screen.

This commit adds a '-n' flag to all of the commands listed above that
excludes the non-debug symbols from the results, leaving just the
debug symbol based results.

gdb/ChangeLog:

	* cli/cli-utils.c (info_print_options_defs): Delete.
	(make_info_print_options_def_group): Delete.
	(extract_info_print_options): Delete.
	(info_print_command_completer): Delete.
	(info_print_args_help): Add extra parameter, and optionally
	include text about -n flag.
	* cli/cli-utils.h (struct info_print_options): Delete.
	(extract_info_print_options): Delete declaration.
	(info_print_command_completer): Delete declaration.
	(info_print_args_help): Add extra parameter, extend header
	comment.
	* python/python.c (gdbpy_rbreak): Pass additional parameter to
	search_symbols.
	* stack.c (struct info_print_options): New type.
	(info_print_options_defs): New file scoped variable.
	(make_info_print_options_def_group): New static function.
	(info_print_command_completer): New static function.
	(info_locals_command): Update to use new local functions.
	(info_args_command): Likewise.
	(_initialize_stack): Add extra parameter to calls to
	info_print_args_help.
	* symtab.c (search_symbols): Add extra parameter, use this to
	possibly excluse non-debug symbols.
	(symtab_symbol_info): Add extra parameter, which is passed on to
	search_symbols.
	(struct info_print_options): New type.
	(info_print_options_defs): New file scoped variable.
	(make_info_print_options_def_group): New static function.
	(info_print_command_completer): New static function.
	(info_variables_command): Update to use local functions, and pass
	extra parameter through to symtab_symbol_info.
	(info_functions_command): Likewise.
	(info_types_command): Pass additional argument through to
	symtab_symbol_info.
	(rbreak_command): Pass extra argument to search_symbols.
	(_initialize_symtab): Add extra arguments for calls to
	info_print_args_help, and update help text for 'info variables',
	'whereis', and 'info functions' commands.
	* symtab.h (search_symbols): Add extra argument to declaration.
	* NEWS: Mention new flags.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Add information about the -n flag to
	"info variables" and "info functions".

gdb/testsuite/ChangeLog:

	* gdb.base/info-fun.exp: Extend to test the -n flag for 'info
	functions'.  Reindent as needed.
	* gdb.base/info-var-f1.c: New file.
	* gdb.base/info-var-f2.c: New file.
	* gdb.base/info-var.exp: New file.
	* gdb.base/info-var.h: New file.
2019-08-27 16:21:42 +01:00
Christian Biesinger 9aa5520697 Factor out the common code in lookup_{static,global}_symbol
The two functions are extremely similar; this factors out their code into
a shared _internal function.

gdb/ChangeLog:

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

	* symtab.c (lookup_static_symbol): Call the new function (and move
	it down to be next to lookup_global_symbol).
	(struct global_sym_lookup_data): Add block_enum member and rename to...
	(struct global_or_static_sym_lookup_data): ...this.
	(lookup_symbol_global_iterator_cb): Pass block_index instead of
	GLOBAL_BLOCK to lookup_symbol_in_objfile and rename to...
	(lookup_symbol_global_or_static_iterator_cb): ...this.
	(lookup_global_or_static_symbol): New function.
	(lookup_global_symbol): Call new function.
2019-08-26 16:24:33 -05:00
Tom de Vries 5c31b35808 [gdb, c++] Improve error message when using libstdcxx without SDT probes
When using catch catch/rethrow/catch, a libstdcxx with SDT probes is required
for both the regexp argument, and the convenience variable $_exception (
https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html ).

Currently, when using these features with a libstdcxx without SDT probes, we
get the cryptic error message:
...
not stopped at a C++ exception catchpoint
...

Improve this by instead emitting the more helpful:
...
did not find exception probe (does libstdcxx have SDT probes?)
...

Tested on x86_64-linux.

gdb/ChangeLog:

2019-08-26  Tom de Vries  <tdevries@suse.de>

	PR c++/24852
	* break-catch-throw.c (fetch_probe_arguments): Improve error mesage
	when pc_probe.prob == NULL.

gdb/testsuite/ChangeLog:

2019-08-26  Tom de Vries  <tdevries@suse.de>

	PR c++/24852
	* gdb.cp/no-libstdcxx-probe.exp: New test.
2019-08-26 19:24:59 +02:00
Tom de Vries b694989f50 [gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if true
The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests
need to be skipped, while tcl interprets 0 as false rather than true, which is
confusing.

Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need
to be skipped.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-26  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe
	* tests need to be skipped.
	* gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests.
	* gdb.mi/mi-catch-cpp-exceptions.exp: Update call to
	mi_skip_libstdcxx_probe_tests.
2019-08-26 18:48:02 +02:00
Sergio Durigan Junior d9c4ba536c Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape sequence")
The way unrecognized escape sequences are handled has changed in
Python 3.8: users now see a SyntaxWarning message, which will
eventually become a SyntaxError in future versions of Python:

  (gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py
  /blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque
  nce \+
    'operator\+',
  /blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque
  nce \+
    'operator\+\+',

One of our testcases, gdb.python/py-xmethods.exp, contains strings in
the form of "operator\+".  This is not recognized by Python, but is
still needed by the testsuite to work properly.  The solution is
simple: we just have to make sure these strings are marked as
raw (i.e, r"").  This is what this patch does.  I took the opportunity
to also convert other strings to raw, which, in two cases, allowed the
removal of an extra backslash.

I tested this using Python 3.7 and Python 3.8, and everything works
fine.

I think I could push this as obvious, but decided to send it to
gdb-patches just in case.

gdb/testsuite/ChangeLog:
2019-08-26  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.python/py-xmethods.exp: Use raw strings when passing
	arguments to SimpleXMethodMatcher.
2019-08-26 09:18:37 -04:00
Simon Marchi 23c13d4299 dwarf2read: fix compilation issue with gcc 4.8
gcc 4.8 (and probably other versions too) doesn't like that the local
variable symbol_linkage has the same name as the enum class defined in
the same context:

      CXX    dwarf2read.o
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c: In member function ‘dwarf2_per_cu_data* dw2_debug_names_iterator::next()’:
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c:5850:22: error: ‘symbol_linkage’ is not a class, namespace, or enumeration
       } symbol_linkage = symbol_linkage::unknown;
                      ^

Rename the local variable to avoid this.

This problem was originally reported with the Netbsd builder on the
buildbot, which uses gcc 5.5, I believe.  I am not able to test it on
that builder right now, but chances are that the fix will work there
too.

gdb/ChangeLog:

	* dwarf2read.c (dw2_debug_names_iterator::next): Rename local
	variable symbol_linkage to symbol_linkage_.
2019-08-25 21:30:12 -04:00
Simon Marchi beadd3e84e dwarf2read: replace gdb::optional<bool> with enum
gdb::optional<bool> is dangerous, because it's easy to do:

  if (opt_bool)

when you actually meant

  if (*opt_bool)

or vice-versa.  The first checks if the optional is set, the second
checks if the wrapped bool is true.

Replace it with an enum that explicitly defines the three possible
states.

gdb/ChangeLog:

	* dwarf2read.c (dw2_debug_names_iterator::next): Use enum to
	represent whether the symbol is static, dynamic, or we don't
	know.
2019-08-25 18:09:47 -04:00
Yoshinori Sato e3ec872f80 Convert the RX target to make use of target descriptions.
gdb/ChangeLog

2019-08-25  Yoshinori Sato <ysato@users.sourceforge.jp>

	* gdb/rx-tdep.c (rx_register_names): New.
	(rx_register_name): Delete.
	(rx_psw_type): Delete.
	(rx_fpsw_type): Delete.
	(rx_register_type): Delete.
	(rx_gdbarch_init): Convert target-descriptions.
	(_initialize_rx_tdep): Add initialize_tdesc_rx.
	* gdb/features/Makefile: Add rx.xml.
	* gdb/features/rx.xml: New.
	* gdb/features/rx.c: Generated.
	* gdb/NEWS: Mention target description support.

gdb/doc/ChangeLog:

2019-08-25  Yoshinori Sato <ysato@users.sourceforge.jp>

	* gdb.texinfo (Standard Target Features): Add RX Features sub-section.
2019-08-25 17:00:08 +09:00
Christian Biesinger d0509ba443 Fix compile warning in symtab.c
My compiler (g++ 8.2) can't tell that *bsc_ptr and *slot_ptr are
only used in the cases when it does get initialized. Just initialize
the vars earlier to avoid the warning, there does not seem to be a
downside to it.

../../gdb/symtab.c: In function ‘block_symbol lookup_static_symbol(const char*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     xfree (slot->value.not_found.name);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2578:29: note: ‘slot’ was declared here
   struct symbol_cache_slot *slot;
                             ^~~~
../../gdb/symtab.c:1405:3: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (bsc == NULL)
   ^~
../../gdb/symtab.c:2577:30: note: ‘bsc’ was declared here
   struct block_symbol_cache *bsc;
                              ^~~
../../gdb/symtab.c: In function ‘block_symbol lookup_global_symbol(const char*, const block*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     xfree (slot->value.not_found.name);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2658:29: note: ‘slot’ was declared here
   struct symbol_cache_slot *slot;
                             ^~~~
../../gdb/symtab.c:1409:14: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       ++bsc->collisions;
         ~~~~~^~~~~~~~~~
../../gdb/symtab.c:2657:30: note: ‘bsc’ was declared here
   struct block_symbol_cache *bsc;
                              ^~~

gdb/ChangeLog:

2019-08-22  Christian Biesinger  <cbiesinger@google.com>

	* symtab.c (symbol_cache_lookup): Always initialize *bsc_ptr and *slot_ptr.
2019-08-24 16:45:59 -05:00
Sergio Durigan Junior 2d41fa1165 Move gdb-dlfcn.[ch] to gdbsupport/
I need to use 'gdb_dlopen' inside 'gdbsupport/', but it's not yet
supported there.  This commit moves 'gdb-dlfcn.[ch]' to 'gdbsupport/',
which makes it available also on gdbserver.

gdb/ChangeLog:
2019-08-23  Sergio Durigan Junior  <sergiodj@redhat.com>

	* configure.ac: Don't check for 'dlfcn.h' (moved to
	gdbsupport/common.m4).
	* Makefile.in (COMMON_SFILES): Move 'gdb-dlfcn.c' to
	'gdbsupport/'.
	(HFILES_NO_SRCDIR): Likewise, for 'gdb-dlfcn.h'.
	* compile/compile-c-support.c: Include
	'gdbsupport/gdb-dlfcn.h'.
	* gdbsupport/common.m4: Check for 'dlfcn.h'.
	* gdb-dlfcn.c: Move to...
	* gdbsupport/gdb-dlfcn.c: ... here.
	* gdb-dlfcn.h: Move to...
	* gdbsupport/gdb-dlfcn.h: ... here.

gdb/gdbserver/ChangeLog:
2019-08-23  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SFILES): Add 'gdbsupport/gdb-dlfcn.c'.
	(OBS): Add 'gdbsupport/gdb-dlfcn.o'.
	* config.in: Regenerate.
	* configure: Regenerate.
2019-08-23 13:13:18 -04:00
Sandra Loosemore de8af80891 Fix bug in nios2 prologue analysis.
The nios2 prologue analyzer was mistakenly using an unsigned int field
to represent a 32-bit signed value.  This caused problems with an
incorrect conversion being applied to negative values when they were
automatically promoted for addition to a 64-bit CORE_ADDR value.

This patch fixes test failures in gdb.base/large-frame.exp and
gdb.dwarf2/dw2-ref-missing-frame.exp.  Normally the nios2 backend
prefers to use the dwarf2 unwinder so the prologue analyzer is only
invoked if there is no dwarf2 information.

2019-08-23  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (struct reg_value): Improve comments.  Make
	the offset field signed.
2019-08-23 08:18:54 -07:00
Christian Biesinger 272044897e Make GDB compile with Python 3 on MinGW
PyFile_FromString and PyFile_AsFile have been removed in Python 3.
There is no obvious replacement that works here, and we can't just
pass our FILE* to a DLL in Windows because it may use a different
C runtime.

So we just call a Python function which reads and executes file
contents. Care must be taken to execute it in the context of
__main__.

Tested by inverting the ifdef and running the testsuite on Debian
Linux (even without the patch, I failed at running the testsuite
on Windows). I did test with both Python 2 and 3.

gdb/ChangeLog:

2019-08-22  Christian Biesinger  <cbiesinger@google.com>

	* python/lib/gdb/__init__.py (_execute_file): New function.
	* python/python.c (python_run_simple_file): Call gdb._execute_file
	on Windows.
2019-08-22 17:44:58 -05:00
Tom de Vries 395fad095c [gdb/testsuite] Make gdb_test message more informative in multi-term-settings.exp
This racy fail message, reported in PR24929:
...
FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: \
  stop with control-c
...
does not make clear which gdb_test fails here:
...
    if {$expect_ttou} {
       gdb_test "" "Quit" "stop with control-c"
    } else {
       gdb_test "" "received signal SIGINT.*" "stop with control-c"
    }
...

Fix this by making the gdb_test message argument more informative.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-22  Tom de Vries  <tdevries@suse.de>

	* gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages
	more informative.
2019-08-22 16:54:59 +02:00
Andrew Burgess 43771869e5 gdb/fortran: Remove some dead code from the parser
The Fortran parser contains some code that looks like it was probably
inherited from the C/C++ parser as it checks to see if the current
language is C++, which should never be true when we're in the Fortran
parser.

gdb/ChangeLog:

	* f-exp.y (yylex): Remove is_a_field_of_this local variable, and
	all uses as this was never set to anything but a zero value.
2019-08-22 12:34:42 +01:00
Pedro Alves 26c957f127 Fix nullptr in with_command_1
Running 'with' without arguments crashes GDB.  This fixes it.

gdb/ChangeLog:
2019-08-21  Bogdan Harjoc  <harjoc@gmail.com>

	* cli/cli-cmds.c (with_command_1): Error out if no arguments.

gdb/testsuite/ChangeLog:
2019-08-21  Pedro Alves  <palves@redhat.com>

	* gdb.base/with.exp: Test "with" with no arguments.
2019-08-21 21:11:33 +01:00
Christian Biesinger c07aae6e72 Fix g++ 9.1 build breakage
gdb/ChangeLog:

2019-08-21  Christian Biesinger  <cbiesinger@google.com>

	* tui/tui-data.h (tui_gen_win_info): Add an =default
	move constructor, required by some GCC versions.
2019-08-21 15:09:50 -05:00
Jinke Fan 3960cb7a1b gdb/djgpp: Add Hygon Dhyana processor support
Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between
AMD and Haiguang Information Technology Co.,Ltd., which aims at
providing high performance x86 processors for the China server market.
Its first generation processor codename is Dhyana, which originates
from AMD technology and shares most of the architecture with AMD's
family 17h, but with different CPU Vendor ID("HygonGenuine")/Family
series number(Family 18h).

gdb/ChangeLog:
2019-08-21  Jinke Fan  <fanjinke51@yeah.net>

	* go32-nat.c (go32_sysinfo): Add hygon_p.
2019-08-21 18:07:39 +01:00
Tom de Vries 61f80d5daf [gdb/testsuite] Stabilize gdb-caching-proc.exp test order
The test-case gdb-caching-proc.exp tests each gdb_caching_proc in
gdb/testsuite/lib/*.exp.  However, the order of .exp file being tested can
change from run to run, because of using glob.

Fix this by sorting the glob result.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-21  Tom de Vries  <tdevries@suse.de>

	* gdb.base/gdb-caching-proc.exp: Sort files.
2019-08-21 11:49:33 +02:00
Tom Tromey 04c72a68e0 Change some tui_data_window methods to be private
Turning various calls into methods has made it possible to now change
some tui_data_window methods to be private.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_window) <last_regs_line_no,
	line_from_reg_element_no, first_reg_element_no_inline,
	display_all_data, delete_data_content_windows,
	erase_data_content>: Now private.
2019-08-20 16:45:50 -06:00
Tom Tromey 072272ce05 Remove some defines from tui-data.h
This removes the HILITE and NO_HILITE defines from tui-data.h, in
favor of simply passing a bool to box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (box_win): Change type of highlight_flag.
	(tui_unhighlight_win, tui_highlight_win)
	(tui_win_info::make_window): Update.
	* tui/tui-data.h (HILITE, NO_HILITE): Remove.
2019-08-20 16:45:50 -06:00
Tom Tromey 973961bda3 Move some defines to tui-stack.c
Some #defines in tui-data.h are only used in tui-stack.c, so move them
there.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
	(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
	(MAX_PID_WIDTH): Move to tui-stack.c.
	* tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
	(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
	(MAX_PID_WIDTH): Move from tui-data.h.
2019-08-20 16:45:50 -06:00
Tom Tromey ab0e1f1a45 Change tui_make_window to be a method
I combined several small changes into one patch here.  I believe I
started by noticing that the "title" is not needed by tui_gen_win_info
and could be self-managing (i.e. std::string).  Moving this revealed
that "can_box" is also a property of tui_win_info and not
tui_gen_win_info; and this in turn caused the changes to
tui_make_window and box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_window): Don't declare.
	* tui/tui-wingeneral.c (box_win): Change type of win_info.
	(box_win): Update.
	(tui_gen_win_info::make_window): Rename from tui_make_window.
	(tui_win_info::make_window): New method.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* tui/tui-regs.c (tui_data_window::show_register_group): Update.
	(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) <make_window>:
	Declare.
	<can_box>: Remove.
	<title>: Remove.
	(struct tui_win_info) <make_window>: Declare.
	<can_box>: Now virtual.
	<title>: New member.
	* tui/tui-data.c (~tui_gen_win_info): Don't free title.
	* tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 100c2bf31f Remove tui_data_window::display_regs
There's no need for tui_data_window::display_regs any more (if there
ever was).  All the paths through data window construction will end up
setting this to true.  This patch removes the member.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove.
	* tui/tui-regs.c (tui_data_window::show_registers): Update.
	(tui_data_window::check_register_values): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey fa4dc567ae Remove indirection from tui_data_window::regs_content
tui_data_window::regs_content is currently a vector of unique_ptr.
However, due to the way this is managed now, there is no need to keep
the pointers -- it can simply be a vector of the objects themselves.
This patch removes this extra layer of indirection.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_window): Use
	DISABLE_COPY_AND_ASSIGN.
	<regs_content>: Change type, removing unique_ptr.
	<tui_data_window>: Add move constructor.
	* tui/tui-regs.c (tui_data_window::show_registers)
	(tui_data_window::show_register_group)
	(tui_data_window::display_registers_from)
	(tui_data_window::display_registers_from)
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_data_window::rerender, tui_data_window::refresh_window)
	(tui_data_window::check_register_values): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey ca02d7c800 Add two methods to tui_data_window
This changes tui_show_registers and tui_show_register_group to be
methods on tui_data_window.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_window) <show_registers,
	show_register_group>: Declare.
	(tui_show_register_group): Don't declare.
	* tui/tui-regs.c (tui_data_window::show_registers): Rename from
	tui_show_registers.
	(tui_data_window::show_register_group): Rename from
	tui_show_register_group.
	(tui_data_window::check_register_values, tui_reg_command):
	Update.
	* tui/tui-layout.c (tui_set_layout): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 63356bfda1 Change tui_check_register_values to be a method
This changes tui_check_register_values to be a method on
tui_data_window.  An additional check in tui_register_changed is
needed, because TUI_DATA_WIN could be NULL at this point.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
	Declare.
	(tui_check_register_values): Don't declare.
	* tui/tui-regs.c (tui_data_window::check_register_values): Rename
	from tui_check_register_values.
	* tui/tui-hooks.c (tui_register_changed): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 42cc14a753 Rearrange tui-regs.c some more
This moves tui_reg_layout later in tui-regs.c, closer to where it is
used.

It also changes tui_show_registers not to enable the TUI or change the
layout -- this is already done by this point by all the callers.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_reg_layout): Move later.
	(tui_show_registers): Don't enable TUI mode or change layout.
2019-08-20 16:45:50 -06:00
Tom Tromey b9ad36868f Change tui_data_item_window::content to be a unique_xmalloc_ptr
This changes tui_data_item_window::content to be a unique_xmalloc_ptr
and fixes up the fallout.  It also removes a parameter from
tui_expand_tabs, as it was only ever given one value.

This also removes some tab-handling code from
tui_data_window::display_registers_from.  Because the content can only
be set by tui_register_format, and because that calls tui_expand_tabs,
it's not possible to see a tab here.

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

	* tui/tui-regs.h (struct tui_data_item_window)
	<~tui_data_item_window>: Remove.
	<content>: Now a unique_xmalloc_ptr.
	* tui/tui-regs.c (tui_register_format): Return a
	unique_xmalloc_ptr.
	(tui_get_register): Update.
	(~tui_data_item_window): Remove.
	(tui_data_window::display_registers_from, tui_display_register):
	Update.
	* tui/tui-io.h (tui_expand_tabs): Update.
	* tui/tui-io.c (tui_expand_tabs): Return a unique_xmalloc_ptr.
	Remove "col" parameter.
2019-08-20 16:45:50 -06:00
Tom Tromey 8e114aab8b Remove tui_data_item_window::value
The field tui_data_item_window::value is not used, so remove it.

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

	* tui/tui-regs.h (struct tui_data_item_window) <value>: Remove
	field.
	* tui/tui-regs.c (~tui_data_item_window): Update.
2019-08-20 16:22:05 -06:00
Tom Tromey 1a4f81dd7e Minor rearrangement in tui-regs.c
This moves a couple of functions earlier in tui-regs.c.  Previously
they were in the "command" section of the file, but really they belong
in the "window implementation" section.

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

	* tui/tui-regs.c (tui_register_format, tui_get_register): Move
	earlier.
2019-08-20 16:22:05 -06:00
Tom Tromey 0f8d8876d9 Remove NULL check from tui_reg_command
tui_reg_command has an unnecessary NULL check.  The preceding call to
tui_reg_layout will ensure the window exists.  This patch removes the
check.

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

	* tui/tui-regs.c (tui_reg_command): Remove NULL check.
2019-08-20 16:22:04 -06:00
Tom Tromey 605dc2c21d Some i18n fixes for the TUI
The TUI has a few #defines that hold user-visible strings.  As these
are only used in a single spot, this patch removes the defines,
preferring direct use of the string where needed.  Furthermore, now
the strings are wrapped in _(), which is friendlier for i18n purposes.

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

	* tui/tui-source.h (struct tui_source_window): Update.
	* tui/tui-regs.c (tui_show_registers): Update.
	* tui/tui-disasm.h (struct tui_disasm_window): Update.
	* tui/tui-data.h (NO_SRC_STRING, NO_DISASSEM_STRING)
	(NO_REGS_STRING): Remove defines.
2019-08-20 16:22:03 -06:00
Tom de Vries d7a11d1383 [gdb/testsuite] Clean up stale exec in gdb_compile_pascal
When running a pascal test with the stabs target board:
...
$ test=gdb.pascal/case-insensitive-symbols.exp
$ cd build/gdb/testsuite
$ make check RUNTESTFLAGS="$test --target_board=stabs"
...
we get:
...
nr of untested testcases         1
nr of unsupported tests          1
...
due to:
...
Error: Illegal parameter: -gstabs+^M
Error: /usr/bin/ppcx64 returned an error exitcode^M
...

OTOH, when running the same pascal test without the stabs target board:
...
$ make check RUNTESTFLAGS="$test"
...
we get:
...
nr of expected passes            20
...

But when subsequently again running with the stabs target board:
...
$ make check RUNTESTFLAGS="$test --target_board=stabs"
...
we now get:
...
nr of expected passes            20
...

The problem is that gdb_compile_pascal determines success based on existence
of the exec after compilation:
...
    if ![file exists $destfile] {
        unsupported "Pascal compilation failed: $result"
        return "Pascal compilation failed."
    }
...
without removing the exec before compilation, which allows a stale exec to
make it seem as if compilation has succeeded.

Fix this by removing the stale exec before compilation.

gdb/testsuite/ChangeLog:

2019-08-20  Tom de Vries  <tdevries@suse.de>

	* lib/pascal.exp (gdb_compile_pascal): Remove $destfile before
	compilation.
2019-08-20 17:18:09 +02:00
Conrad Meyer aedbe3bb9f Improve remote attach round-trips without btrace
For remotes which do not support btrace at all, we can save several
round trips for each thread.  This is especially significant when your
remote is a kernel with 100s or 1000s of threads and latency is
intercontinental.

Previously, with target, remote, and infrun debugging enabled, one
might see:

    Sending packet: $Hg18aee#43...Ack
    Packet received: OK
    Sending packet: $Hg186f7#eb...Ack
    Packet received: OK
    remote:target_xfer_partial (24, , 0x805454000, 0x0, 0x0, 4096) = -1, 0

repeated for all non-exited threads.

Afterwards, if the remote does not specify 'qXfer:btrace-conf:read+'
in qSupported stub features, these unnecessary thread switches are
avoided.

gdb/ChangeLog:

	* remote.c (remote_target::remote_btrace_maybe_reopen): Avoid
	unnecessary thread walk if remote doesn't support the packet.
2019-08-20 15:06:37 +01:00
Tom Tromey 7ce8f214f1 Fix indentation in value_has_field
value_has_field had a mis-indented line.  This fixes it.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tromey@adacore.com>

	* python/py-value.c (value_has_field): Fix indentation.
2019-08-19 12:46:03 -06:00
Tom Tromey f21c2bd7b7 Fix Fortran regression with variables in nested functions
Sergio pointed out that commit commit aa3b6533 ("Allow nested function
displays") regressed a few gdb.fortran tests.  I was able to reproduce
these failures with gcc head.

The bug is that some spots calling contained_in will in fact do the
wrong thing if nested functions are considered as contained.  In the
particular case of the Fortran regression, it was the call in
block_innermost_frame, being called from get_hosting_frame -- in this
case, the caller is specifically trying to avoid the nested case.

This patch fixes the problem by adding an "allow_nested" parameter to
contained_in, essentially reverting the change for most callers.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tromey@adacore.com>

	* printcmd.c (do_one_display, info_display_command): Update.
	* block.h (contained_in): Return bool.  Add allow_nested
	parameter.
	* block.c (contained_in): Return bool.  Add allow_nested
	parameter.
2019-08-19 10:32:03 -06:00
Tom Tromey d806ea2d0e Add Rust support to source highlighting
Currently, no release of GNU Source Highlight supports Rust.  However,
I've checked in a patch to do so there, and I plan to make a new
release sometime this summer.

This patch prepares gdb for that by adding support for Rust to the
source highlighting code.

Because Source Highlight will throw an exception if the language is
unrecognized, this also changes gdb to ignore exceptions here.  This
will cause gdb to fall back to un-highlighted source text.

This updates gdb's configure script to reject the combination of
Source Highlight and -static-libstdc++.  This is done because it's not
possible to use -static-libstdc++ and then catch exceptions from a
shared library.

Tested with the current and development versions of Source Highlight.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Disallow the combination of -static-libstdc++ and
	source highlight.
	* source-cache.c (get_language_name): Handle rust.
	(source_cache::get_source_lines): Ignore highlighting exceptions.
2019-08-19 10:17:27 -06:00
Tom de Vries 34dafe9f39 [gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie
When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we
get:
...
FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r
...

The test expects the read-only sections to have the same contents as in the
file:
...
    # Assume startup code doesn't change read-only sections.
    compare_sections "-r"
...
but that's not the case for PIE executables.

Fix this by allowing mismatched read-only sections for PIE executables.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-16  Tom de Vries  <tdevries@suse.de>

	* gdb.base/compare-sections.exp ("after run to main"): Allow
	mismatched read-only sections for PIE executables.
2019-08-16 23:48:28 +02:00
Tom Tromey 398fdd6086 Remove the TUI execution info window
The TUI execution info window is unusual in that it is always linked
to a source or disassembly window.  Even updates of its content are
handled by the source window, so it really has no life of its own.

This patch removes this window entirely and puts its functionality
directly into the source window.  This simplifies the code somewhat.

This is a user-visible change, because now the box around the source
(or disassembly) window encloses the execution info as well.  I
consider this an improvement as well, though.

Note that this patch caused ncurses to start emitting the "CSI Z"
sequence, so I've added this to the test suite terminal
implementation.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove.
	* tui/tui-winsource.h (struct tui_exec_info_window): Remove.
	(struct tui_source_window_base) <make_visible, refresh_window,
	resize>: Remove methods.
	<execution_info>: Remove field.
	* tui/tui-winsource.c (tui_source_window_base::do_erase_source_content)
	(tui_show_source_line, tui_source_window_base)
	(~tui_source_window_base): Update.
	(tui_source_window_base::resize)
	(tui_source_window_base::make_visible)
	(tui_source_window_base::refresh_window): Remove.
	(tui_source_window_base::update_exec_info): Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.

gdb/testsuite/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* lib/tuiterm.exp (_csi_Z): New proc.
	* gdb.tui/basic.exp: Update window positions.
	* gdb.tui/empty.exp: Update window positions.
2019-08-16 14:17:36 -06:00
Tom Tromey e699d33164 Remove useless assignment from tui_remove_hooks
tui_remove_hooks clears deprecated_query_hook, but nothing in the TUI
ever sets it; so remove the assignment.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-hooks.c (tui_remove_hooks): Don't set
	deprecated_query_hook.
2019-08-16 11:28:34 -06:00
Tom Tromey bb01dbfc04 Change tui_show_symtab_source to be a method
This changes tui_show_symtab_source to be a method on
tui_source_window.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr)
	(tui_update_source_windows_with_line): Update.
	* tui/tui-source.h (struct tui_source_window)
	<show_symtab_source>: Declare.
	(tui_show_symtab_source): Don't declare.
	* tui/tui-source.c (tui_show_symtab_source): Rename from
	tui_show_symtab_source.
2019-08-16 11:28:34 -06:00
Tom Tromey 81c82c4b90 Introduce tui_source_window_base::set_contents method
This introduces the tui_source_window_base::set_contents method and
implements it in the subclasses.  This removes a check of the window
type.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<set_contents>: Declare.
	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window_as_is): Update.
	* tui/tui-source.h (struct tui_source_window) <set_contents>:
	Declare.
	(tui_set_source_content): Don't declare.
	* tui/tui-source.c (tui_source_window::set_contents): Rename from
	tui_set_source_content.
	* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
	Declare.
	(tui_set_disassem_content): Don't declare.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Rename from
	tui_set_disassem_content.
2019-08-16 11:28:34 -06:00
Tom Tromey 2ddaf61443 Change tui_update_breakpoint_info to be a method
This changes tui_update_breakpoint_info to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_breakpoint_info>: Declare.
	(tui_update_breakpoint_info): Don't declare.
	* tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is)
	(tui_update_all_breakpoint_info): Update.
	(tui_source_window_base::update_breakpoint_info): Rename from
	tui_update_breakpoint_info.
	(tui_source_window_base::update_exec_info): Update.
2019-08-16 11:28:34 -06:00
Tom Tromey 017f982820 Change tui_update_source_window to be a method
This changes tui_update_source_window to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_source_window>: Declare.
	(tui_update_source_window): Don't declare.
	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window): Rename from
	tui_update_source_window.
	(tui_source_window_base::rerender): Update.
	* tui/tui-source.c (tui_source_window::maybe_update): Update.
	* tui/tui-disasm.c (tui_show_disassem)
	(tui_show_disassem_and_update_source)
	(tui_disasm_window::maybe_update): Update.
2019-08-16 11:28:34 -06:00
Tom Tromey ed8358e949 Change tui_update_source_window_as_is to be a method
This changes tui_update_source_window_as_is to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_source_window_as_is>: Declare.
	(tui_update_source_window_as_is): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window): Update
	(tui_source_window_base::update_source_window_as_is): Rename from
	tui_update_source_window_as_is.
	(tui_source_window_base::refill): Update.
	* tui/tui-source.c (tui_show_symtab_source): Update.
	* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical):
	Update.
2019-08-16 11:28:34 -06:00
Tom Tromey 20149b6b20 Remove "noerror" parameter from some TUI functions
A few TUI functions take a "noerror" parameter.  This is only checked
in one spot: in tui_set_source_content, if noerror is false, and if an
error occurs, then the function will call print_sys_errmsg.

This seems misguided to me, so this patch removes that code and this
parameter.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_update_source_window)
	(tui_update_source_window_as_is): Remove "noerror" parameter.
	* tui/tui-winsource.c (tui_update_source_window)
	(tui_update_source_window_as_is): Remove "noerror" parameter.
	(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 (tui_set_source_content)
	(tui_show_symtab_source): Remove "noerror" parameter.
	* tui/tui-source.c (tui_set_source_content): Remove "noerror"
	parameter.
	(tui_show_symtab_source): Likewise.
	(tui_source_window::maybe_update): Update.
	* tui/tui-disasm.c (tui_show_disassem)
	(tui_show_disassem_and_update_source)
	(tui_disasm_window::do_scroll_vertical)
	(tui_disasm_window::maybe_update): Update.
2019-08-16 11:28:34 -06:00
Tom Tromey 2d83e710a1 Remove separate visibility flag
TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle.  So, we can remove this
separate field.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_is_window_visible): Update.
	* tui/tui-wingeneral.c (tui_make_window)
	(tui_gen_win_info::make_visible, tui_refresh_all): Update.
	* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
	(tui_set_focus_command, tui_all_windows_info, update_tab_width)
	(tui_set_win_height_command, parse_scrolling_args): Update.
	* tui/tui-source.c (tui_source_window::style_changed): Update.
	* tui/tui-regs.c (tui_show_registers)
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_check_register_values, tui_reg_command): Update.
	* tui/tui-disasm.c (tui_show_disassem): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
	method.
	<is_visible>: Remove field.
	* tui/tui-data.c (tui_next_win, tui_prev_win)
	(tui_delete_invisible_windows): Update.
2019-08-16 11:28:33 -06:00
Tom Tromey d4ab829a24 Remove m_has_locator
The previous patch removed the only use of m_has_locator, so this
member can now be removed.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<m_has_locator>: Remove.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update.
2019-08-16 11:28:33 -06:00
Alan Hayward aa7ca1bb44 Move [PAC] into a new MI field addr_flags
Add a new print_pc which prints both the PC and a new field addr_flags.
Call this wherever the PC is printed in stack.c.

Add a new gdbarch method get_pc_address_flags to obtain the addr_flag
contents. By default returns an empty string, on AArch64 this returns
PAC if the address has been masked in the frame.

Document this in the manual and NEWS file.

gdb/ChangeLog:

	* NEWS (Other MI changes): New subsection.
	* aarch64-tdep.c (aarch64_get_pc_address_flags): New function.
	(aarch64_gdbarch_init): Add aarch64_get_pc_address_flags.
	* arch-utils.c (default_get_pc_address_flags): New function.
	* arch-utils.h (default_get_pc_address_flags): New declaration.
	* gdbarch.sh: Add get_pc_address_flags.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Likewise.
	* stack.c (print_pc): New function.
	(print_frame_info) (print_frame): Call print_pc.

gdb/doc/ChangeLog:

	* gdb.texinfo (AArch64 Pointer Authentication)
	(GDB/MI Breakpoint Information) (Frame Information): Document
	addr_field.
2019-08-16 10:19:18 +01:00
Sandra Loosemore d8f9e51c36 Fix paste-o in examine-backward.exp.
This patch fixes a paste-o that was introduced in commit
c8ad9b9a31.  Previously the regexp for
the "examine 3 bytes backward from ${address_zero}" test correctly
matched 3 "${byte}" patterns, but in that commit the 6-byte regexp
from the previous test was mistakenly repeated here instead.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.base/examine-backward.exp: Correct regexp for
	"examine 3 bytes backward from ${address_zero}".
2019-08-15 18:15:16 -07:00
Tom de Vries 6eac171f06 [gdb] Make maint info sections print relocated addresses
When running gdb.base/compare-sections.exp with -fPIE/-pie, we get:
...
print /u *(unsigned char *) 0x00000238^M
Cannot access memory at address 0x238^M
(gdb) FAIL: gdb.base/compare-sections.exp: read-only: get value of read-only section
...

The problem is that that "maint info sections" prints an unrelocated address:
...
 [0]     0x00000238->0x00000254 at 0x00000238: .interp ALLOC LOAD READONLY \
                                                       DATA HAS_CONTENTS
...
while the test expects a relocated address.

Given that the documentation states that the command displays "the section
information displayed by info files", and that info files shows relocated
addresses:
...
        0x0000555555554238 - 0x0000555555554254 is .interp
...
fix this by showing relocated addresses for maint info sections as
well.

Build and tested on x86_64-linux.

gdb/ChangeLog:

2019-08-16  Tom de Vries  <tdevries@suse.de>

	* maint.c (maintenance_info_sections): Also handle !ALLOBJ case using
	print_objfile_section_info.
2019-08-16 00:25:14 +02:00
Tom Tromey 3df505f60e TUI resize unification
The TUI currently has two different ways to resize a window: the
resize method, and the methods make_invisible_and_set_new_height and
make_visible_with_new_height.

There's no deep reason to have two different ways to resize a window,
so this patch unifies them, leaving just the "resize" method.

This also changes the locator to be handled more like an ordinary
window and less like an adjunct of the associated source window.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before
	calling update_cmdwin_start_line.
	* tui/tui-winsource.h (struct tui_source_window_base)
	<do_make_visible_with_new_height, set_new_height>: Don't declare.
	<rerender>: Declare.
	* tui/tui-winsource.c (tui_source_window_base::update_tab_width):
	Call rerender.
	(tui_source_window_base::set_new_height): Remove.
	(tui_source_window_base::rerender): Rename from
	do_make_visible_with_new_height.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use
	resize method.
	(tui_win_info::make_invisible_and_set_new_height)
	(tui_win_info::make_visible_with_new_height): Remove.
	* tui/tui-stack.h (struct tui_locator_window) <rerender>:
	Declare.
	* tui/tui-stack.c (tui_locator_window::rerender): New method.
	* tui/tui-regs.h (struct tui_data_window) <set_new_height,
	do_make_visible_with_new_height>: Don't declare.
	<rerender>: Declare.
	* tui/tui-regs.c (tui_data_window::rerender): Rename from
	set_new_height.
	(tui_data_window::do_make_visible_with_new_height): Remove.
	* tui/tui-layout.c (show_source_disasm_command, show_data): Don't
	call tui_show_locator_content.
	(tui_gen_win_info::resize): Call rerender.
	(show_source_or_disasm_and_command): Don't call
	tui_show_locator_content.
	* tui/tui-data.h (struct tui_gen_win_info) <rerender>: New
	method.
	(struct tui_win_info) <rerender>: Declare.
	<set_new_height, make_invisible_and_set_new_height,
	make_visible_with_new_height>: Don't declare.
	* tui/tui-data.c (tui_win_list::rerender): New method.
	* tui/tui-command.h (struct tui_cmd_window)
	<do_make_visible_with_new_height>: Don't declare.
	* tui/tui-command.c
	(tui_cmd_window::do_make_visible_with_new_height): Remove.

gdb/testsuite/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* gdb.tui/empty.exp: Enable resizing tests.
2019-08-15 14:17:11 -06:00
Tom Tromey 272560b577 Fix bug with character enumeration literal
gnat encodes character enumeration literals using a few different
schemes.  The gnat compiler documented the "QU" and "QW" encodings,
but failed to document that a simpler encoding was used for certain
characters.

This patch updates gdb to handle this simple Q encoding.  Note that
wide character literals are still not handled.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* ada-exp.y (convert_char_literal): Handle "Q%c" encoding.
	* ada-lang.c (ada_enum_name): Likewise.

gdb/testsuite/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/char_enum.exp: Add regression tests.
	* gdb.ada/char_enum/foo.adb (Char_Enum_Type): Use '_'
	and '0'.
	(Char, Gchar): Update.
	* gdb.ada/char_enum/pck.ads (Global_Enum_Type): Use '+'.
2019-08-15 13:42:31 -06:00
Christian Biesinger 08235187bc Rename internal Python functions to start with an underscore
I could not tell if GdbSetPythonDirectory is internal or not because
I could not find any references to it, so I left it as-is.

Tested by running the testsuite on gdb.python/*.exp; everything still
passes.

2019-08-15  Christian Biesinger  <cbiesinger@google.com>

	* python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a
	leading underscore.
	(GdbOutputErrorFile): Likewise.
	(global scope): Adjust constructor calls to GdbOutput{,Error}File
	accordingly.
	(execute_unwinders): Rename to have a leading underscore.
	(auto_load_packages): Likewise.
	(global scope): Adjust call to auto_load_packages accordingly.
	(GdbSetPythonDirectory): Likewise.
	* python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders
	instead of execute_unwinders.

gdb/testsuite/ChangeLog:

2019-08-15  Christian Biesinger  <cbiesinger@google.com>

	* gdb.python/python.exp: Expect a leading underscore on
	GdbOutput{,Error}File.
2019-08-15 14:21:57 -05:00
Tom Tromey db502012fc TUI window resize should not need invisibility
When resizing a window, the TUI currently first makes it invisible,
then changes the size, and then restores its visibility.

I think this is done because curses doesn't truly support resizing a
window -- there is a "wresize" extension, but the man page says it
isn't available in all versions of curses.

First, this is probably not a major problem any more.  I imagine most
of those old systems are gone now.

Second, I think it's a better API to have this detail hidden inside of
the resize method.

This patch changes the code to follow this idea, and changes the
ordinary resize method to use wresize when it is available.  The
special case for the command window is also moved to methods on the
command window.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_layout, show_source_disasm_command)
	(show_data): Don't change window visibility.
	(tui_gen_win_info::resize): Remove special case for command
	window.  Use wresize, when available.
	(show_source_or_disasm_and_command): Don't change window
	visibility.
	* tui/tui-command.h (struct tui_cmd_window) <resize>: Declare.
	<make_visible>: New method.
	* tui/tui-command.c (tui_cmd_window::resize): New method.
2019-08-15 12:29:28 -06:00
Tom Tromey 3891b65efe Change TUI source window iteration
Currently the TUI does separate bookkeeping to track which source
windows exist.  It seems better to me to just refer to the list of
windows for this, so this patch removes the special handling and
instead adds a new iterator.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_iterator): New.
	(struct tui_source_windows): New.
	* tui/tui-winsource.c (tui_display_main): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(new_height_ok, parse_scrolling_args): Update.
	* tui/tui-layout.c (show_layout, show_data): Update.
	* tui/tui-data.h (tui_source_windows, tui_clear_source_windows)
	(tui_add_to_source_windows): Don't declare.
	* tui/tui-data.c (source_windows, tui_source_windows)
	(tui_clear_source_windows, tui_add_to_source_windows): Remove.
2019-08-15 12:29:28 -06:00
Tom Tromey ee556432c4 Rename the "reset" method to "resize"
tui_gen_win_info::reset really just resizes the window.  This patch
renames it to reflect this.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base) <resize>:
	Rename from reset.
	* tui/tui-winsource.c (tui_source_window_base::resize): Rename.
	* tui/tui-layout.c (show_source_disasm_command, show_data):
	Update.
	(tui_gen_win_info::resize): Rename.
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from
	reset.
2019-08-15 12:29:28 -06:00
Tom Tromey 46f438e3d5 Remove tui_initialize_static_data
tui_initialize_static_data is not needed, because locator moving and
resizing is already handled in the layout code.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.c (tui_initialize_static_data): Remove.
	* tui/tui-interp.c (tui_interp::init): Don't call
	tui_initialize_static_data.
	* tui/tui-data.h (tui_initialize_static_data): Don't declare.
2019-08-15 12:29:28 -06:00
Tom Tromey f4ce562c7f Minor simplification in tui_default_win_viewport_height
tui_default_win_viewport_height doesn't need to look at tui_win_list;
it can simply check the type directly.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_default_win_viewport_height): Don't
	examine tui_win_list.
2019-08-15 12:29:28 -06:00
Tom Tromey c398c3d0b5 Remove tui_clear_source_content
tui_clear_source_content is not needed.  Instead, the callers can call
erase_source_content, which is also changed to clear the content
vector.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_clear_source_content): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is): Don't call
	tui_clear_source_content.
	(tui_clear_source_content): Remove.
	(tui_source_window_base::do_erase_source_content): Hoist call to
	content.clear().
	* tui/tui-stack.c (tui_show_frame_info): Don't call
	tui_clear_source_content.
2019-08-15 12:29:28 -06:00
Tom Tromey e25d200487 Turn tui_erase_source_content into a method
This changes tui_erase_source_content into a method on
tui_source_window_base.  The bulk of the work is moved into a helper
method, so that the callers can each pass the string appropriate to
the particular window class.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<do_erase_source_content>: New method.
	<erase_source_content>: New method.
	(tui_erase_source_content): Don't declare.
	* tui/tui-winsource.c (tui_clear_source_content): Update.
	(tui_source_window_base::do_erase_source_content): Rename from
	tui_erase_source_content.
	(tui_source_window_base::show_source_content): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
	* tui/tui-source.h (struct tui_source_window)
	<erase_source_content>: New method.
	* tui/tui-disasm.h (struct tui_disasm_window)
	<erase_source_content>: New method.
2019-08-15 12:29:28 -06:00
Tom Tromey 002f15c277 Remove tui_alloc_source_buffer
There is no longer any need for tui_alloc_source_buffer.  The two
callers of this function immediately change the contents of the
window, undoing the work done by this function.

This required adding a move constructor to tui_source_element -- a
mildly surprising find, but without this, resizing the vector will
cause crashes.  This issue was masked earlier because
tui_alloc_source_buffer handled this.

Note that a patch for this bug was submitted here:

    https://sourceware.org/ml/gdb-patches/2019-08/msg00094.html

That patch is better, IMO, but the author as yet hasn't responded to a
request for a ChangeLog entry.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
	(struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move
	constructor.
	* tui/tui-winsource.c (tui_alloc_source_buffer): Remove.
	* tui/tui-source.c (tui_set_source_content): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Update.
2019-08-15 12:29:28 -06:00
Tom Tromey c9033fe839 Change tui_line_is_displayed to be a method
This changes tui_line_is_displayed to be a method on
tui_source_window, now that it is obvious that it can only be called
for this type.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_line_is_displayed): Don't declare.
	* tui/tui-winsource.c (tui_line_is_displayed): Move to
	tui-source.c.
	* tui/tui-source.h (struct tui_source_window) <line_is_displayed>:
	Declare.
	* tui/tui-source.c (tui_source_window::line_is_displayed): New
	method.
	(tui_source_window::maybe_update): Update.
2019-08-15 12:29:28 -06:00
Tom Tromey 088f37dd90 Change tui_addr_is_displayed into a method
This changes tui_addr_is_displayed to be a method on
tui_disasm_window, now that it is obvious that it can only be called
for this type.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_addr_is_displayed): Don't declare.
	* tui/tui-winsource.c (tui_addr_is_displayed): Move to
	tui-disasm.c.
	* tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>:
	Declare.
	* tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New
	method.
	(tui_disasm_window::maybe_update): Update.
2019-08-15 12:29:28 -06:00
Tom Tromey a54700c6c4 Move contents of tui_show_frame_info to new method
This moves much of the body of tui_show_frame_info to a new method on
tui_source_window_base.  This removes a check for the type of a
window.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<maybe_update>: Declare.
	* tui/tui-stack.c (tui_show_frame_info): Call maybe_update
	method.
	* tui/tui-source.h (struct tui_source_window) <maybe_update>:
	Declare.
	* tui/tui-source.c (tui_source_window::maybe_update): New method.
	* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
	Declare.
	* tui/tui-disasm.c (tui_disasm_window::maybe_update): New method.
2019-08-15 12:29:28 -06:00
Tom Tromey e2a678a557 Avoid string_file in tui_make_status_line
tui_make_status_line uses string_file where a simple std::string
constructor would do.  This makes this change.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.c (tui_make_status_line): Use string constructor.
2019-08-15 12:29:28 -06:00
Tom Tromey f2dda47784 Move locator code to tui-stack.c
The locator is mostly implemented in tui-stack.c.  This moves the
remaining bits to tui-stack.c and tui-stack.h, as appropriate.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c: Include tui-stack.h.
	* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move from tui-data.h.
	* tui/tui-stack.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move from tui-data.c.
	* tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move to tui-stack.c.
	* tui/tui-data.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move to tui-stack.c.
2019-08-15 12:29:28 -06:00
Tom Tromey ed4a1084d7 Remove FIXMEs from tui-layout.c
An earlier patch added a couple of FIXME comments to tui-layout.c.
This removes them.  This is possible due to the previous patch that
changed how boxing works in the TUI -- now, no special case for the
command window is needed in box_win.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Use make_visible method, not
	tui_make_window.
	* tui/tui-command.h (struct tui_cmd_window) <make_visible>:
	Remove.
2019-08-15 12:29:28 -06:00
Tom Tromey 65962b20b6 Simplify TUI boxing
In the TUI, whether or not a window can be boxed is a property of the
window's type.  This adds a can_box method to the window classes, and
changes tui_make_window to defer to this, removing the "box_it"
paramter.  This also lets us remove "enum tui_box", as it is no longer
used.

gdb/ChangeLog
2019-08-15  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_window): Update.
	* tui/tui-wingeneral.c (tui_make_window): Remove "box_it"
	parameter.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from):
	Update.
	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
	(enum tui_box): Remove.
	(struct tui_win_info) <can_box>: New method.
	* tui/tui-command.h (struct tui_cmd_window) <can_box>: New
	method.
2019-08-15 12:29:28 -06:00
Sandra Loosemore 22a2ab04f5 Disable dw2-dir-file-name.exp on remote and/or Windows host.
This test has many hardwired assumptions that pathnames on build and
host are the same, and that POSIX pathname syntax is used.  This
results in dozens of failures on a remote Windows host.  Fixing these
assumptions would involve nontrivial rewrites; meanwhile, let's make
the test results reflect the reality that this testcase isn't supported
on remote host.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.dwarf2/dw2-dir-file-name.exp: Skip on remote or
	Windows host.
2019-08-15 10:41:58 -07:00
Sandra Loosemore 835b995b57 Skip batch-preserve-term-settings.exp tests that cannot work on Windows.
This group of tests assume that the gdb "shell" command launches a
POSIX-compliant shell supporting the PPID environment variable, which
is used to get gdb's pid for killing it from a remote_exec shell.  But
on Windows host "shell" launches cmd.exe, which doesn't have an
equivalent query.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.base/batch-preserve-term-settings.exp
	(test_terminal_settings_preserved_after_sigterm): Skip on Windows.
2019-08-15 10:41:58 -07:00
Tom Tromey d59b55f095 Use gdb::byte_vector in target_write_memory
Pedro pointed out that target_write_memory should use gdb::byte_vector
rather than std::vector<unsigned char>.

gdb/gdbserver/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* target.c (target_write_memory): Use gdb::byte_vector.
2019-08-15 11:24:22 -06:00
Christian Biesinger 97dd8e07d9 [testsuite] Make the testsuite work on mingw
Dejagnu produces an objdir like /c/, but GDB expects something like c:/.
So fix it up in lib/gdb.exp.

gdb/testsuite/ChangeLog:

2019-08-14  Christian Biesinger  <cbiesinger@google.com>

	* lib/gdb.exp: When running on a mingw target, replace
	/x/ with x:/.
2019-08-15 11:14:35 -05:00
Tom Tromey 4196ab2a6d Replace write_inferior_memory with target_write_memory
target_write_memory is just a simple wrapper for
write_inferior_memory.  Because target_write_memory is needed for
gdbsupport, and because gdb uses the name "target_write_memory"
everywhere, this patch renames write_inferior_memory and removes the
wrapper.  I think this brings gdb and gdbserver slightly more in sync.

gdb/gdbserver/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* tracepoint.c (write_inferior_data_pointer)
	(write_inferior_integer, write_inferior_int8)
	(write_inferior_uinteger, m_tracepoint_action_download)
	(r_tracepoint_action_download, x_tracepoint_action_download)
	(l_tracepoint_action_download, clear_inferior_trace_buffer)
	(download_agent_expr, download_tracepoint_1)
	(download_trace_state_variables, upload_fast_traceframes): Update.
	* server.c (gdb_write_memory): Update.
	* remote-utils.c (relocate_instruction): Update.
	* proc-service.c (ps_pdwrite): Update.
	* mem-break.c (remove_memory_breakpoint)
	(delete_fast_tracepoint_jump, set_fast_tracepoint_jump)
	(uninsert_fast_tracepoint_jumps_at)
	(reinsert_fast_tracepoint_jumps_at): Update.
	* linux-x86-low.c (append_insns)
	(i386_install_fast_tracepoint_jump_pad)
	(amd64_write_goto_address, i386_write_goto_address): Update.
	* linux-s390-low.c (append_insns, s390_write_goto_address):
	Update.
	* linux-ppc-low.c (ppc_relocate_instruction)
	(ppc_install_fast_tracepoint_jump_pad, emit_insns)
	(ppc_write_goto_address): Update.
	* linux-aarch64-low.c (append_insns): Update.
	* target.h (struct target_ops): Update.
	(write_inferior_memory): Don't declare.
	* target.c (target_write_memory): Rename from
	write_inferior_memory.  Remove old target_write_memory.
2019-08-15 07:42:21 -06:00
Tom Tromey c6778d00df Simplify write_inferior_memory
gdbserver's write_inferior_memory uses a static variable to avoid
memory leaks, and has a comment referring to the lack of cleanups.
This patch removes this comment and the code in favor of a
straightforward use of std::vector.

gdb/gdbserver/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

	* target.c (write_inferior_memory): Use std::vector.
2019-08-15 07:42:21 -06:00
Tom de Vries 2208ee9170 [gdb] Fix gdb build on mips64-linux
When compiling for mips64-linux, we get:
...
src/gdb/linux-nat-trad.c:139:12: error: ‘gdbarch_num_regs’ was not declared \
  in this scope
  139 |   regnum < gdbarch_num_regs (regcache->arch ());
...

Fix this by including gdbarch.h in linux-nat-trad.c, similar to commit
b1c896b365 "Fix gdb build on macOS".

Build on mips64-linux.

gdb/ChangeLog:

2019-08-15  Tom de Vries  <tdevries@suse.de>

	* linux-nat-trad.c: Include gdbarch.h.
2019-08-15 08:14:31 +02:00
Alan Hayward 75faf5c41d AArch64: Allow additional sizes in prologue
When saving registers to the stack at the start of a function, not all state
needs to be saved. For example, only the first 64bits of float registers need
saving.  However, a program may choose to store extra state if it wishes,
there is nothing preventing it doing so.

The aarch64_analyze_prologue will error if it detects extra state being
stored.  Relex this restriction.

Tested via aarch64-prologue test.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_analyze_prologue): Allow any valid
	register sizes.

gdb/testsuite/ChangeLog:

	* gdb.arch/aarch64-prologue.c: New test.
	* gdb.arch/aarch64-prologue.exp: New file.
2019-08-14 15:58:21 +01:00
Tom Tromey b1c896b365 Fix gdb build on macOS
Internal testing showed that the macOS port did not build.  The
breakage was caused by the patch to remove the gdbarch.h include from
defs.h.  This patch fixes the problem.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tromey@adacore.com>

	* darwin-nat.c: Include gdbarch.h.
	* darwin-nat-info.c: Include gdbarch.h.
2019-08-14 08:40:18 -06:00
Tom Tromey 6405cd73c0 Remove tui_gen_win_info::last_visible_line
The last_visible_line field of tui_gen_win_info is not used, so remove
it.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>:
	Remove.
	* tui/tui-data.c (tui_initialize_static_data): Update.
2019-08-13 14:52:10 -06:00
Tom Tromey 5216580d7a Don't track the contents of the execution info window
The curses library keeps track of the contents of each window, and can
redraw the screen as needed.  This means that in most cases is no need
for the TUI windows to also keep track of their contents.  This patch
removes content tracking from the execution window, leaving that to
curses.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_exec_info_window)
	<~tui_exec_info_window, maybe_allocate_content, get_content,
	m_content>: Remove.
	(struct tui_source_window_base) <set_exec_info_content,
	show_exec_info_content>: Don't declare.
	* tui/tui-winsource.c
	(tui_exec_info_window::maybe_allocate_content): Remove.
	(tui_source_window_base::update_exec_info): Rename from
	set_exec_info_content.
	(tui_source_window_base::show_exec_info_content)
	(tui_source_window_base::update_exec_info): Remove.
2019-08-13 14:52:10 -06:00
Tom Tromey 93858ad34e Remove tui_clear_exec_info_content
After the previous patch, all calls to tui_clear_exec_info_content
come just after a call to tui_clear_source_content.  Because these two
windows are linked, I think it makes sense to have
tui_clear_source_content simply do the work.  So, this patch removes
tui_clear_exec_info_content.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_clear_exec_info_content): Don't
	declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_update_source_windows_with_addr, tui_erase_source_content):
	Update.
	(tui_clear_exec_info_content): Remove.
2019-08-13 14:52:10 -06:00
Tom Tromey e321e7ce75 Remove tui_erase_exec_info_content
One call to tui_erase_exec_info_content can be removed.  This call is
not needed because the function in question then immediately sets the
execution info window contents.

Once this is done, tui_clear_exec_info_content is just a wrapper for
the only call to tui_erase_exec_info_content, so
tui_erase_exec_info_content can be renamed and the wrapper function
removed.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_erase_exec_info_content): Don't
	declare.
	* tui/tui-winsource.c (tui_source_window_base::refresh_all): Don't
	call tui_erase_exec_info_content.
	(tui_clear_exec_info_content): Rename from
	tui_erase_exec_info_content.
	(tui_clear_exec_info_content): Delete.
2019-08-13 14:52:09 -06:00
Tom Tromey 8270ac6229 Turn tui_show_exec_info_content into a method
This changes tui_show_exec_info_content to be a method on
tui_source_window_base.  As it is only called by other methods on this
class, it can be private.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<show_exec_info_content>: Declare.
	(tui_show_exec_info_content): Don't declare.
	* tui/tui-winsource.c
	(tui_source_window_base::show_exec_info_content): Rename from
	tui_show_exec_info_content.
	(tui_source_window_base::update_exec_info): Update.
2019-08-13 14:52:09 -06:00
Tom Tromey 7b56485db5 Move code to tui-winsource.h
This moves code related to the execution info window from tui-data.h
to tui-winsource.h.  It fits better here because the execution info is
conceptually part of the source and disassembly windows, and
tui-winsource.h is where this common class lives.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element)
	(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS)
	(TUI_EXECINFO_SIZE, tui_exec_info_content): Move ...
	* tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct
	tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS)
	(TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content):
	... here.
2019-08-13 14:52:09 -06:00
Tom Tromey 7ba913dcdf Change tui_update_exec_info to be a method
This changes tui_update_exec_info to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_exec_info>: Declare.
	(tui_update_exec_info): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_source_window_base::refresh_all)
	(tui_update_all_breakpoint_info): Update.
	(tui_source_window_base::update_exec_info): Rename from
	tui_update_exec_info.
	* tui/tui-stack.c (tui_show_frame_info): Update.
2019-08-13 14:52:09 -06:00
Tom Tromey 37a4a13104 Change tui_set_exec_info_content to be a method
This changes tui_set_exec_info_content to bea method on
tui_source_window_base.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<set_exec_info_content>: Declare.
	(tui_set_exec_info_content): Don't declare.
	* tui/tui-winsource.c
	(tui_source_window_base::set_exec_info_content): Rename from
	tui_set_exec_info_content.
	(tui_update_exec_info): Update.
2019-08-13 14:52:09 -06:00
Tom Tromey 0bd27e079a Change tui_show_source_content to be a method
This changes tui_show_source_content to be a method on
tui_source_window_base.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<show_source_content>: Declare.
	(tui_show_source_content): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
	(tui_source_window_base::show_source_content): Rename from
	tui_show_source_content.
	(tui_source_window_base::refresh_all): Update.
	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Update.
2019-08-13 14:52:09 -06:00
Tom Tromey b4ef5aeb3a Change tui_check_and_display_highlight_if_needed to be a method
This changes tui_check_and_display_highlight_if_needed to be a method
on tui_win_info.  This makes it clear that the NULL check in that
function is not needed, so it is removed here.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_erase_source_content)
	(tui_show_source_content, tui_source_window_base::refresh_all):
	Update.
	* tui/tui-wingeneral.h
	(tui_check_and_display_highlight_if_needed): Don't declare.
	* tui/tui-wingeneral.c
	(tui_win_info::check_and_display_highlight_if_needed): Rename from
	check_and_display_highlight_if_needed.
	* tui/tui-win.c (tui_rehighlight_all)
	(tui_win_info::make_visible_with_new_height): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from_line)
	(tui_data_window::erase_data_content)
	(tui_data_window::display_all_data): Update.
	* tui/tui-data.h (struct tui_win_info)
	<check_and_display_highlight_if_needed>: Declare.
2019-08-13 14:52:09 -06:00
Tom Tromey fede52738f Delete invisible TUI windows
This changes the TUI so that when the layout changes, any windows that
are invisible are now deleted.  This makes it simpler to understand
window lifetimes.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_resize_all): Call
	tui_delete_invisible_windows.
	* tui/tui-layout.c (show_layout): Call
	tui_delete_invisible_windows.
	* tui/tui-data.h (tui_delete_invisible_windows): Declare.
	* tui/tui-data.c (tui_delete_invisible_windows): New function.
2019-08-13 14:52:09 -06:00
Tom Tromey 22c3f4909a Simplify tui_show_disassem
tui_show_disassem does not need to call tui_add_win_to_layout, because
the callers that could change the layout have already ensured that it
exists.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.c (tui_show_disassem): Add assertion.  Don't call
	tui_add_win_to_layout.
2019-08-13 14:52:09 -06:00
Tom Tromey 16cb7910b9 Make tui_default_win_height static
tui_default_win_height is only used in tui-layout.c, so make it static.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.h (tui_default_win_height): Don't declare.
	* tui/tui-layout.c (tui_default_win_height): Now static.
2019-08-13 14:52:09 -06:00
Tom Tromey cc0c3ffbc9 Two simplifications in tui-layout.c
This patch simplifies some code in tui-layout.c.

In show_layout, all the layout settings can be handled by a single
switch statement.  In show_source_disasm_command and
show_source_or_disasm_and_command, there is no need to check the
current layout, as the caller has already done so.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_layout): Unify all layout cases into a
	single switch.
	(show_source_disasm_command, show_source_or_disasm_and_command):
	Don't check current layout.
2019-08-13 14:52:09 -06:00
Tom Tromey 3f3ffe54e2 Simplify tui_make_all_invisible
This simplifies the implementation of tui_make_all_invisible.  Also,
because show_data is only called by show_layout, this hoists the call
to tui_make_all_invisible and removes the call from show_data.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (make_all_visible): Remove.
	(tui_make_all_invisible): Simplify.
	* tui/tui-layout.c (tui_make_all_invisible): Move from
	tui-wingeneral.c; simplify.
	(show_layout): Hoist call to tui_make_all_invisible.
	(show_data): Don't call tui_make_all_invisible.
2019-08-13 14:52:09 -06:00
Tom Tromey 6925809176 Remove tui_make_all_visible
The function tui_make_all_visible is not used, so remove it.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_all_visible): Don't declare.
	* tui/tui-wingeneral.c (tui_make_all_visible): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey 62cf57fee7 Move current_layout to tui-layout.c
This moves the current_layout global to tui-layout.c.  This allows for
the removal of an accessor function; but also it just seems clearer to
have it here.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (current_layout, tui_current_layout): Move from
	tui-data.c.
	(show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Don't use
	tui_set_current_layout_to.
	* tui/tui-data.h (tui_set_current_layout_to): Don't declare.
	* tui/tui-data.c (current_layout, tui_current_layout): Move to
	tui-layout.c.
	(tui_set_current_layout_to): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey 2afade5dbe Remove struct tui_layout_def
"layout_def" isn't actually used in the TUI, so remove it.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_set_layout): Update.
	* tui/tui-data.h (struct tui_layout_def): Remove.
	(tui_layout_def): Don't declare.
	* tui/tui-data.c (layout_def): Remove.
	(tui_layout_def): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey a3504e9654 clear_detail can only be called on TUI source windows
The clear_detail method can only be called on source windows, so
remove definitions from the base of the class hierarchy, leaving only
a single non-virtual method.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<clear_detail>: No longer "override".
	* tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove.
	* tui/tui-regs.c (tui_data_window::clear_detail): Remove.
	* tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove.
	* tui/tui-command.h (struct tui_cmd_window) <clear_detail>:
	Remove.
	* tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey 29c9291108 Don't include readline headers from tracepoint.c
I was curious why updating readline caused so much to be to rebuilt,
so I look at all the uses of the readline headers.  Most are included
for valid reasons (either readline directory or for tilde_expand); but
the includes in tracepoint.c didn't seem to be used.

This patch removes them.  Tested by rebuilding.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tromey@adacore.com>

	* tracepoint.c: Don't include readline.h or history.h.
2019-08-13 12:28:38 -06:00
Tom de Vries abc6c00fb6 [gdb/testsuite] Fix gdb.gdb/selftest.exp regexp
With gdb.gdb/selftest.exp, we get:
...
(xgdb) PASS: gdb.gdb/selftest.exp: send SIGINT signal to child process
^M
Thread 1 "xgdb" received signal SIGINT, Interrupt.^M
0x00007ffff5bf01db in poll () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.gdb/selftest.exp: send ^C to child process again
...

The failure is due to gdb printing 'Thread 1 "xgdb" received signal SIGINT',
but the regexp in the test-case expecting 'Program received signal SIGINT'.

Fix this by updating the regexp, similar to how that is done earlier in the
test-case.

gdb/testsuite/ChangeLog:

2019-08-13  Tom de Vries  <tdevries@suse.de>

	* gdb.gdb/selftest.exp (send ^C to child process again): Accept also
	Thread.
2019-08-13 18:57:50 +02:00
Sandra Loosemore 74c2c1f45f Fixes for gdb.python tests on remote Windows host.
This patch fixes several test ERRORs and FAILs seen from running
gdb.python tests on a remote Windows host.  The problems fixed
generally fall into these categories:
- Failure to copy the .py script to the host.
- Confusion between build and host pathnames.
- Assuming pathnames printed on the host include "/" as a directory
  separator.
- Tests that need to be conditionally disabled due to missing features
  on the host, etc.

2019-08-13  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.python/py-completion.exp: Download the .py file to the host
	and use its host pathname.  Conditionalize tests that use
	tab completion and manipulate files on the build machine.
	* gdb.python/py-events.exp: Download the .py file to the host
	and use its host pathname.
	* gdb.python/py-evsignal.exp: Likewise.
	* gdb.python/py-evthreads.exp: Likewise.
	* gdb.python/py-framefilter-invalidarg.exp: Match Windows
	pathname syntax.
	* gdb.python/py-framefilter.exp: Download the .py file to the right
	place on the host.  Match Windows pathname syntax.
	* gdb.python/py-mi-var-info-path-expression.exp: Download the
	.py file to the host and use its host pathname.
	* gdb.python/py-objfile-script.exp: Match Windows pathname syntax.
	* gdb.python/py-objfile.exp: Expect a host pathname, not a
	build pathname.  Skip symlink test on Windows host.  Add missing
	newline at end of file.
	* gdb.python/py-pp-maint.exp: Download the .py file to the host
	and use its host pathname.
	* gdb.python/py-pp-registration.exp: Match Windows pathname syntax.
	* gdb.python/py-section-script.exp: Use host location of binfile
	on safe-path.  Use correct path separator on Windows host.
	Reorder alternatives in gdb_test_multiple to prevent matching
	the wrong alternative on success.
	* gdb.python/py-symtab.exp: Match Windows pathname syntax.
2019-08-13 09:09:30 -07:00
Tom Tromey 86c6b807f5 Require readline 7 or newer
This changes gdb to require readline 7 or newer at build time.

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

	* configure: Rebuild.
	* configure.ac: Check for readline 7.
	* NEWS: Mention readline 7 requirement.
	* README: Update.

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

	* gdb.texinfo (Configure Options): Document minimum version of
	readline.
2019-08-12 10:57:56 -06:00