binutils-gdb.git
5 years agoRISC-V: Fix a gp relaxation reloc overflow error.
Jim Wilson [Thu, 29 Aug 2019 00:47:01 +0000 (17:47 -0700)]
RISC-V: Fix a gp relaxation reloc overflow error.

This was broken when I changed how we compute the value for the gp register.
It used to be computed inside the sdata section.  Now it is computed at the
end which makes it an abs section symbol.  There is code that tries to use
the alignment of the section that the gp value is in, but this does not work
if it is in the abs section, as the abs section has alignment of 1 byte.
There are people using alternative linker scripts that still define it in the
sdata section, so the code is still useful.  Thus adding a check to disable
this when gp is in the abs section.

bfd/
* elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
section when setting max_alignment.  Update comment.
(_bfd_riscv_relax_pc): Likewise.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Aug 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoTidy check_uvalue
Alan Modra [Wed, 28 Aug 2019 23:34:08 +0000 (09:04 +0930)]
Tidy check_uvalue

I don't see a need to calculate "ptr = start + uvalue" then compare
"ptr" with "start" and "end".  Given "start <= end" on entry, the
"uvalue" comparison with "max_uvalue" ought to be sufficient to ensure
"start + uvalue" is bounded by "start" and "end" regardless of the
size of pointers and the unsigned dwarf_vma integer type.

* dwarf.c (check_uvalue): Remove unnecessary pointer checks.

5 years agoPR24891, objdump memory leaks when parsing malformed archive
Alan Modra [Wed, 28 Aug 2019 07:04:34 +0000 (16:34 +0930)]
PR24891, objdump memory leaks when parsing malformed archive

BFD was leaking memory in bfd_check_format_matches.  As part of
deciding the proper format of an archive, BFD looks at the format of
the first file stored.  That file's bfd was left open for reasons
given in a comment removed in git commit 0e71e4955cd1 that said:
             /* We ought to close `first' here, but we can't, because
                we have no way to remove it from the archive cache.
                It's close to impossible to figure out when we can
                release bfd_ardata.  FIXME.  */
Well, things have changed since that comment was true and we now can
remove files from the archive cache.  Closing the first file is good
and cures some of the leaks.  Other leaks are caused by
bfd_check_format_matches throwing away bfd tdata before trying a new
match.  That lost the element cache set up when format checking the
first element in the archive.  The easiest and cleanest fix is to
simply disable the caching when checking the first element.

PR 24891
* bfd.c (struct bfd): Add no_element_cache.
* archive.c (_bfd_get_elt_at_filepos): Don't add element to
archive cache when no_element_cache.
(bfd_generic_archive_p): Set no_element_cache when opening first
element to check format.  Close first element too.
(do_slurp_bsd_armap): Don't zero ardata->cache here.
* bfd-in2.h: Regenerate.

5 years ago[gdb/testsuite] Fix info-var.exp for debug info from other files
Tom de Vries [Wed, 28 Aug 2019 17:13:29 +0000 (19:13 +0200)]
[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.

5 years agoSegfault in ld building SPEC CPU2017 527.cam4_r with -flto
Alan Modra [Wed, 28 Aug 2019 14:50:46 +0000 (00:20 +0930)]
Segfault in ld building SPEC CPU2017 527.cam4_r with -flto

Caused by the PR24406 fix.  unwrap_hash_lookup shouldn't be called
with link_info.wrap_hash NULL.

PR ld/24406
* plugin.c (get_symbols): Test link_info.wrap_hash before calling
unwrap_hash_lookup.

5 years agoFix Gnulib glob.c resource leaks found by Coverity
Gary Benson [Wed, 28 Aug 2019 14:19:28 +0000 (15:19 +0100)]
Fix Gnulib glob.c resource leaks found by Coverity

Coverity discovered a number of resource leaks in Gnulib's glob.c.
This commit backports the Gnulib commits that fix the leaks.

gnulib/ChangeLog:

* patches/0003-Fix-glob-c-Coverity-issues.patch: New file.
* update-gnulib.sh: List the above.
* import/glob.c: Rebuild.

5 years agogdb/fortran: Don't include module symbols when searching for types
Andrew Burgess [Tue, 9 Jul 2019 14:49:07 +0000 (15:49 +0100)]
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.

5 years agogdb/fortran: Implement la_print_typedef for Fortran
Andrew Burgess [Tue, 9 Jul 2019 14:47:19 +0000 (15:47 +0100)]
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.

5 years agoAdd an option to objcopy to change the alignment of sections.
Niklas G?rtler [Wed, 28 Aug 2019 11:33:41 +0000 (12:33 +0100)]
Add an option to objcopy to change the alignment of sections.

PR 24942
* objcopy.c (SECTION_CONTEXT_SET_ALIGNMENT): New constant.
(struct section_list): Add alignment field.
(command_line_switch): Add OPTION_SET_SECTION_ALIGNMENT.
(copy_options): Add --set-section-alignment.
(copy_usage): Describe --set-section-alignment.
(find_section_list): Initialise the alignment field.
(setup_section): Handle the alignment field.
(copy_main): Handle OPTION_SET_SECTION_ALIGNMENT.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.

5 years agoAdd a --source-comment=<text> option to objdump which provides a prefix to dipslayed...
Nick Clifton [Wed, 28 Aug 2019 10:39:19 +0000 (11:39 +0100)]
Add a --source-comment=<text> option to objdump which provides a prefix to dipslayed source code lines.

PR 24931
* objdump.c (source_comment): New static variable.
(option_values): Add OPTION_SOURCE_COMMENT.
(long_opions): Add --source-comment.
(print_line): If source comment is set, use it as a prefix to the
source code line.
(main): Handle OPTION_SOURCE_COMMENT.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* testsuite/binutils-all/objdump.exp (test_objdump_S): Add tests
of the -S and --source-comment options.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Aug 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFix compiler warning in linux-namespaces.c
Christian Biesinger [Tue, 27 Aug 2019 18:22:38 +0000 (13:22 -0500)]
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).

