Commit Graph

98948 Commits

Author SHA1 Message Date
Hans-Peter Nilsson a2230b5e62 libctf: make it compile for old glibc
With a glibc before 2.9 (such as 2.8), there's <endian.h> but no
htole64 or le64toh, so you get, compiling binutils for any target:

libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes \
-Wshadow -Werror -I/x/binutils/../zlib -g -O2 -o objdump \
objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o \
bucomm.o version.o filemode.o elfcomm.o  ../opcodes/.libs/libopcodes.a \
../libctf/libctf.a ../bfd/.libs/libbfd.a -L/x/obj/b/zlib -lz ../libiberty/libiberty.a -ldl
../libctf/libctf.a(ctf-archive.o): In function `ctf_archive_raw_iter_internal':
/x/src/libctf/ctf-archive.c:543: undefined reference to `le64toh'
/x/src/libctf/ctf-archive.c:550: undefined reference to `le64toh'
/x/src/libctf/ctf-archive.c:551: undefined reference to `le64toh'
/x/src/libctf/ctf-archive.c:551: undefined reference to `le64toh'
/x/src/libctf/ctf-archive.c:554: undefined reference to `le64toh'
../libctf/libctf.a(ctf-archive.o):/x/src/libctf/ctf-archive.c:545: more undefined references to `le64toh' follow
(etc)

Also, I see no bswap_identity_64 *anywhere* except in libctf/swap.h
(including current glibc) and I don't think calling an "identity"-
function is better than just plain "#define foo(x) (x)" anyway.
(Where does the idea of a bytestap.h bswap_identity_64 come from?)

Speaking of that, I should mention that I instrumented the condition
to observe that the WORDS_BIGENDIAN case passes too for a presumed
big-endian target and glibc-2.8: there is a bswap_64 present for that
version.  Curiously, no test-case regressed with that instrumentation.

For the record, constructing binary blobs using text source to run
tests on, can be done by linking to --oformat binary (with most ELF
targets), but I guess that's seen as unnecessary roundabout perhaps
checking in binary files in the test-suite would be ok these days.
[...]

[nca: trimmed commit log slightly, updated changelog]

v5: fix tabdamage.

libctf/
	* ctf-endian.h: Don't assume htole64 and le64toh are always
	present if HAVE_ENDIAN_H; also check if htole64 is defined.
	[!WORDS_BIGENDIAN] (htole64, le64toh): Define as identity,
	not bswap_identity_64.
2019-10-03 17:04:55 +01:00
Andrew Burgess d8c06f22a3 gdb: Don't ignore all SIGSTOP when the signal handler is set to pass
It was observed that in a multi-threaded application on GNU/Linux,
that if the user has set the SIGSTOP to be pass (using GDB's handle
command) then the inferior would hang upon hitting a breakpoint.

What happens is that when a thread hits the breakpoint GDB tries to
stop all of the other threads by sending them a SIGSTOP and setting
the stop_requested flag in the target_ops structure - this can be seen
in infrun.c:stop_all_threads.

GDB then waits for all of the other threads to stop.

When the SIGSTOP event arrives we eventually end up in
linux-nat.c:linux_nat_filter_event, which has the job of deciding if
the event we're looking at (the SIGSTOP arriving in this case) is
something that should be reported back to the core of GDB.

One of the final actions of this function is to check if we stopped
due to a signal, and if we did, and the signal has been set to 'pass'
by the user then we ignore the event and resume the thread.

This code already has some conditions in place that mean the event is
reported to GDB even if the signal is in the set of signals to be
passed to the inferior.

In this commit I extend this condition such that:

  If the signal is a SIGSTOP, and the thread's stop_requested flag is
  set (indicating we're waiting for the thread to stop with a SIGSTOP)
  then we should report this SIGSTOP to GDB and not pass it to the
  inferior.

With this change in place the test now passes.  Regression tested on
x86-64 GNU/Linux with no regressions.

gdb/ChangeLog:

	* linux-nat.c (linux_nat_filter_event): Don't ignore SIGSTOP if we
	have just sent the thread a SIGSTOP and are waiting for it to
	arrive.

gdb/testsuite/ChangeLog:

	* gdb.threads/stop-with-handle.c: New file.
	* gdb.threads/stop-with-handle.exp: New file.
2019-10-03 16:12:02 +01:00
Tom de Vries 3a56ed8668 [gdb/testsuite] Fix list-missing-source.exp with gcc 4.8
With gcc 4.8.1, we see this FAIL:
...
(gdb) PASS: gdb.base/list-missing-source.exp: list
info source^M
Current source file is outputs/gdb.base/list-missing-source/main.c^M
Source language is c.^M
Producer is GNU C 4.8.5 -mtune=generic -march=x86-64 -g -fno-stack-protector.^M
Compiled with DWARF 2 debugging format.^M
Does not include preprocessor macro info.^M
(gdb) FAIL: gdb.base/list-missing-source.exp: info source
...

The problem is that a "Compilation directory is <dir>" line is expected, but
this is missing due to the fact the the compilation unit for main.c doesn't
contain a DW_AT_comp_dir in the DW_TAG_compile_unit DIE.

Fix this by allowing the "Compilation directory" line to be missing.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-03  Tom de Vries  <tdevries@suse.de>

	PR testsuite/25059
	* gdb.base/list-missing-source.exp: Allowing the "Compilation
	directory" line to be missing.
2019-10-03 16:22:09 +02:00
Tom de Vries 4227504491 [gdb/testsuite] Fix info-types.exp with gcc/g++ 4.8
The gdb.base/info-types.exp test-case FAILs with gcc/g++ 4.8 because the DWARF
record for the 'unsigned int' type is missing in the executables, while it is
present for gcc/g++ 7.4.1.

For a minimal example using gcc 7.4.1:
...
$ echo "enum enum_t { AA, BB, CC }; enum enum_t var;" > enum.c
$ gcc enum.c -c -g
...
we find that the enum type has DW_AT_encoding 'unsigned':
 <1><1d>: Abbrev Number: 2 (DW_TAG_enumeration_type)
    <1e>   DW_AT_name        : (indirect string, offset: 0x1f): enum_t
    <22>   DW_AT_encoding    : 7        (unsigned)
    <23>   DW_AT_byte_size   : 4
    <24>   DW_AT_type        : <0x3e>
    <28>   DW_AT_decl_file   : 1
    <29>   DW_AT_decl_line   : 1
    <2a>   DW_AT_sibling     : <0x3e>
...
and a DW_AT_type reference to the type 'unsigned int':
...
 <1><3e>: Abbrev Number: 4 (DW_TAG_base_type)
    <3f>   DW_AT_byte_size   : 4
    <40>   DW_AT_encoding    : 7        (unsigned)
    <41>   DW_AT_name        : (indirect string, offset: 0x26): unsigned int
...

With gcc 4.8.5 however, we have no 'unsigned' encoding, and no DW_AT_type:
...
 <1><1d>: Abbrev Number: 2 (DW_TAG_enumeration_type)
    <1e>   DW_AT_name        : (indirect string, offset: 0x1f): enum_t
    <22>   DW_AT_byte_size   : 4
    <23>   DW_AT_decl_file   : 1
    <24>   DW_AT_decl_line   : 1
    <25>   DW_AT_sibling     : <0x39>
...
as well as no record for 'unsigned int'.

Make the test-case pass with gcc/g++ 4.8 by making the presence of the
'unsigned int' type optional.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-03  Tom de Vries  <tdevries@suse.de>

	PR testsuite/25059
	* gdb.base/info-types.exp: Make the presence of the 'unsigned int'
	type optional.
2019-10-03 15:02:58 +02:00
Andrew Burgess a8b3b8e93e gdb: Remove whitespace in 'std::vector <...>'
In the following 3 commits:

    commit df07e2c772
    Date:   Wed Sep 25 16:10:50 2019 +0100

        gdb: Remove a use of VEC from dwarf2read.{c,h}

    commit 554ac434b0
    Date:   Thu Sep 19 13:17:59 2019 -0400

        gdb: Change a VEC to std::vector in btrace.{c,h}

    commit 46f29a9a26
    Date:   Mon Sep 16 09:12:27 2019 -0400

        gdb: Remove a VEC from gdbsupport/btrace-common.h

I incorrectly wrote 'std::vector <...>' instead of 'std::vector<...>',
this commit fixes this mistake.  There should be no user visible
changes after this commit.

gdb/ChangeLog:

	* btrace.c (btrace_add_pc): Remove whitespace before the template
	parameter in 'std::vector <...>'.
	(parse_xml_btrace_block): Likewise.
	(btrace_maint_decode_pt): Likewise.
	(btrace_maint_update_packets): Likewise.
	(btrace_maint_print_packets): Likewise.
	* btrace.h (struct btrace_maint_info): Likewise.
	* dwarf2read.c (struct type_unit_group): Likewise.
	(build_type_psymtabs_reader): Likewise.
	* gdbsupport/btrace-common.c (btrace_data_append): Likewise.
	* gdbsupport/btrace-common.h (struct btrace_data_bts): Likewise.
	* nat/linux-btrace.c (perf_event_read_bts): Likewise.
2019-10-03 09:42:42 +01:00
Tom de Vries 4d825eab2d [gdb] Fix set/show style metadata help text
There's a recent regression:
...
FAIL: gdb.gdb/unittest.exp: maintenance selftest
...

In more detail:
...
Running selftest help_doc_invariants.^M
help doc broken invariant: command 'set style metadata' help doc first line \
  is not terminated with a '.' character^M
help doc broken invariant: command 'show style metadata' help doc first line \
  is not terminated with a '.' character^M
Self test failed: self-test failed at gdb/unittests/help-doc-selftests.c:95^M
...

Fix this by adding a '.' at the end of the first line of the help text for
set/show style metadata.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-10-03  Tom de Vries  <tdevries@suse.de>

	* cli/cli-style.c (_initialize_cli_style): Adding a '.' at the end of
	the first line of the help text for set/show style metadata.
2019-10-03 10:15:39 +02:00
GDB Administrator 03ba321aaa Automatic date update in version.in 2019-10-03 00:00:20 +00:00
Christian Biesinger 3e6ec53ac1 Convert boolean globals in server.c to bool
Converts the int globals to bool.

gdb/gdbserver/ChangeLog:

2019-10-02  Christian Biesinger  <cbiesinger@google.com>

	* server.c (server_waiting): Change to bool.
	(extended_protocol): Likewise.
	(response_needed): Likewise.
	(exit_requested): Likewise.
	(run_once): Likewise.
	(report_no_resumed): Likewise.
	(non_stop): Likewise.
	(disable_packet_vCont): Likewise.
	(disable_packet_Tthread): Likewise.
	(disable_packet_qC): Likewise.
	(disable_packet_qfThreadInfo): Likewise.
	(handle_general_set): Update.
	(handle_detach): Update.
	(handle_monitor_command): Update.
	(handle_query): Update.
	(captured_main): Update.
	(process_serial_event): Update.
	* server.h (server_waiting): Change to bool.
	(disable_packet_vCont): Likewise.
	(disable_packet_Tthread): Likewise.
	(disable_packet_qC): Likewise.
	(disable_packet_qfThreadInfo): Likewise.
	(run_once): Likewise.
	(non_stop): Likewise.
	* target.c (target_stop_and_wait): Update.
2019-10-02 14:48:53 -05:00
Tom Tromey 80fd282641 Fix type of startup_with_shell in gdbserver
startup_with_shell was changed to be of "bool" type, but I noticed
that the definition in gdbserver disagreed.  This disagreement caused
some regressions on a big-endian machine.

This patch removes the redundant declaration and definition of
startup_with_shell and ensures that such clashes will be diagnosed.

This moves the declaration to common-inferior.h, and introduces a new
common-inferior.c, as suggested by Pedro.

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

	* Makefile.in (COMMON_SFILES): Add common-inferior.c.
	* gdbsupport/common-inferior.c: New file.
	* infcmd.c (startup_with_shell): Don't define.
	* nat/fork-inferior.h (startup_with_shell): Don't declare.
	* gdbsupport/common-inferior.h (startup_with_shell): Declare.
	* inferior.h (startup_with_shell): Don't declare.

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

	* Makefile.in (SFILES): Add common-inferior.c.
	(OBS): Add common-inferior.o.
	* server.c (startup_with_shell): Don't define.
2019-10-02 13:43:41 -06:00
Christian Biesinger 700545387d Add missing includes to gdb_assert.h and gdb_string_view.h
gdb::string_view uses gdb_assert, so it should include that header.
And gdb_assert uses internal_error, so it should include errors.h.

gdb/ChangeLog:

2019-10-02  Christian Biesinger  <cbiesinger@google.com>

	* gdbsupport/gdb_assert.h: Include errors.h.
	* gdbsupport/gdb_string_view.h: Include gdb_assert.h.
2019-10-02 13:33:09 -05:00
Andreas Arnez 9ef62df072 gdb/testsuite: Fix py-format-string.exp on big-endian platforms
GDB's py-format-string test case depends on endianness.  In particular it
relies on the first byte of the machine representation of 42 (as an int)
to be 42 as well.  While this is indeed the case for little-endian
machines, big-endian machines store a zero in the first byte instead.  The
wrong assumption leads to lots of FAILs on such architectures.

Fix this by filling the affected union with bytes of the same value, such
that endianness does not matter.  Use the value 42, to keep the character
in the first byte unchanged.

gdb/testsuite/ChangeLog:

	* gdb.python/py-format-string.c (string.h): New include.
	(main): Fill a_struct_with_union.the_union.an_int with bytes of
	the same value, for endianness-independence.
	* gdb.python/py-format-string.exp (default_regexp_dict)
	(test_pretty_structs, test_format): Adjust expected output to the
	changed initialization.
2019-10-02 20:01:44 +02:00
Tom Tromey 37f6a7f456 Add $_ada_exception convenience variable
This adds the $_ada_exception convenience variable.  It is set by the
Ada exception catchpoints, and holds the address of the exception
currently being thrown.  This is useful because it allows more
fine-grained filtering of exceptions than is possible using the
existing "catch" syntax.

This also simplifies Ada catchpoints somewhat; because the catchpoint
must now carry the "kind", it's possible to remove many helper
functions.

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

	* NEWS: Add $_ada_exception entry.
	* ada-lang.c (struct ada_catchpoint): Add constructor.
	<m_kind>: New member.
	(allocate_location_exception, re_set_exception): Remove
	"ex" parameter.
	(should_stop_exception): Compute $_ada_exception.
	(check_status_exception, print_it_exception)
	(print_one_exception, print_mention_exception): Remove
	"ex" parameter.
	(allocate_location_catch_exception, re_set_catch_exception)
	(check_status_exception, print_it_catch_exception)
	(print_one_catch_exception, print_mention_catch_exception)
	(print_recreate_catch_exception)
	(allocate_location_catch_exception_unhandled)
	(re_set_catch_exception_unhandled)
	(check_status_exception, print_it_catch_exception_unhandled)
	(print_one_catch_exception_unhandled)
	(print_mention_catch_exception_unhandled)
	(print_recreate_catch_exception_unhandled)
	(allocate_location_catch_assert, re_set_catch_assert)
	(check_status_assert, print_it_catch_assert)
	(print_one_catch_assert, print_mention_catch_assert)
	(print_recreate_catch_assert)
	(allocate_location_catch_handlers, re_set_catch_handlers)
	(check_status_handlers, print_it_catch_handlers)
	(print_one_catch_handlers, print_mention_catch_handlers)
	(print_recreate_catch_handlers): Remove.
	(create_ada_exception_catchpoint): Update.
	(initialize_ada_catchpoint_ops): Update.

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

	* gdb.texinfo (Set Catchpoints, Convenience Vars): Document
	$_ada_exception.

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

	* gdb.ada/catch_ex_std.exp: Add $_ada_exception test.
2019-10-02 09:53:17 -06:00
Tom Tromey fccf9de11f Back out earlier Ada exception change
commit 2ff0a9473 (Fix "catch exception" with dynamic linking) changed
how ada-lang.c creates expressions to determine if an exception
catchpoint should stop.

That patch is no longer needed now that copy relocations are handled
more directly.

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

	* ada-lang.c (ada_lookup_simple_minsyms): Remove.
	(create_excep_cond_exprs): Simplify exception string computation.
	(ada_exception_catchpoint_cond_string): Likewise.
2019-10-02 09:53:17 -06:00
Pedro Alves 1d58d6a26c Make print-file-var.exp test attribute visibility hidden, dlopen, and main symbol
Make gdb.base/print-file-var.exp test all combinations of:

  - attribute hidden in the this_version_id symbols or not
  - dlopen or not
  - this_version_id symbol in main file or not
  - C++

gdb/testsuite/ChangeLog
2019-10-02  Pedro Alves  <palves@redhat.com>
	    Andrew Burgess  <andrew.burgess@embecosm.com>

	* gdb.base/print-file-var-lib1.c: Include <stdio.h> and
	"print-file-var.h".
	(this_version_id) Use ATTRIBUTE_VISIBILITY.
	(get_version_1): Print this_version_id and its address.
	Add extern "C" wrappers around interface functions.
	* gdb.base/print-file-var-lib2.c: Include <stdio.h> and
	"print-file-var.h".
	(this_version_id) Use ATTRIBUTE_VISIBILITY.
	(get_version_2): Print this_version_id and its address.
	Add extern "C" wrappers around interface functions.
	* gdb.base/print-file-var-main.c: Include <dlfcn.h>, <assert.h>,
	<stddef.h> and "print-file-var.h".
	Add extern "C" wrappers around interface functions.
	[VERSION_ID_MAIN] (this_version_id): Define.
	(main): Define v0.  Use dlopen if SHLIB_NAME is defined.
	* gdb.base/print-file-var.h: Add some #defines to simplify setting
	up extern "C" blocks.
	* gdb.base/print-file-var.exp (test): New, factored out from top
	level.
	(top level): Test all combinations of attribute hidden or not,
	dlopen or not, and this_version_id symbol in main file or not.
	Compile tests as both C++ and C, make test names unique.
2019-10-02 09:53:17 -06:00
Tom Tromey 4b610737f0 Handle copy relocations
In ELF, if a data symbol is defined in a shared library and used by
the main program, it will be subject to a "copy relocation".  In this
scenario, the main program has a copy of the symbol in question, and a
relocation that tells ld.so to copy the data from the shared library.
Then the symbol in the main program is used to satisfy all references.

This patch changes gdb to handle this scenario.  Data symbols coming
from ELF shared libraries get a special flag that indicates that the
symbol's address may be subject to copy relocation.

I looked briefly into handling copy relocations by looking at the
actual relocations in the main program, but this seemed difficult to
do with BFD.

Note that no caching is done here.  Perhaps this could be changed if
need be; I wanted to avoid possible problems with either objfile
lifetimes and changes, or conflicts with the long-term (vapor-ware)
objfile splitting project.

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

	* symmisc.c (dump_msymbols): Don't use MSYMBOL_VALUE_ADDRESS.
	* ada-lang.c (lesseq_defined_than): Handle
	LOC_STATIC.
	* dwarf2read.c (dwarf2_per_objfile): Add can_copy
	parameter.
	(dwarf2_has_info): Likewise.
	(new_symbol): Set maybe_copied on symbol when
	appropriate.
	* dwarf2read.h (dwarf2_per_objfile): Add can_copy
	parameter.
	<can_copy>: New member.
	* elfread.c (record_minimal_symbol): Set maybe_copied
	on symbol when appropriate.
	(elf_symfile_read): Update call to dwarf2_has_info.
	* minsyms.c (lookup_minimal_symbol_linkage): New
	function.
	* minsyms.h (lookup_minimal_symbol_linkage): Declare.
	* symtab.c (get_symbol_address, get_msymbol_address):
	New functions.
	* symtab.h (get_symbol_address, get_msymbol_address):
	Declare.
	(SYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_ADDRESS): Handle
	maybe_copied.
	(struct symbol, struct minimal_symbol) <maybe_copied>:
	New member.
2019-10-02 09:53:17 -06:00
Tom Tromey 1dd5885077 Make current_source_* per-program-space
This changes current_source_symtab and current_source_line to be
per-program-space.  This ensures that switching inferiors will
preserve the current "list" location for that inferior, and also
ensures that the default expression evaluation context always comes
with the current inferior.

No test case, because the latter problem crops up with an existing
gdb.multi test case once this entire series has been applied.

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

	* source.c (struct current_source_location): New.
	(current_source_key): New global.
	(current_source_symtab, current_source_line)
	(current_source_pspace): Remove.
	(get_source_location): New function.
	(get_current_source_symtab_and_line)
	(set_default_source_symtab_and_line)
	(set_current_source_symtab_and_line)
	(clear_current_source_symtab_and_line, select_source_symtab)
	(info_source_command, print_source_lines_base)
	(info_line_command, search_command_helper, _initialize_source):
	Update.
2019-10-02 09:53:17 -06:00
Tom Tromey 5c281dbb24 Don't call decode_line_with_current_source from select_source_symtab
select_source_symtab currently calls decode_line_with_current_source.
However, this function iterates over all program spaces, and so it is
possible that it will return a "main" from some other program space.

This patch changes select_source_symtab to simply use the symbol it
already found in the current program space.

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

	* source.c (select_source_symtab): Don't call
	decode_line_with_current_source.
2019-10-02 09:53:17 -06:00
Andrew Burgess d3d323915c Search global block from basic_lookup_symbol_nonlocal
This changes lookup_global_symbol to look in the global block
of the passed-in block.  If no block was passed in, it reverts to the
previous behavior.

This change is needed to ensure that 'FILENAME'::NAME lookups work
properly.  As debugging Pedro's test case showed, this was not working
properly in the case where multiple identical names could be found
(the one situation where this feature is truly needed :-).

This also removes some old comments from basic_lookup_symbol_nonlocal
that no longer apply.

Note that the new test cases for this change will appear in a later
patch.  They are in gdb.base/print-file-var.exp.

gdb/ChangeLog
2019-10-02  Andrew Burgess  <andrew.burgess@embecosm.com>

	* symtab.c (lookup_global_symbol): Search global block.
2019-10-02 09:53:17 -06:00
Tom Tromey 38583298e0 Change SYMBOL_VALUE_ADDRESS to be an rvalue
This changes SYMBOL_VALUE_ADDRESS to be an rvalue.  The symbol readers
generally assign using this, so this also introduces
SET_SYMBOL_VALUE_ADDRESS and updates the readers.  Making this change
is useful in a subsequent patch, which redefined SYMBOL_VALUE_ADDRESS.

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

	* coffread.c (process_coff_symbol): Update.
	* dwarf2read.c (var_decode_location, new_symbol): Update.
	* mdebugread.c (parse_symbol): Update.
	* objfiles.c (relocate_one_symbol): Update.
	* stabsread.c (define_symbol, fix_common_block)
	(scan_file_globals): Update.
	* symtab.h (SYMBOL_VALUE_ADDRESS): Expand to an rvalue.
	(SET_SYMBOL_VALUE_ADDRESS): New macro.
	* xcoffread.c (process_xcoff_symbol): Update.
2019-10-02 09:53:17 -06:00
Andreas Arnez 9344c18feb Update my email address in gdb/MAINTAINERS
My email address at IBM has changed from arnez@linux.vnet.ibm.com to
arnez@linux.ibm.com.  Reflect that in the MAINTAINERS file.

gdb/ChangeLog:

	* MAINTAINERS: Update my email address.
2019-10-02 16:01:44 +02:00
Alan Modra 1914e26482 -Bsymbolic is not for PIEs
Despite PR19615, it doesn't make sense to use -Bsymbolic with PIEs.
Dynamic symbols in an executable won't be overridden anyway.

	* ld.texi (-Bsymbolic, -Bsymbolic-functions): Don't mention PIEs.
	* ld.h (symbolic_enum, dynamic_list_enum),
	(args_type <symbolic, dynamic_list>): Move to..
	* lexsup.c (parse_args): ..here, using auto vars opt_symbolic
	and opt_dynamic_list rather than command_line fields.  Only
	act on -Bsymbolic and -Bsymbolic-functions for shared library
	output.  Free dynamic_list.
2019-10-02 23:01:53 +09:30
Andrew Burgess df07e2c772 gdb: Remove a use of VEC from dwarf2read.{c,h}
Removes a use of VEC from dwarf2read.{c,h} and replaces it with
std::vector.  As far as possible this is a like for like replacement
with minimal refactoring.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* dwarf2read.c (struct type_unit_group) <tus>: Convert to
	std::vector.
	(build_type_psymtabs_reader): Update for std::vector.
	(build_type_psymtab_dependencies): Likewise.
	* dwarf2read.h: Remove use of DEF_VEC_P.
	(typedef sig_type_ptr): Delete.
2019-10-02 14:05:51 +01:00
Andrew Burgess 554ac434b0 gdb: Change a VEC to std::vector in btrace.{c,h}
Replace a VEC with a std::vector in btrace.h, and update btrace.c to
match.  It is worth noting that this code appears to be currently
untested by the GDB testsuite.  I've tried to do a like for like
replacement when moving to std::vector, with minimal refactoring to
try and avoid introducing any bugs.

As the new vector is inside a union I've currently used a pointer to
vector, which makes the code slightly uglier than it might otherwise
be, but again, due to lack of testing I'm reluctant to start
refactoring the code in a big way.

gdb/ChangeLog:

	* btrace.c (btrace_maint_clear): Update to handle change from VEC
	to std::vector.
	(btrace_maint_decode_pt): Likewise, and move allocation of the
	vector outside of the loop.
	(btrace_maint_update_packets): Update to handle change from VEC to
	std::vector.
	(btrace_maint_print_packets): Likewise.
	(maint_info_btrace_cmd): Likewise.
	* btrace.h: Remove use of DEF_VEC_O.
	(typedef btrace_pt_packet_s): Delete.
	(struct btrace_maint_info) <packets>: Change fromm VEC to
	std::vector.
	* gdbsupport/btrace-common.h: Remove 'vec.h' include.
2019-10-02 14:05:50 +01:00
Andrew Burgess 46f29a9a26 gdb: Remove a VEC from gdbsupport/btrace-common.h
Converts a VEC into a std::vector in gdbsupport/btrace-common.h.  This
commit just performs a mechanical conversion and doesn't do any
refactoring.  One consequence of this is that the std::vector must
actually be a pointer to std::vector as it is placed within a union.
It might be possible in future to refactor to a class hierarchy and
remove the need for a union, but I'd rather have that be a separate
change to make it easier to see the evolution of the code.

gdb/ChangeLog:

	* btrace.c (btrace_compute_ftrace_bts): Update for std::vector,
	make accesses into the vector constant references.
	(btrace_add_pc): Update for std::vector.
	(btrace_stitch_bts): Likewise.
	(parse_xml_btrace_block): Likewise.
	(btrace_maint_update_packets): Likewise.
	(btrace_maint_print_packets): Likewise.
	(maint_info_btrace_cmd): Likewise.
	* gdbsupport/btrace-common.c (btrace_data::fini): Update for
	std::vector.
	(btrace_data::empty): Likewise.
	(btrace_data_append): Likewise.
	* gdbsupport/btrace-common.h: Remove use of DEF_VEC_O.
	(typedef btrace_block_s): Delete.
	(struct btrace_block): Add constructor.
	(struct btrace_data_bts) <blocks>: Change to std::vector.
	* nat/linux-btrace.c (perf_event_read_bts): Update for
	std::vector.
	(linux_read_bts): Likewise.

gdb/gdbserver/ChangeLog:

	* linux-low.c (linux_low_read_btrace): Update for change to
	std::vector.
2019-10-02 14:05:49 +01:00
Nick Clifton de4859eacb Change objcopy's --set-section-alignment option to take a byte alignment value rather than a power of two alignment value.
PR 24942
	* objcopy.c (copy_usage): Update description of
	--set-section-alignment.
	(copy_main): Interpret numeric argument of --set-section-alignment
	as a byte alignment, not a power of two alignment.
	* doc/binutils.texi: Update description of
	--set-section-alignment.
	* testsuite/binutils-all/set-section-alignment.d: New test.
	* testsuite/binutils-all/objcopy.exp: Run the new test.
2019-10-02 11:55:02 +01:00
GDB Administrator c292080e11 Automatic date update in version.in 2019-10-02 00:00:22 +00:00
Tom Tromey d770d56f42 Use styled_string for "show logging filename"
This changes "show logging filename" to style its output.

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

	* cli/cli-logging.c (show_logging_filename): Use styled_string.

gdb/testsuite/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Test "show logging filename".
2019-10-01 15:12:41 -06:00
Tom Tromey 9d636d67e0 Use styled_string in more places
This adds more uses of styled_string, changing gdb to style some
output that was previously left unstyled.

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

	* stack.c (print_frame, info_frame_command_core): Use
	styled_string.
	* linux-thread-db.c (try_thread_db_load_1)
	(try_thread_db_load_from_pdir_1): Use styled_string.
	* auto-load.c (file_is_auto_load_safe, execute_script_contents)
	(auto_load_section_scripts, info_auto_load_local_gdbinit)
	(maybe_print_unsupported_script_warning)
	(maybe_print_script_not_found_warning): Use styled_string.
	* ada-lang.c (user_select_syms): Use styled_string.
2019-10-01 15:12:40 -06:00
Tom Tromey 7f6aba03b9 Introduce metadata style
This introduces a new "metadata" style and changes many places in gdb
to use it.  The idea here is to let the user distinguish gdb output
from output that (conceptually at least) comes directly from the
inferior.  The newly-styled category includes text that gdb
traditionally surrounds in "<...>", like "<unavailable>".

I only added a single test for this.  In many cases this output is
difficult to test.  Also, while developing this errors in the
implementation of the new printf formats showed up as regressions.

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

	* p-lang.c (pascal_printstr): Use metadata style.
	* value.c (show_convenience): Use metadata style.
	* valprint.c (valprint_check_validity, val_print_optimized_out)
	(val_print_not_saved, val_print_unavailable)
	(val_print_invalid_address, generic_val_print, val_print)
	(value_check_printable, val_print_array_elements): Use metadata
	style.
	* ui-out.h (class ui_out) <field_fmt>: New overload.
	<do_field_fmt>: Add style parameter.
	* ui-out.c (ui_out::field_fmt): New overload.
	* typeprint.c (type_print_unknown_return_type)
	(val_print_not_allocated, val_print_not_associated): Use metadata
	style.
	* tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style
	parameter.
	* tui/tui-out.c (tui_ui_out::do_field_fmt): Update.
	* tracepoint.c (tvariables_info_1): Use metadata style.
	* stack.c (print_frame_arg, print_frame_info, print_frame)
	(info_frame_command_core): Use metadata style.
	* skip.c (info_skip_command): Use metadata style.
	* rust-lang.c (rust_print_enum): Use metadata style.
	* python/py-prettyprint.c (print_stack_unless_memory_error): Use
	metadata style.
	* python/py-framefilter.c (py_print_single_arg): Use metadata
	style.
	* printcmd.c (do_one_display, print_variable_and_value): Use
	metadata style.
	* p-valprint.c (pascal_val_print)
	(pascal_object_print_value_fields): Use metadata style.
	* p-typeprint.c (pascal_type_print_base): Use metadata style.
	* mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style
	parameter.
	* mi/mi-out.c (mi_ui_out::do_field_fmt): Update.
	* m2-valprint.c (m2_print_long_set): Use metadata style.
	* m2-typeprint.c (m2_print_type): Use metadata style.
	* infcmd.c (print_return_value_1): Use metadata style.
	* gnu-v3-abi.c (print_one_vtable): Use metadata style.
	* f-valprint.c (info_common_command_for_block): Use metadata
	style.
	* f-typeprint.c (f_type_print_base): Use metadata style.
	* expprint.c (print_subexp_standard): Use metadata style.
	* cp-valprint.c (cp_print_value_fields): Use metadata style.
	* cli/cli-style.h (class cli_style_option): Add constructor.
	(metadata_style): Declare.
	* cli/cli-style.c (metadata_style): New global.
	(_initialize_cli_style): Register metadata style.
	* cli-out.h (class cli_ui_out) <do_field_fmt>: Add style
	parameter.
	* cli-out.c (cli_ui_out::do_field_fmt): Update.
	* c-typeprint.c (c_type_print_base_struct_union)
	(c_type_print_base_1): Use metadata style.
	* breakpoint.c (watchpoint_value_print)
	(print_one_breakpoint_location): Use metadata style.
	* break-catch-syscall.c (print_one_catch_syscall): Use metadata
	style.
	* break-catch-sig.c (signal_catchpoint_print_one): Use metadata
	style.
	* ada-valprint.c (val_print_packed_array_elements, printstr)
	(print_field_values, ada_val_print_ref, ada_val_print): Use
	metadata style.
	* ada-typeprint.c (print_array_type, ada_print_type): Use metadata
	style.
	* ada-tasks.c (print_ada_task_info, info_task): Use metadata
	style.
	* ada-lang.c (user_select_syms): Use metadata style.

gdb/testsuite/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* lib/gdb-utils.exp (style): Handle "metadata" argument.
	* gdb.base/style.exp: Add metadata style test.
2019-10-01 15:12:40 -06:00
Tom Tromey 14309bb6bf Style "pwd" output
This changes the "pwd" command to style its output.

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

	* cli/cli-cmds.c (pwd_command): Style output.

gdb/testsuite/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Test "pwd".
2019-10-01 15:12:39 -06:00
Pedro Alves 6a831f06e1 Use new %p format suffixes in gdb
This changes various spots in gdb to use the new %p format suffixes.

gdb/ChangeLog
2019-10-01  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* symtab.c (print_symbol_info): Use %ps.
	(print_msymbol_info): Use %ps.
	* symfile.c (symbol_file_add_with_addrs): Use %ps.
	* printcmd.c (print_variable_and_value): Use %ps.
	* macrocmd.c (show_pp_source_pos): Use %ps.
	* infrun.c (print_exited_reason): Use ui_out::message.
	* breakpoint.c (watchpoint_check, print_one_breakpoint_location)
	(describe_other_breakpoints): Use ui_out::message and new
	formats.
	(say_where): Use new formats.
	(bkpt_print_it, tracepoint_print_one_detail): Use ui_out::message
	and new formats.
2019-10-01 15:12:38 -06:00
Pedro Alves 2a3c1174c3 Introduce gdb-specific %p format suffixes
This introduces a few gdb-specific %p format suffixes.  This is useful
for emitting gdb-specific output in an ergonomic way.  It also yields
code that is more i18n-friendly.

The comment before ui_out::message explains the details.

Note that the tests had to change a little.  When using one of the gdb
printf functions with styling, there can be spurious style changes
emitted to the output.  This did not seem worthwhile to fix, as the
low-level output functions are rather spaghetti-ish already, and I
didn't want to make them even worse.

This change also necessitated adding support for "*" as precision and
width in format_pieces.  These are used in various spots in gdb, and
it seemed better to me to implement them than to remove the uses.

gdb/ChangeLog
2019-10-01  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* unittests/format_pieces-selftests.c: Add gdb_format parameter.
	(test_gdb_formats): New function.
	(run_tests): Call it.
	(test_format_specifier): Update.
	* utils.h (fputs_filtered): Update comment.
	(vfprintf_styled, vfprintf_styled_no_gdbfmt)
	(fputs_styled_unfiltered): Declare.
	* utils.c (fputs_styled_unfiltered): New function.
	(vfprintf_maybe_filtered): Add gdbfmt parameter.
	(vfprintf_filtered): Update.
	(vfprintf_unfiltered, vprintf_filtered): Update.
	(vfprintf_styled, vfprintf_styled_no_gdbfmt): New functions.
	* ui-out.h (enum ui_out_flag) <unfiltered_output,
	disallow_ui_out_field>: New constants.
	(enum class field_kind): New.
	(struct base_field_s, struct signed_field_s): New.
	(signed_field): New function.
	(struct string_field_s): New.
	(string_field): New function.
	(struct styled_string_s): New.
	(styled_string): New function.
	(class ui_out) <message>: Add comment.
	<vmessage, call_do_message>: New methods.
	<do_message>: Add style parameter.
	* ui-out.c (ui_out::call_do_message, ui_out::vmessage): New
	methods.
	(ui_out::message): Rewrite.
	* mi/mi-out.h (class mi_ui_out) <do_message>: Add style
	parameter.
	* mi/mi-out.c (mi_ui_out::do_message): Add style parameter.
	* gdbsupport/format.h (class format_pieces) <format_pieces>: Add
	gdb_extensions parameter.
	(class format_piece): Add parameter to constructor.
	(n_int_args): New field.
	* gdbsupport/format.c (format_pieces::format_pieces): Add
	gdb_extensions parameter.  Handle '*'.
	* cli-out.h (class cli_ui_out) <do_message>: Add style parameter.
	* cli-out.c (cli_ui_out::do_message): Add style parameter.  Call
	vfprintf_styled_no_gdbfmt.
	(cli_ui_out::do_field_string, cli_ui_out::do_spaces)
	(cli_ui_out::do_text, cli_ui_out::field_separator): Allow
	unfiltered output.
	* ui-style.h (struct ui_file_style) <ptr>: New method.

gdb/testsuite/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Update tests.
2019-10-01 15:12:38 -06:00
Tom Tromey 0dfe5bfbb7 Don't create empty literal pieces
I noticed that format_pieces can create an empty literal piece.
However, there's never a need for one, so this patch removes the
possibility.

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

	* unittests/format_pieces-selftests.c: Update.  Add final format.
	* gdbsupport/format.c (format_pieces::format_pieces): Don't add
	empty literal pieces.
2019-10-01 15:12:37 -06:00
Tom Tromey e43b10e10e Remove the ui_out_style_kind enum
This removes the ui_out_style_kind enum, in favor of simply using
ui_file_style references.  This simplifies the code somewhat.

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

	* ui-out.h (enum class ui_out_style_kind): Remove.
	(class ui_out) <field_string, field_stsream, do_field_string>:
	Change type of "style".
	* ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
	(ui_out::field_string): Update.
	* tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
	of "style".
	* tui/tui-out.c (tui_ui_out::do_field_string): Update.
	* tracepoint.c (print_one_static_tracepoint_marker): Update.
	* stack.c (print_frame_arg, print_frame_info, print_frame):
	Update.
	* source.c (print_source_lines_base): Update.
	* solib.c (info_sharedlibrary_command): Update.
	* skip.c (info_skip_command): Update.
	* record-btrace.c (btrace_call_history_src_line)
	(btrace_call_history): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
	"style".
	* mi/mi-out.c (mi_ui_out::do_table_header)
	(mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
	(mi_ui_out::do_field_string): Update.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Update.
	* cli-out.h (class cli_ui_out) <do_field_string>: Change type of
	"style".
	* cli-out.c (cli_ui_out::do_table_header)
	(cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
	(cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
	(cli_ui_out::do_field_fmt): Update.
	* breakpoint.c (print_breakpoint_location): Update.
	(update_static_tracepoint): Update.
2019-10-01 15:12:37 -06:00
Andreas Arnez 53d666ecfb gdb/testsuite: Fix pretty-print.exp on big-endian platforms
The pretty-print test case fails on s390/s390x because it relies on a
little-endian representation of bit fields.  Little-endian architectures
typically allocate bit fields from least to most significant bit, but
big-endian architectures typically use the reverse order, allocating the
most significant bit first.  Thus the two bit fields in each of the test
case's unions overlap either in their lower or in their higher bits,
depending on the target's endianness:

    union {
      int three : 3;
      int four : 4;
    };

Now, when initializing 'three' with 3, 'four' will become 3 on little
endian targets, but 6 on big-endian targets, making it FAIL there.

Fix this by initializing the longer bit field instead and using an
all-ones bit pattern.  In this way the result does not depend on
endianness.  Use 'unsigned' instead of int for one of the bit fields in
each of the unions, to increase the variety of resulting values.

gdb/testsuite/ChangeLog:

	* gdb.base/pretty-print.c (struct s1_t): Change fields 'three' and
	'six' to unsigned.
	(s1): Initialize fields 'four' and 'six' instead of 'three' and
	'five'.  Use an all-ones bit pattern for each.
	* gdb.base/pretty-print.exp: Adjust expected output of "print s1"
	to its changed values.
2019-10-01 19:20:29 +02:00
Philippe Waroquiers cd7c32c36a Fix leak due to assigning a xstrdup-ed string to the std::string gdb_datadir
Valgrind reports the following leak:
==32623== 56 bytes in 1 blocks are definitely lost in loss record 1,099 of 6,654
==32623==    at 0x4835753: malloc (vg_replace_malloc.c:307)
==32623==    by 0x25CF67: xmalloc (alloc.c:60)
==32623==    by 0x65FBD9: xstrdup (xstrdup.c:34)
==32623==    by 0x413D9E: captured_main_1(captured_main_args*) (main.c:553)
==32623==    by 0x414FFA: captured_main (main.c:1172)
==32623==    by 0x414FFA: gdb_main(captured_main_args*) (main.c:1197)
==32623==    by 0x22531A: main (gdb.c:32)

Commit f2aec7f6d1 changed gdb_datadir to std::string.
So, xstrdup-ing the result of relocate_gdb_directory (returning a std::string)
is not needed and creates a leak.

Fix the leak by removing the xstrdup and the not needed c_str ().
Also removes a useless conversion of gdb_datadir to std::string.

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

	* main.c (relocate_gdbinit_path_maybe_in_datadir): Remove std::string
	conversion of gdb_datadir.
	(captured_main_1): Remove xstrdup when assigning to gdb_datadir,
	remove not needed c_str ().
2019-10-01 08:56:54 +02:00
Ali Tamur 8fe0f950f4 [PATCH v2 2/4] DWARF 5 support: Handle DW_FORM_strx
* Handle DW_FORM_strx forms everywhere.

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 (skip_one_die): Handle DW_FORM_strx forms.
        (dwarf2_string_attr): Likewise.
2019-09-30 18:00:41 -07:00
GDB Administrator af79fcc547 Automatic date update in version.in 2019-10-01 00:00:41 +00:00
Ali Tamur 5f48f8f3c3 Remove extra whitespaces at the end of lines.
gdb/ChangeLog:

	* dwarf2read.c (process_full_comp_unit): Remove whitespace at the EOL.
	(process_full_type_unit): Likewise.
	(dump_die_shallow): Likewise.
	(cu_debug_loc_section): Likewise.
2019-09-30 14:00:52 -07:00
Christian Biesinger 6fb08628e0 Use std::sort instead of qsort in minsyms.c
This has better typesafety and is also marginally faster (either
due to inlining or because it avoids indirection through a
function pointer).

Note that in this change:
-       return 1;               /* fn1 has no name, so it is "less".  */
+       return true;            /* fn1 has no name, so it is "less".  */
       else if (name1)          /* fn2 has no name, so it is "less".  */
-       return -1;
+       return false;
I am fairly sure the old code was wrong (ie. code didn't match the
comment and the comment seemed correct), so I fixed it.

gdb/ChangeLog:

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

	* minsyms.c (compare_minimal_symbols): Rename to...
	(minimal_symbol_is_less_than): ...this, and adjust to STL
	conventions (return bool, take arguments as references)
	(minimal_symbol_reader::install): Call std::sort instead
	of qsort.
2019-09-30 13:32:32 -05:00
Tom Tromey 4a56a52007 Disable all warnings in gdb.rust/traits.rs
With rustc 1.37, I started seeing compiler warnings from the traits.rs
test case:

    warning: trait objects without an explicit `dyn` are deprecated

It seems to me that we generally do not want warnings in these test
cases.  At some point, we'll probably have to patch traits.rs to use
the "dyn" keyword; by that time I expect that all the Rust compilers
in common use will support it.  In the meantime it seemed simplest to
simply disable all warnings in this file.

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

	* gdb.rust/traits.rs: Disable all warnings.
2019-09-30 10:34:36 -06:00
Christian Biesinger c7ee338a2d Improve some comments about msymbol handling
This just clarifies some comments about the hashtables involved
in msymbols.

gdb/ChangeLog:

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

	* minsyms.h (msymbol_hash): Document that this is a case-insensitive
	hash and why.
	* objfiles.h (struct objfile_per_bfd_storage) <demangled_names_hash,
	msymbol_hash, msymbol_demangled_hash>: Improve comments.
2019-09-30 11:21:46 -05:00
Simon Marchi 703a86c2fa gdb: re-write add_psymbol_to_list doc, move it to header file
The comment above the add_psymbol_to_list function seems outdated and
misleading, here's an attempt at improving it.

gdb/ChangeLog:

	* psymtab.c (add_psymbol_to_list): Move comment to psympriv.h.
	* psympriv.h (add_psymbol_to_list): Move comment here and update
	it.
2019-09-30 11:49:57 -04:00
Alan Modra 663f67df1e PR25046, readelf "Reading xxx bytes extends past end of file for dynamic section"
PR 25046
	* readelf.c (process_program_headers): Clear dynamic_addr and
	dynamic_size earlier.
2019-09-30 14:18:14 +09:30
GDB Administrator 0925bc8441 Automatic date update in version.in 2019-09-30 00:00:33 +00:00
Tom de Vries 0df0352ad0 [gdb/contrib] cc-with-tweaks.sh: Create .dwz file in .tmp subdir
When running a test-case gdb.base/foo.exp with cc-with-dwz-m, a file
build/gdb/testsuite/outputs/gdb.base/foo/foo.dwz will be created, alongside
executable build/gdb/testsuite/outputs/gdb.base/foo/foo.

This can cause problems in f.i. test-cases that test file name completion.

Make these problems less likely by moving foo.dwz to a .tmp subdir:
build/gdb/testsuite/outputs/gdb.base/foo/.tmp/foo.dwz.

Tested on x86_64-linux.

gdb/ChangeLog:

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

	* contrib/cc-with-tweaks.sh (get_tmpdir): New function.
	Use $tmpdir/$(basename "$output_file").dwz instead of
	"${output_file}.dwz".

gdb/testsuite/ChangeLog:

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

        * gdb.dwarf2/gdb-index.exp: Handle new location of .dwz file.
2019-09-29 23:58:21 +02:00
Tom de Vries 73d9a918c6 [gdb/testsuite] Make pass message unique in gdb-index.exp for cc-with-dwz-m
With cc-with-dwz-m, we get:
...
PASS: gdb.dwarf2/gdb-index.exp: objcopy
PASS: gdb.dwarf2/gdb-index.exp: objcopy
...

Make the pass message unique by using with_test_prefix:
...
PASS: gdb.dwarf2/gdb-index.exp: objcopy
PASS: gdb.dwarf2/gdb-index.exp: modify dwz file: objcopy
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.dwarf2/gdb-index.exp: Use with_test_prefix for second objcopy.
2019-09-29 23:51:50 +02:00
GDB Administrator 612aac65e6 Automatic date update in version.in 2019-09-29 00:00:40 +00:00
Simon Marchi ad75efa628 gdb: include gdbarch.h in hppa-linux-nat.c
hppa-linux-nat.c fails to build due to the gdbarch stuff not being
declared, for example:

    hppa-linux-nat.c: In function ‘void fetch_register(regcache*, int)’:
    hppa-linux-nat.c:230:7: error: ‘gdbarch_cannot_fetch_register’ was not declared in this scope
       if (gdbarch_cannot_fetch_register (gdbarch, regno))

Include gdbarch.h to fix it.

gdb/ChangeLog:

	PR gdb/25045
	* hppa-linux-nat.c: Include gdbarch.h.
2019-09-28 14:48:22 -04:00
Alan Modra ea8e302e12 PR16794, gold ignores R_386_GOTOFF addend
An R_386_GOTOFF relocation has an addend, typically used when a
symbol can be replaced by its section symbol plus an offset.
psymval->value(object,0) is quite wrong then, fix it.

	PR 16794
	* i386.cc (Target_i386::Relocate::relocate <R_386_GOTOFF>): Don't
	ignore addend, apply using pcrel32.
	* x86_64.cc (Target_x86_64::Relocate::relocate <R_X86_64_GOTOFF64>):
	Similarly use pcrel64.
2019-09-28 16:47:52 +09:30