5 years agoImprove the DWARF decoder's ability to describe the DW_AT_discr_list attribute.
Nick Clifton [Tue, 27 Aug 2019 15:28:55 +0000 (16:28 +0100)]
Improve the DWARF decoder's ability to describe the DW_AT_discr_list attribute.

PR 24510
* dwarf.c (MAX_CU_NESTING): New constant.
(level_type_signed): New static array.
(skip_attr_bytes): New function.
(get_type_signedness): New function.
(read_and_print_leb128): New function.
(display_discr_list): New function.
(read_and_display_attr_value): Add start parameter.
Use new functions when handling DW_AT_type and DW_AT_discr_list.
(read_and_display_attr): Add start parameter.  Pass to
read_and_display_attr_value.
(process_debug_info): Update call to read_and_display_attr.
(display_formatted_table): Likewise.
(display_debug_lines_decoded): Likewise.  Also add start
parameter.
(display_debug_lines): Likewise.
* testsuite/binutils-all/dwarf-attributes.S: Update discrimination
lists.
* testsuite/binutils-all/dwarf-attributes.W: Update expected
output.

5 years agogdb: Add new -n flag to some info commands
Andrew Burgess [Mon, 22 Jul 2019 15:53:06 +0000 (16:53 +0100)]
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.

5 years agoAdd support for the MVE VMOV instruction to the ARM assembler. This instruction...
Srinath Parvathaneni [Tue, 27 Aug 2019 11:08:21 +0000 (12:08 +0100)]
Add support for the MVE VMOV instruction to the ARM assembler.  This instruction copies the value of one vector register to another vector register.  The patch also modifies the decoding of VORR instruction which is effecting decoding of VMOV instruction.

gas     * config/tc-arm.c (parse_neon_mov): Add check to accept vector
register to both the arguments in VMOV instruction.
* testsuite/gas/arm/mve-vmov-1.d: Modify.
* testsuite/gas/arm/mve-vmov-1.s: Likewise.
* testsuite/gas/arm/mve-vorr.d: Likewise.

opcodes * arm-dis.c (mve_opcodes): Add entry for MVE_VMOV_VEC_TO_VEC.
(is_mve_undefined): Add case for MVE_VMOV_VEC_TO_VEC.
(print_insn_mve): Add condition to check Qm==Qn of VORR instruction.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Aug 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFactor out the common code in lookup_{static,global}_symbol
Christian Biesinger [Sat, 3 Aug 2019 00:59:37 +0000 (19:59 -0500)]
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.

5 years ago[gdb, c++] Improve error message when using libstdcxx without SDT probes
Tom de Vries [Mon, 26 Aug 2019 17:24:59 +0000 (19:24 +0200)]
[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.

5 years ago[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if true
Tom de Vries [Mon, 26 Aug 2019 16:48:02 +0000 (18:48 +0200)]
[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.

5 years agoUse raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning...
Sergio Durigan Junior [Sun, 25 Aug 2019 16:10:35 +0000 (12:10 -0400)]
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.

5 years agoPR24938, Null Pointer Dereference in debug.c:debug_write_type
Alan Modra [Mon, 26 Aug 2019 09:36:28 +0000 (19:06 +0930)]
PR24938, Null Pointer Dereference in debug.c:debug_write_type

PR 24938
* debug.c (debug_write_type): Call empty_type for NULL type here..
(debug_write_type): ..rather than in just one case here.

5 years agoRISC-V: Improve li expansion for better code density.
Kito Cheng [Tue, 20 Aug 2019 09:47:58 +0000 (17:47 +0800)]
RISC-V: Improve li expansion for better code density.

li is a pseudo instruction in RISC-V, it might expand to more than one
instructions if the immediate value can't fit addi or lui, but the
assembler will always using 4-byte instructions during expansion.

For example:

 li a0, 0x12345001

will expand into

 12345537 lui a0,0x12345
 00150513 addi a0,a0,1

but addi could be compress into

 0505 addi a0,a0,1

It because load_const use macro_build to emit instructions,
and macro_build call append_insn, and expect it will compress
it if possible, but the fact is append_insn never compress anything,

So this patch redirect the li expansion flow to normal instruction
emission flow via md_assemble, added md_assemblef as an wrapper for
that for easier emit instruction with printf-style argument to build
instruction.

gas/ChangeLog:

* tc-riscv.c (md_assemblef): New.
(load_const) Use md_assemblef instead of macro_build to emit
instructions.
* testsuite/gas/riscv/li32.d: New.
* testsuite/gas/riscv/li32.s: Ditto.
* testsuite/gas/riscv/li64.d: Ditto.
* testsuite/gas/riscv/li64.s: Ditto.

5 years agodwarf2read: fix compilation issue with gcc 4.8
Simon Marchi [Mon, 26 Aug 2019 01:30:02 +0000 (21:30 -0400)]
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_.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Aug 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agodwarf2read: replace gdb::optional<bool> with enum
Simon Marchi [Sun, 25 Aug 2019 22:09:47 +0000 (18:09 -0400)]
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.

5 years agoConvert the RX target to make use of target descriptions.
Yoshinori Sato [Tue, 20 Aug 2019 15:24:37 +0000 (00:24 +0900)]
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.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Aug 2019 00:01:30 +0000 (00:01 +0000)]
Automatic date update in version.in

5 years agoFix compile warning in symtab.c
Christian Biesinger [Fri, 9 Aug 2019 19:25:15 +0000 (14:25 -0500)]
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.

5 years agoPowerPC64 segfault in ppc64_elf_edit_toc
Alan Modra [Sat, 24 Aug 2019 00:29:03 +0000 (09:59 +0930)]
PowerPC64 segfault in ppc64_elf_edit_toc

Found on a GOT reference to __ehdr_start, which is tweaked to be
undefined weak at some stages of linking.  SYMBOL_REFERENCES_LOCAL
isn't a sufficient test.

* elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
symbols from GOT optimisation.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Aug 2019 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMove gdb-dlfcn.[ch] to gdbsupport/
Sergio Durigan Junior [Wed, 21 Aug 2019 20:22:45 +0000 (16:22 -0400)]
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.

5 years agoFix bug in nios2 prologue analysis.
Sandra Loosemore [Fri, 23 Aug 2019 15:18:54 +0000 (08:18 -0700)]
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.

5 years agoor1k: Fix incorrect value in PLT GOT entries, causing infinite loop
Stafford Horne [Fri, 23 Aug 2019 13:25:55 +0000 (22:25 +0900)]
or1k: Fix incorrect value in PLT GOT entries, causing infinite loop

The PLT GOT entry should point to the first PLT entry which contains the
runtime linker function.  It was pointing back to the symbol PLT entry
causing an infinite loop.

I found this when testing the OpenRISC glibc port which uses the runtime
dynamic linker.  It seems other libc's we use so far have not been
making use of the initial PLT GOT entries.

bfd/ChangeLog:

* elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
PLT GOT entries.

5 years agoStop the BFD library from failing when encountering a second set of relocs for the...
Nick Clifton [Fri, 23 Aug 2019 12:22:02 +0000 (13:22 +0100)]
Stop the BFD library from failing when encountering a second set of relocs for the same section.

PR 24456
* elf.c (bfd_section_from_shdr): Issue an informative warning
message and continue processing other sections after encountering
a reloc section for a section which already has other relocs
associated with it.

5 years agoPR24933, Memory leak in elf_x86_64_get_synthetic_symtab
Alan Modra [Fri, 23 Aug 2019 09:46:25 +0000 (19:16 +0930)]
PR24933, Memory leak in elf_x86_64_get_synthetic_symtab

PR 24933
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
on error without freeing plts[] contents.

5 years agoUpdated Swedish translation for the gas sub-directory.
Nick Clifton [Fri, 23 Aug 2019 09:46:46 +0000 (10:46 +0100)]
Updated Swedish translation for the gas sub-directory.

2019-08-23  Nick Clifton  <nickc@redhat.com>

* po/sv.po: Updated Swedish translation.

5 years agoPrevent a potential illegal memory access in the DWARF parser when processing a corru...
Nick Clifton [Fri, 23 Aug 2019 09:37:51 +0000 (10:37 +0100)]
Prevent a potential illegal memory access in the DWARF parser when processing a corrupt file.

PR 24829
* dwarf.c (check_uvalue): New function.  Ensures that a block's
size is valid.
(read_and_display_attr_value): Use check_value when processsing
DW_FORM_block<n> attributes.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMake GDB compile with Python 3 on MinGW
Christian Biesinger [Tue, 13 Aug 2019 19:48:05 +0000 (14:48 -0500)]
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.

5 years ago[gdb/testsuite] Make gdb_test message more informative in multi-term-settings.exp
Tom de Vries [Thu, 22 Aug 2019 14:54:59 +0000 (16:54 +0200)]
[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.

5 years agoArm: Add support for missing CPUs
Dennis Zhang [Thu, 22 Aug 2019 14:21:32 +0000 (15:21 +0100)]
Arm: Add support for missing CPUs

This patch adds support for following CPUs:
Cortex-M35P, Cortex-A77, Cortex-A76AE.

Related specifications can be found at https://developer.arm.com/ip-products/processors.

gas/ChangeLog:

* config/tc-arm.c: New entries for Cortex-M35P, Cortex-A77,
and Cortex-A76AE.
* doc/c-arm.texi: Document new processors.
* testsuite/gas/arm/cpu-cortex-a76ae.d: New test.
* testsuite/gas/arm/cpu-cortex-a77.d: New test.
* testsuite/gas/arm/cpu-cortex-m35p.d: New test.

bfd/ChangeLog:

* cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.

5 years agoFix an illegal memory access when dumping corrupt x86_64 PE unwind data.
Nick Clifton [Thu, 22 Aug 2019 13:37:03 +0000 (14:37 +0100)]
Fix an illegal memory access when dumping corrupt x86_64 PE unwind data.

PR 24922
* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before
reading data from extra records.

5 years agooops - omitted changelog entry from previous delta.
Nick Clifton [Thu, 22 Aug 2019 12:16:28 +0000 (13:16 +0100)]
oops - omitted changelog entry from previous delta.

5 years agoPrevent a floating point exception in the dwarf parser when a CU or TU table does...
Nick Clifton [Thu, 22 Aug 2019 12:11:18 +0000 (13:11 +0100)]
Prevent a floating point exception in the dwarf parser when a CU or TU table does not have any columns.

PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.

5 years agoFix the assembler's floating point number parser so that it can correctly handle...
Bosco Garc?a [Thu, 22 Aug 2019 11:54:06 +0000 (12:54 +0100)]
Fix the assembler's floating point number parser so that it can correctly handle numbers encoded as a leading decimal point, followed by zeroes, followed by a non-zero sequence.

* atof-generic.c (atof_generic): Do not ignore leading zeros if
they appear after a decimal point.
* testsuite/gas/all/float.s: Extend test to include a number with
a leading decimal point followed by several zeroes.
* testsuite/gas/i386/fp.s: Likewise.
* testsuite/gas/i386/fp.d: Update expected output.

5 years agogdb/fortran: Remove some dead code from the parser
Andrew Burgess [Thu, 22 Aug 2019 09:07:00 +0000 (10:07 +0100)]
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.

5 years agoAArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).
Tamar Christina [Thu, 22 Aug 2019 10:35:35 +0000 (11:35 +0100)]
AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).

This patch fixes a few linker crashes due to TLS code reaching an assert when it
shouldn't.

The first scenario is with weak TLS symbols that remain weak during linking.  In
this case the mid-end would not have seen a TLS symbol and so wouldn't have
allocated the TLS section.  We currently assert here and the linker crashes with
a not very useful message.

This patch changes this to return the value 0 for the TLS symbol in question
emulating what lld and gold and other BFD targets do.  However because weak TLS
is implementation defined and we don't define any behavior for it I also emit a
warning to the user to inform them of such.

Secondly when a strong TLS reference is undefined. The linker crashes even after
it correctly reported that there is an undefined reference.  This changes it so
that it gracefully exits and reports a useful error.

bfd/ChangeLog:

PR ld/24601
* elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS.
Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
* elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
for weak TLS.

ld/ChangeLog:

PR ld/24601
* testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New.
* testsuite/ld-aarch64/undef-tls.d: New test.
* testsuite/ld-aarch64/undef-tls.s: New test.
* testsuite/ld-aarch64/weak-tls.d: New test.
* testsuite/ld-aarch64/weak-tls.s: New test.

5 years agoImplement a float16 directive for assembling 16 bit IEEE 754 floating point numbers...
Barnaby Wilks [Thu, 22 Aug 2019 10:13:23 +0000 (11:13 +0100)]
Implement a float16 directive for assembling 16 bit IEEE 754 floating point numbers for the AArch64 assembler.

The syntax of the directive is:

     .float16 <0-n decimal numbers>
e.g.
     .float16 0.5
     .float16 10.2, NaN, 452.09

The floats will always be encoded using the binary16 format as described in the
IEEE 754-2008 standard. There is no need to support Arm's alternative half-precision
format since AArch64 only supports the IEEE format.

gas * config/tc-aarch64.c: Add float16 directive and add "Hh" to
acceptable float characters.
* doc/c-aarch64.texi: Documentation for float16 directive.
* testsuite/gas/aarch64/float16-be.d: New test.
* testsuite/gas/aarch64/float16-le.d: New test.
* testsuite/gas/aarch64/float16.s: New test.
* NEWS: Add NEWS entry.

5 years ago[AArch64][gas] Update MTE system register encodings
Kyrylo Tkachov [Thu, 22 Aug 2019 09:20:01 +0000 (10:20 +0100)]
[AArch64][gas] Update MTE system register encodings

The MTE specification adjusted the encoding of the TFSRE0_EL1, TFSR_EL1, TFSR_EL2, TFSR_EL3, TFSR_EL12 system registers.
This patch brings binutils up to date.

The references for the encodings are at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsre0_el1 (also contains TFSR_EL12 description)
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el1
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el2
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el3

Tested check-gas for aarch64-none-elf.

opcodes/

* aarch64-opc.c (aarch64_sys_regs): Update encoding of tfsre0_el1,
tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12.
(aarch64_sys_reg_supported_p): Update checks for the above.

gas/

    * testsuite/gas/aarch64/sysreg-4.d: Update expected disassembly for
    tfsre0_el1, tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12 system registers.

5 years agoARM CMSE symbols
Alan Modra [Thu, 22 Aug 2019 01:51:48 +0000 (11:21 +0930)]
ARM CMSE symbols

This patch removes use of st_target_internal to cache the result of
comparing symbol names against CMSE_PREFIX.  The problem with setting
a bit in st_target_internal in swap_symbol_in is that calling
bfd_elf_sym_name from swap_symbol_in requires symtab_hdr, and you
don't know for sure whether swap_symbol_in is operating on dynsyms
(and thus elf_tdata (abfd)->dynsymtab_hdr should be used) or on the
normal symtab (thus elf_tdata (abfd)->symtab_hdr).  You can make an
educated guess based on abfd->flags & DYNAMIC but that relies on
knowing a lot about calls to bfd_elf_get_elf_syms, and is fragile in
the face of possible future changes.

include/
* elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete.
bfd/
* elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
instead recognize CMSE_PREFIX in symbol name.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL.
(elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Aug 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFix nullptr in with_command_1
Pedro Alves [Wed, 21 Aug 2019 20:11:33 +0000 (21:11 +0100)]
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.

5 years agoFix g++ 9.1 build breakage
Christian Biesinger [Wed, 21 Aug 2019 20:03:53 +0000 (15:03 -0500)]
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.

5 years agogdb/djgpp: Add Hygon Dhyana processor support
Jinke Fan [Wed, 15 May 2019 09:34:57 +0000 (17:34 +0800)]
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.

5 years ago[gdb/testsuite] Stabilize gdb-caching-proc.exp test order
Tom de Vries [Wed, 21 Aug 2019 09:49:33 +0000 (11:49 +0200)]
[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.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Aug 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoChange some tui_data_window methods to be private
Tom Tromey [Sun, 14 Jul 2019 14:25:43 +0000 (08:25 -0600)]
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.

5 years agoRemove some defines from tui-data.h
Tom Tromey [Sun, 14 Jul 2019 00:30:53 +0000 (18:30 -0600)]
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.

5 years agoMove some defines to tui-stack.c
Tom Tromey [Sun, 14 Jul 2019 00:29:57 +0000 (18:29 -0600)]
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.

5 years agoChange tui_make_window to be a method
Tom Tromey [Sat, 13 Jul 2019 22:47:31 +0000 (16:47 -0600)]
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.

5 years agoRemove tui_data_window::display_regs
Tom Tromey [Sat, 13 Jul 2019 22:36:07 +0000 (16:36 -0600)]
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.

5 years agoRemove indirection from tui_data_window::regs_content
Tom Tromey [Sat, 13 Jul 2019 22:24:48 +0000 (16:24 -0600)]
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.

5 years agoAdd two methods to tui_data_window
Tom Tromey [Sat, 13 Jul 2019 22:19:11 +0000 (16:19 -0600)]
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.

5 years agoChange tui_check_register_values to be a method
Tom Tromey [Sat, 13 Jul 2019 22:15:30 +0000 (16:15 -0600)]
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.

5 years agoRearrange tui-regs.c some more
Tom Tromey [Sat, 13 Jul 2019 22:08:33 +0000 (16:08 -0600)]
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.

5 years agoChange tui_data_item_window::content to be a unique_xmalloc_ptr
Tom Tromey [Sat, 13 Jul 2019 22:01:34 +0000 (16:01 -0600)]
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.

5 years agoRemove tui_data_item_window::value
Tom Tromey [Sat, 13 Jul 2019 21:55:48 +0000 (15:55 -0600)]
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.

5 years agoMinor rearrangement in tui-regs.c
Tom Tromey [Sat, 13 Jul 2019 21:55:02 +0000 (15:55 -0600)]
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.

5 years agoRemove NULL check from tui_reg_command
Tom Tromey [Sat, 13 Jul 2019 21:53:44 +0000 (15:53 -0600)]
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.

5 years agoSome i18n fixes for the TUI
Tom Tromey [Sat, 13 Jul 2019 21:45:14 +0000 (15:45 -0600)]
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.

5 years agoRemove test files for a different patch accidentally committed with patch for ARM...
Nick Clifton [Tue, 20 Aug 2019 16:33:44 +0000 (17:33 +0100)]
Remove test files for a different patch accidentally committed with patch for ARM CPU additions.

5 years agoAdds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex...
Dennis Zhang [Tue, 20 Aug 2019 16:13:29 +0000 (17:13 +0100)]
Adds support for following CPUs to the ARM and Aarch64 assemblers: Cortex-A77, Cortex-A76AE, Cortex-A34, Cortex-A65, and Cortex-A65AE.

Related specifications can be found at
https://developer.arm.com/ip-products/processors.

gas * NEWS: Mention the Arm and AArch64 new processors.
* config/tc-aarch64.c: New entries for Cortex-A34, Cortex-A65,
Cortex-A77, cortex-A65AE, and Cortex-A76AE.
* doc/c-aarch64.texi: Document new CPUs.
* testsuite/gas/aarch64/cpu-cortex-a34.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a65.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a65ae.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a76ae.d: New test.
* testsuite/gas/aarch64/cpu-cortex-a77.d: New test.
* testsuite/gas/aarch64/nop-asm.s: New test.

bfd * cpu-aarch64.c: New entries for Cortex-A34, Cortex-A65,
 Cortex-A77, cortex-A65AE, and Cortex-A76AE.

5 years agoArm: Fix performance issue with thumb-2 tailcalls
Tamar Christina [Tue, 20 Aug 2019 15:34:26 +0000 (16:34 +0100)]
Arm: Fix performance issue with thumb-2 tailcalls

We currently use a padding NOP after a Thumb to Arm interworking veneer (BX pc).
The NOP is never executed but may result in a performance penalty on some cores.

For this reason this patch changes the NOPs after Thumb to Arm veneers into B .-2
and adds a note to this in the source code for future reference.

bfd/ChangeLog:

* elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub,
elf32_arm_stub_long_branch_v4t_thumb_thumb,
elf32_arm_stub_long_branch_v4t_thumb_arm,
elf32_arm_stub_short_branch_v4t_thumb_arm,
elf32_arm_stub_long_branch_v4t_thumb_arm_pic,
elf32_arm_stub_long_branch_v4t_thumb_thumb_pic,
elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to
previous instruction.

ld/ChangeLog:

* testsuite/ld-arm/cortex-a8-fix-b-plt.d: Update Testcase.
* testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise.
* testsuite/ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
* testsuite/ld-arm/farcall-cond-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app2.d: Likewise.
* testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-short.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb.d: Likewise.
* testsuite/ld-arm/fix-arm1176-on.d: Likewise.
* testsuite/ld-arm/ifunc-10.dd: Likewise.
* testsuite/ld-arm/ifunc-2.dd: Likewise.
* testsuite/ld-arm/ifunc-4.dd: Likewise.
* testsuite/ld-arm/ifunc-6.dd: Likewise.
* testsuite/ld-arm/ifunc-8.dd: Likewise.
* testsuite/ld-arm/jump-reloc-veneers-long.d: Likewise.
* testsuite/ld-arm/mixed-app.d: Likewise.
* testsuite/ld-arm/thumb2-b-interwork.d: Likewise.
* testsuite/ld-arm/tls-longplt.d: Likewise.
* testsuite/ld-arm/tls-thumb1.d: Likewise.

5 years ago[gdb/testsuite] Clean up stale exec in gdb_compile_pascal
Tom de Vries [Tue, 20 Aug 2019 15:18:09 +0000 (17:18 +0200)]
[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.

5 years agoImprove remote attach round-trips without btrace
Conrad Meyer [Mon, 19 Aug 2019 07:02:19 +0000 (00:02 -0700)]
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.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Aug 2019 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMIPS/gas: Fix misaligned address errors to disregard ISA mode bit
Faraz Shahbazker [Tue, 13 Aug 2019 05:32:20 +0000 (05:32 +0000)]
MIPS/gas: Fix misaligned address errors to disregard ISA mode bit

gas/
* config/tc-mips.c (fix_bad_misaligned_address): New function.
(fix_validate_branch): Call fix_bad_misaligned address_to
calculate the target address.
(md_apply_fix): Likewise.
(md_convert_frag): Update misaligned address calculation to
disregard ISA mode bit.

5 years agoMIPS/gas: Retain ISA mode bit for labels with .insn annotation
Faraz Shahbazker [Mon, 5 Aug 2019 23:38:46 +0000 (23:38 +0000)]
MIPS/gas: Retain ISA mode bit for labels with .insn annotation

gas/
* config/tc-mips.c (mips_move_labels): Retain ISA mode bit
when moving labels in text segments.
(mips_align): Indicate text mode when aligning labels in
text segments.
* gas/testsuite/gas/mips/insn-isa-mode.d: New test.
* gas/testsuite/gas/mips/insn-isa-mode.s: New test source.
* gas/testsuite/gas/mips/mips.exp: Run the new test.

5 years agoFix indentation in value_has_field
Tom Tromey [Mon, 19 Aug 2019 18:46:03 +0000 (12:46 -0600)]
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.

5 years agoFix Fortran regression with variables in nested functions
Tom Tromey [Tue, 13 Aug 2019 17:39:58 +0000 (11:39 -0600)]
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.

5 years agoAdd Rust support to source highlighting
Tom Tromey [Mon, 24 Jun 2019 22:02:47 +0000 (16:02 -0600)]
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.

5 years agoAdd --with-static-standard-libraries to the top level
Tom Tromey [Fri, 26 Jul 2019 21:42:25 +0000 (15:42 -0600)]
Add --with-static-standard-libraries to the top level

gdb should normally not be linked with -static-libstdc++.  Currently
this has not caused problems, but it's incompatible with catching an
exception thrown from a shared library -- and a subsequent patch
changes gdb to do just this.

This patch adds a new --with-static-standard-libraries flag to the
top-level configure.  It defaults to "auto", which means enabled if
gcc is being built, and disabled otherwise.

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

* configure: Rebuild.
* configure.ac: Add --with-static-standard-libraries.

5 years agoFix N^2 behavior in _bfd_dwarf2_find_symbol_bias
Tom Tromey [Thu, 15 Aug 2019 13:33:20 +0000 (07:33 -0600)]
Fix N^2 behavior in _bfd_dwarf2_find_symbol_bias

A customer reported a case where addr2line was very slow.  We tracked
this down to some N^2 behavior in _bfd_dwarf2_find_symbol_bias in the
unusual case where no function can be found.

This patch fixes the bug, and reduces the runtime for a particular
request from 127 seconds to 1 second.

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

* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Create hash table
holding symbols.

5 years agoPR24898, An out-of-bounds read occured in display_data
Alan Modra [Mon, 19 Aug 2019 10:54:35 +0000 (20:24 +0930)]
PR24898, An out-of-bounds read occured in display_data

Given 32-bit pointers and a 64-bit bfd_size_type, it is relatively
easy to construct a value of augmentation_data_len (eg. 0x100000000)
that won't fail pointer checks but will print without bounds.

PR 24898
* dwarf.c (display_debug_frames): Use the read_cie check and error
for augmentation data length.

5 years agoPowerPC64 ha/lo insn checks
Alan Modra [Mon, 19 Aug 2019 08:04:03 +0000 (17:34 +0930)]
PowerPC64 ha/lo insn checks

These are done in ppc64_elf_edit_toc, which now also garbage collects
unused GOT entries.  The checks for legitimate instructions weren't
being done for the GOT relocs, unless the file also happened to have a
toc section.

* elf64-ppc.c (struct ppc64_elf_obj_tdata): Rename has_gotrel
to has_optrel.
(struct _ppc64_elf_section_data): Likewise.
(ppc64_elf_check_relocs): Set has_optrel for more relocs.
(ppc64_elf_edit_toc): Do ha/lo insn checks in GOT loop rather
than TOC loop.  Check PLT16 insns too.

5 years agoFloat16: Fix test failures for non ELF targets
Barnaby Wilks [Thu, 15 Aug 2019 16:21:59 +0000 (16:21 +0000)]
Float16: Fix test failures for non ELF targets

The tests were failing due to md_atof trying to do word-wise endian
switching on the float16 (for little-endian targets sometimes
multi word values have their word order changed).
However since a float16 is only 1 word wide, it would end up writing
incorrect data, as you cannot switch the word order of just one word.

* config/tc-arm.c (md_atof): Add precision check.  Formatting.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Aug 2019 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Aug 2019 00:01:39 +0000 (00:01 +0000)]
Automatic date update in version.in

5 years agoPR24911, Heap overflow issue in qsort_r, dwarf.c
Alan Modra [Sat, 17 Aug 2019 08:31:05 +0000 (18:01 +0930)]
PR24911, Heap overflow issue in qsort_r, dwarf.c

The actual args to this function are "pointers to pointers to
debug_info".

PR 24911
* dwarf.c (comp_addr_base): Dereference args.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie
Tom de Vries [Fri, 16 Aug 2019 21:48:28 +0000 (23:48 +0200)]
[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.

5 years agox86-64: Move PIC check for PC-relative relocations back
H.J. Lu [Fri, 16 Aug 2019 21:25:15 +0000 (14:25 -0700)]
x86-64: Move PIC check for PC-relative relocations back

commit 83924b3846361f2f76f9a6e7b5afa01c0eebbd4f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 5 18:45:23 2019 -0800

    x86-64: Restore PIC check for PCREL reloc against protected symbol

moved PIC check for PC-relative relocations to elf_x86_64_check_relocs.
Since linker defined symbols may not be processed at the time, we need
to move the check back to elf_x86_64_relocate_section.

bfd/

PR ld/24905
* elf64-x86-64.c (elf_x86_64_check_relocs): Move PIC check for
PC-relative relocations back to ...
(elf_x86_64_relocate_section): Here.

ld/

PR ld/24905
* testsuite/ld-x86-64/pr24905-x32.d: New file.
* testsuite/ld-x86-64/pr24905.d: Likewise.
* testsuite/ld-x86-64/pr24905.s: Likewise.
* testsuite/ld-x86-64/pr24905.t: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr24905 and pr24905-x32.

5 years agoRemove the TUI execution info window
Tom Tromey [Sat, 13 Jul 2019 00:18:10 +0000 (18:18 -0600)]
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.

5 years agoRemove useless assignment from tui_remove_hooks
Tom Tromey [Fri, 12 Jul 2019 05:24:03 +0000 (23:24 -0600)]
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.

5 years agoChange tui_show_symtab_source to be a method
Tom Tromey [Fri, 12 Jul 2019 02:00:07 +0000 (20:00 -0600)]
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.

5 years agoIntroduce tui_source_window_base::set_contents method
Tom Tromey [Fri, 12 Jul 2019 00:42:20 +0000 (18:42 -0600)]
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.

5 years agoChange tui_update_breakpoint_info to be a method
Tom Tromey [Fri, 12 Jul 2019 00:27:02 +0000 (18:27 -0600)]
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.

5 years agoChange tui_update_source_window to be a method
Tom Tromey [Fri, 12 Jul 2019 00:24:07 +0000 (18:24 -0600)]
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.

5 years agoChange tui_update_source_window_as_is to be a method
Tom Tromey [Fri, 12 Jul 2019 00:22:06 +0000 (18:22 -0600)]
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.