Commit Graph

103528 Commits

Author SHA1 Message Date
Nick Clifton
b71702f1c0 GAS: Update the .section directive so that a numeric section index can be provided when the "o" flag is used.
PR 26253
gas	* config/obj-elf.c (obj_elf_section): Accept a numeric value for
	the "o" section flag.  Interpret it as a section index.  Allow an
	index of zero.
	* doc/as.texi: Document the new behaviour.
	* NEWS: Mention the new feature.  Tidy entries.
	* testsuite/gas/elf/sh-link-zero.s: New test.
	* testsuite/gas/elf/sh-link-zero.d: New test driver.
	* testsuite/gas/elf/elf.exp: Run the new test.
	* testsuite/gas/elf/section21.l: Updated expected assembler
	output.

bfd	* elf.c (_bfd_elf_setup_sections): Do not complain about an
	sh_link value of zero when the SLF_LINK_ORDER flag is set.
	(assign_section_numbers): Likewise.
2020-10-05 10:40:07 +01:00
GDB Administrator
1ba0655539 Automatic date update in version.in 2020-10-05 00:00:07 +00:00
Simon Marchi
8d378f27ba gdb: add doc for "set/show debug event-loop"
I forgot that "set/show debug" commands are listed in the doc and in
NEWS, so here they are.

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Add set/show debug event-loop.

gdb/ChangeLog:

	* NEWS: Mention set/show debug event-loop.

Change-Id: If30b80177049006578280a06912ee2b97bd03a75
2020-10-04 12:41:56 -04:00
Simon Marchi
7b085b1c1c gdb/doc: space out list entries, fix one type
I want to add an item to this list, but it's so packed I have trouble
finding where one item ends and the next starts.  Add a few empty lines
to make it a bit more readable.

Doing this, I also noticed that an "aix-thread" should in fact be
"aix-solib".

gdb/doc/ChangeLog:

	* gdb.texinfo (Debugging Output): Add empty lines, fix typo.

Change-Id: I7ef211f9e3988cfbc6ec94124d23a5f2412f3c82
2020-10-04 12:36:02 -04:00
GDB Administrator
37df08e2fe Automatic date update in version.in 2020-10-04 00:00:07 +00:00
H.J. Lu
b3a3496f83 x86: Update register operand check for AddrPrefixOpReg
When the address size prefix applies to both the memory and the register
operand, we need to extract the address size prefix from the register
operand if the memory operand has no real registers, like symbol, DISP
or symbol(%rip).

NB: GCC always generates symbol(%rip) for RIP-relative addressing for
both x32 and x86-64.

Move the .code16 tests in movdir.s to movdir-16bit to show the correct
output from objdump.

	PR gas/26685
	* config/tc-i386.c (process_suffix): Also check the register
	operand for the address size prefix if the memory operand has
	no real registers.
	* testsuite/gas/i386/enqcmd-16bit.d: New file.
	* testsuite/gas/i386/enqcmd-16bit.s: Likewise.
	* testsuite/gas/i386/movdir-16bit.d: Likewise.
	* testsuite/gas/i386/movdir-16bit.s: Likewise.
	* testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP.
	* testsuite/gas/i386/x86-64-enqcmd.s: Likewise.
	* testsuite/gas/i386/x86-64-movdir.s: Likewise.
	* testsuite/gas/i386/movdir.s: Add tests with symbol and DISP.
	Remove the .code16 test.
	* testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
	* testsuite/gas/i386/enqcmd-intel.d: Likewise.
	* testsuite/gas/i386/enqcmd.d: Likewise.
	* testsuite/gas/i386/movdir-intel.d: Likewise.
	* testsuite/gas/i386/movdir.d: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
2020-10-03 04:24:05 -07:00
GDB Administrator
1fa1262d5a Automatic date update in version.in 2020-10-03 00:00:06 +00:00
Tom Tromey
d551991310 Unconditionally use REG_EXTENDED
skip.c checks whether REG_EXTENDED is defined -- but this should
always be available, and is used unconditionally in other parts of
gdb.  This patch removes this check, then further simplifies this
code, removing a declaration and a repeated assertion.

2020-10-02  Tom Tromey  <tromey@adacore.com>

	* skip.c (skiplist_entry::skiplist_entry): Unconditionally use
	REG_EXTENDED.
2020-10-02 14:08:28 -06:00
Przemyslaw Wirkus
42c36b7366 arm: add support for Cortex-A78 and Cortex-A78AE
bfd/ChangeLog:

2020-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* cpu-arm.c: Add cortex-a78 and cortex-a78ae.

gas/ChangeLog:

2020-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-arm.c: Add cortex-a78 and cortex-a78ae cores.
	* doc/c-arm.texi: Update docs.
	* NEWS: Update news.
	* testsuite/gas/arm/cpu-cortex-a78.d: New test.
	* testsuite/gas/arm/cpu-cortex-a78ae.d: New test.
2020-10-02 20:44:37 +01:00
Simon Marchi
18b67edc2c gdb: fix some inferior_created observer signatures
I just noticed that in a7aba2668a ("gdb: remove arguments from
inferior_created observable"), I forgot to update
aix_thread_inferior_created and procfs_inferior_created, which are in
files I can't compile.

Remove the parameters from aix_thread_inferior_created.  And simply
remove procfs_inferior_created, since it's empty anyway.

gdb/ChangeLog:

	* aix-thread.c (aix_thread_inferior_created): Remove parameters.
	* procfs.c (procfs_inferior_created): Remove.
	(_initialize_procfs): Don't register procfs_inferior_created.

Change-Id: Ifc7def7c096332033b5d466d32cb873d1df18c2c
2020-10-02 15:22:32 -04:00
Simon Marchi
6b01403b25 gdb: add debug prints in event loop
Add debug printouts about event loop-related events:

 - When a file descriptor handler gets invoked
 - When an async event/signal handler gets invoked

gdb/ChangeLog:

	* async-event.c (invoke_async_signal_handlers): Add debug
	print.
	(check_async_event_handlers): Likewise.
	* event-top.c (show_debug_event_loop): New function.
	(_initialize_event_top): Register "set debug event-loop"
	setting.

gdbserver/ChangeLog:

	* server.cc (handle_monitor_command): Handle "set
	debug-event-loop".
	(captured_main): Handle "--debug-event-loop".
	(monitor_show_help): Mention new setting.
	(gdbserver_usage): Mention new flag.

gdbsupport/ChangeLog:

	* event-loop.h (debug_event_loop): New variable declaration.
	(event_loop_debug_printf_1): New function declaration.
	(event_loop_debug_printf): New macro.
	* event-loop.cc (debug_event_loop): New variable.
	(handle_file_event): Add debug print.
	(event_loop_debug_printf_1): New function.

Change-Id: If78ed3a69179881368e7895b42940ce13b6a1a05
2020-10-02 14:47:42 -04:00
Simon Marchi
ba98841943 gdb: move debug_prefixed_vprintf here
The following patch needs to output debug prints from gdbsupport code.
Move debug_prefixed_vprintf so that it is possible to use it from
gdbsupport.

gdb/ChangeLog:

	* debug.c (debug_prefixed_vprintf): Move to gdbsupport.
	* debug.h: Remove.
	* infrun.c: Include gdbsupport/common-debug.h.
	* linux-nat.c: Likewise.

gdbsupport/ChangeLog:

	* common-debug.cc (debug_prefixed_vprintf): Move here.
	* common-debug.h (debug_prefixed_vprintf): Move here.

Change-Id: I5170065fc10a7a49c0f1bba67c691decb2cf3bcb
2020-10-02 14:47:26 -04:00
Simon Marchi
db20ebdfae gdb: give names to async event/signal handlers
Assign names to async event/signal handlers.  They will be used in debug
messages when file handlers are invoked.

Unlike in the previous patch, the names are not copied in the structure,
since we don't need to (all names are string literals for the moment).

gdb/ChangeLog:

	* async-event.h (create_async_signal_handler): Add name
	parameter.
	(create_async_event_handler): Likewise.
	* async-event.c (struct async_signal_handler) <name>: New field.
	(struct async_event_handler) <name>: New field.
	(create_async_signal_handler): Assign name.
	(create_async_event_handler): Assign name.
	* event-top.c (async_init_signals): Pass name when creating
	handler.
	* infrun.c (_initialize_infrun): Likewise.
	* record-btrace.c (record_btrace_push_target): Likewise.
	* record-full.c (record_full_open): Likewise.
	* remote-notif.c (remote_notif_state_allocate): Likewise.
	* remote.c (remote_target::open_1): Likewise.
	* tui/tui-win.c (tui_initialize_win): Likewise.

Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5
2020-10-02 14:47:06 -04:00
Simon Marchi
2554f6f564 gdb: give names to event loop file handlers
Assign names to event loop file handlers.  They will be used in debug
messages when file handlers are invoked.

In GDB, each UI used to get its own unique number, until commit
cbe256847e ("Remove ui::num").  Re-introduce this field, and use it to
make a unique name for the handler.

I'm not too sure what goes on in ser-base.c, all I know is that it's
what is used when debugging remotely.  I've just named the main handler
"serial".  It would be good to have unique names there too.  For instance
when debugging with two different remote connections, we'd ideally want
the handlers to have unique names.  I didn't do it in this patch though.

gdb/ChangeLog:

	* async-event.c (initialize_async_signal_handlers): Pass name to
	add_file_handler
	* event-top.c (ui_register_input_event_handler): Likewise.
	* linux-nat.c (linux_nat_target::async): Likewise.
	* run-on-main-thread.c (_initialize_run_on_main_thread):
	Likewise
	* ser-base.c (reschedule): Likewise.
	(ser_base_async): Likewise.
	* tui/tui-io.c: Likewise.
	* top.h (struct ui) <num>: New field.
	* top.c (highest_ui_num): New variable.
	(ui::ui): Initialize num.

gdbserver/ChangeLog:

	* linux-low.cc (linux_process_target::async): Pass name to
	add_file_handler.
	* remote-utils.cc (handle_accept_event): Likewise.
	(remote_open): Likewise.

gdbsupport/ChangeLog:

	* event-loop.h (add_file_handler): Add "name" parameter.
	* event-loop.cc (struct file_handler) <name>: New field.
	(create_file_handler): Add "name" parameter, assign it to file
	handler.
	(add_file_handler): Add "name" parameter.

Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c
2020-10-02 14:46:56 -04:00
Simon Marchi
a7aba2668a gdb: remove arguments from inferior_created observable
I noticed that non of the listeners of the inferior_created observable
used either of the arguments.  Remove them.  This in turn allows
removing the target parameter of post_create_inferior.

Tested only by rebuilding.

gdb/ChangeLog:

	* observable.h <inferior_created>: Remove parameters.  Update all
	listeners.
	* inferior.h (post_create_inferior): Remove target parameter.
	Update all callers.

Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6
2020-10-02 10:46:38 -04:00
Gary Benson
3ee6f75d05 Fix spelling mistake in gdb/testsuite/README.
This commit corrects the spelling mistake detailed below.

gdb/testsuite/ChangeLog:

	* README: Fix "paralell".
2020-10-02 12:16:55 +01:00
Nick Clifton
7bd766ccd8 Fix the mve-vcvtne-it assembler test for the arm-*-pe targets.
* testsuite/gas/arm/mve-vcvtne-it.d: Allow for padding inserted by
	PE based targets.
2020-10-02 11:14:57 +01:00
H.J. Lu
7026832e52 Allow note sections to be discarded when they are linked to another discarded secction.
PR 26681
bfd	* elflink.c (bfd_elf_gc_sections): Do not arbitrarily keep note
	sections which are linked to another section.

ld	* testsuite/ld-elf/pr26681.s: New test.
	* testsuite/ld-elf/pr26681.d: New test driver.
	* testsuite/ld-elf/pr26681.l: New test output.
2020-10-02 11:08:19 +01:00
nitachra
048fde1ef4 DWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries.
GDB complaints "During symbol reading: unrecognized DW_MACFINO
opcode 0xb" with the testcase given below. Clang is emitting
DW_MACRO_define_strx and DW_MACRO_undef_strx entries in .debug_macro
section which are not supported in GDB. This patch handles them.

DW_MACRO_define_strx and DW_MACRO_undef_strx are added in DWARFv5.
They have two operands. The first operand encodes the line number of
the #define or #undef macro directive. The second operand identifies
a string; it is represented using an unsigned LEB128 encoded value,
which is interpreted as a zero-based index into an array of offsets
in the .debug_str_offsets section. This is as per the section 6.3.2.1
of Dwarf Debugging Information Format Version 5.

Test case used:
 #define MAX_SIZE 10
int main(void)
{
   int size = 0;
   size = size + MAX_SIZE;

   printf("\n The value of size is [%d]\n",size);

   return 0;
}

clang -gdwarf-5 -fdebug-macro  macro.c -o macro.out

Before the patch:

gdb/new_gdb/binutils-gdb/build/bin/gdb -q macro.out -ex "set complaints 1" -ex "start"
Reading symbols from macro.out...
During symbol reading: unrecognized DW_MACFINO opcode 0xb
Temporary breakpoint 1 at 0x4004df: file macro.c, line 7.
Starting program: /home/nitika/workspace/macro.out

Temporary breakpoint 1, main () at macro.c:7
7          int size = 0;
(gdb)

Tested by running the testsuite before and after the patch with
 -gdwarf-5 and there is no increase in the number of test cases
that fails. Used clang 11.0.0.

gdb/ChangeLog:

	* dwarf2/macro.c (dwarf_decode_macro_bytes): Handle DW_MACRO_define_strx
	and DW_MACRO_undef_strx.
	(dwarf_decode_macros): Likewise
	* dwarf2/read.c (dwarf_decode_macros): Pass str_offsets_base in the parameters
	which is the value of DW_AT_str_offsets_base.
	* dwarf2/macro.h (dwarf_decode_macros): Modify the definition to include
	str_offsets_base.
2020-10-02 12:27:45 +05:30
GDB Administrator
71a74ee72d Automatic date update in version.in 2020-10-02 00:00:10 +00:00
Kamil Rytarowski
064280be25 Fix the i386 build
Remove old, no longer needed and no longer valid extern.

../../gdb/i386-nbsd-tdep.c:58:12: error: 'i386nbsd_sc_reg_offset' was declared 'extern' and later 'static' [-fpermissive]
   58 | static int i386nbsd_sc_reg_offset[] =
      |            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../gdb/i386-nbsd-tdep.c:31:
../../gdb/i386-tdep.h:480:12: note: previous declaration of 'i386nbsd_sc_reg_offset'
  480 | extern int i386nbsd_sc_reg_offset[];
      |            ^~~~~~~~~~~~~~~~~~~~~~

gdb/ChangeLog:

	* i386-tdep.h (i386nbsd_sc_reg_offset): Remove.
2020-10-02 01:04:39 +02:00
Kamil Rytarowski
6ff330351e Remove the old sanity check of sigcontext offsets for NetBSD/i386
NetBSD switched to ucontext, back in 2003 and the sigcontext code
is no longer available for users, except for legacy compat layers.

This code was not available anyway as the pre-processor check
was probably never operational and buildable on NetBSD. The code
inside it does not compile.

Meanwhile, move the offset variable into the ifdef goards and avoid
the error about unused variable.

../../gdb/i386-bsd-nat.c: In function 'void _initialize_i386bsd_nat()':
../../gdb/i386-bsd-nat.c:347:7: error: unused variable 'offset' [-Werror=unused-variable]
  347 |   int offset;
      |       ^~~~~~
cc1plus: all warnings being treated as errors

gdb/ChangeLog:

	* i386-bsd-nat.c (_initialize_i386bsd_nat): Update.
	* i386-nbsd-tdep.c (i386nbsd_sc_reg_offset): Now static.
2020-10-02 00:44:47 +02:00
Kamil Rytarowski
8b667faedf Add NetBSD/i386 gdbserver support
The support is on part with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

	* netbsd-i386-low.cc: Add.
	* Makefile.in (SFILES): Register "netbsd-i386-low.c".
	* configure.srv: Add i[34567]86-*-netbsd*.
2020-10-02 00:41:21 +02:00
Kamil Rytarowski
15397b0e05 Refactor the NetBSD amd64 gdbserver support
Replace the pre-C++ construct of netbsd_target_ops, netbsd_regset_info
and netbsd_tdesc with C++ inheritance approach found in the Linux
gdbserver code. Add netbsd_amd64_target, that inherits from the
netbsd_process_target class and add proper singleton object for
the_netbsd_target, initialized from netbsd_amd64_target.

Call low_arch_setup () on post process creation, which sets machine
specific properties of the traced process.

Remove global singleton the_netbsd_target object from the generic
gdbserver code.

This refactoring introduces no functional change from the end-user
point of view.

gdbserver/ChangeLog:

	* netbsd-amd64-low.cc (netbsd_x86_64_arch_setup): Remove.
	(netbsd_target_regsets): Now const.
	(the_low_target): Remove.
	(class netbsd_amd64_target, the_netbsd_amd64_target)
	(the_netbsd_target): Add.
	* netbsd-low.cc (netbsd_process_target::post_create_inferior): Call
	low_arch_setup ().
	(netbsd_process_target::fetch_registers)
	(netbsd_process_target::store_registers, initialize_low): Update.
	(the_netbsd_target): Remove.
	* netbsd-low.h (netbsd_target_regsets, netbsd_target_ops)
	(the_low_target, netbsd_tdesc): Remove.
	(netbsd_process_target::get_regs_info)
	(netbsd_process_target::low_arch_setup): Add.
2020-10-02 00:39:20 +02:00
Kamil Rytarowski
e2a2a24a8e Preinitialize the sockaddr_un variable to zero
Don't pass random sun_len for the BSD's,
zero the whole structure as recommended for portability.

Reported by Coverity.

gdbsupport/ChangeLog:

	* agent.cc (gdb_connect_sync_socket): Preinitialize addr with zeros.
2020-10-02 00:38:12 +02:00
Kamil Rytarowski
1eb6eb795f Include the x86-bsd-nat.h header and fix the NetBSD/i386 build
In file included from ../../gdb/i386-nbsd-nat.c:26:
../../gdb/i386-bsd-nat.h:34:53: error: expected template-name before '<' token
   34 | class i386_bsd_nat_target : public x86bsd_nat_target<BaseTarget>
      |                                                     ^
../../gdb/i386-bsd-nat.h:34:53: error: expected '{' before '<' token
../../gdb/i386-nbsd-nat.c:74:45: error: aggregate 'i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target' has incomplete type and cannot be defined
   74 | static i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target;
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~

gdb/ChangeLog:

	* i386-bsd-nat.c: Include "x86-bsd-nat.h".
2020-10-02 00:37:38 +02:00
Nick Clifton
642f545a93 Add new directive to GAS: .attach_to_group.
* config/obj-elf (elf_pseudo_table): Add attach_to_group.
        (obj_elf_attach_to_group): New function.
        * doc/as.texi: Document the new directive.
	* NEWS: Mention the new feature.
        * testsuite/gas/elf/attach-1.s: New test.
        * testsuite/gas/elf/attach-1.d: New test driver.
        * testsuite/gas/elf/attach-2.s: New test.
        * testsuite/gas/elf/attach-2.d: New test driver.
        * testsuite/gas/elf/attach-err.s: New test.
        * testsuite/gas/elf/attach-err.d: New test driver.
        * testsuite/gas/elf/attach-err.err: New test error output.
        * testsuite/gas/elf/elf.exp: Run the new tests.
2020-10-01 16:34:05 +01:00
GDB Administrator
1f22ee1f72 Automatic date update in version.in 2020-10-01 00:00:06 +00:00
H.J. Lu
27f134698a x86: Check register operand for AddrPrefixOpReg
If the address prefix changes the register operand, we need to check the
register operand when the memory operand is RIP-relative.

	PR gas/26685
	* config/tc-i386.c (process_suffix): Check the register operand
	for the address size prefix if the memory operand is symbol(%rip).
	* testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative
	addressing.
	* testsuite/gas/i386/x86-64-movdir.s: Likewise.
	* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
	* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-movdir.d: Likewise.
2020-09-30 16:33:52 -07:00
Tom de Vries
95eb9e54a5 [gdb] Fix regression in dwarf2_name
Since commit 2c830f5475 "Change some uses of DW_STRING to string method" we
have these regressions:
...
FAIL: gdb.base/info-types-c++.exp: info types
FAIL: gdb.cp/anon-struct.exp: print type of t::t
FAIL: gdb.cp/anon-struct.exp: print type of X::t2
FAIL: gdb.cp/anon-struct.exp: print type of X::t2::t2
FAIL: gdb.cp/anon-struct.exp: print type of t3::~t3
...

Fix these in dwarf2_name by updating attr_name each time attr is updated.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-09-30  Tom de Vries  <tdevries@suse.de>

	PR symtab/26683
	* dwarf2/read.c (dwarf2_name): Update attr_name after attr is updated.
2020-09-30 21:49:01 +02:00
Tom Tromey
cae21f8ebf Fix regression in variant part handling
My series to change DWARF attribute handling to be type-safe
introduced a regression in gdb.ada/variant.exp.  handle_variant was
using as_unsigned on an attribute with DW_FORM_sdata.  This patch
changes it to use constant_value instead.

2020-09-30  Tom Tromey  <tromey@adacore.com>

	* dwarf2/read.c (handle_variant): Use constant_value.
2020-09-30 09:51:44 -06:00
Przemyslaw Wirkus
77718e5b7d [GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AE
* config/tc-aarch64.c: Add Cortex-A78 and Cortex-A78AE cores.
	* doc/c-aarch64.texi: Update docs.
	* NEWS: Update news.
2020-09-30 14:52:31 +01:00
H.J. Lu
04e433a857 ld: Override the IR definition for non-ELF targets
For non-ELF targets, override the IR definition before all LTO symbols
have been read.

	PR ld/26675
	* plugin.c (plugin_notice): Override the IR definition before
	all LTO symbols have been read for non-ELF targets.
2020-09-30 05:23:35 -07:00
Alex Coplan
c81946efc2 NEWS: Mention recent Arm CPU support
Mentions Armv8-R AArch64, Cortex-R82, Neoverse V1, and Neoverse N2.

gas/ChangeLog:

2020-09-30  Alex Coplan  <alex.coplan@arm.com>

	* NEWS: Mention recent Arm processor support.
2020-09-30 12:15:18 +01:00
Alex Coplan
990e5268d2 aarch64: Add support for Neoverse N2 CPU
This patch adds support for Arm's Neoverse N2 CPU to AArch64 binutils.

gas/ChangeLog:

	* config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2.
	* doc/c-aarch64.texi: Document support for Neoverse N2.
2020-09-30 12:11:56 +01:00
Gary Benson
f65825ec7a Fix gdb.dwarf2/dw2-double-set-die-type.exp with Clang
gdb.dwarf2/dw2-double-set-die-type.exp failed to build with Clang,
because of the following issues:

- One .uleb128 directive was specified with an uppercase U,
  causing Clang to fail with the message:
    error: unknown directive
  This commit converts that directive to all-lowercase.

- The label ".Labbrev1_begin" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit adds the label in the appropriate place.

- The label ".Ldebug_line0" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit removes the reference.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-double-set-die-type.S (.Ldie_3e0):
	Convert directive to lowercase.
	(.Labbrev1_begin): Add missing label.
	(abbrev code 0x1): Remove DW_AT_stmt_list.
	(.Ldie_b): Likewise.
2020-09-30 10:51:58 +01:00
Jeremy Drake
51dee44b37 After preventing creating an import library for an exe when there are no exports, to avoid a crash, it turned out that some projects expected to be able to create an import library for a dll with no exports, so more closely match the condition to the condition around initializing the dll name.
PR 26588
	* emultempl/pe.em (_finish): Generate an import library for DLLs,
	even if they have no exports.
	* emultempl/pep.em (_finish): Likewise.
2020-09-30 10:50:46 +01:00
Alan Modra
e37c930f9e gcc-4.4.7 warning fixes
* config/obj-elf.c (obj_elf_change_section): Rename variable to
	avoid shadowing warning.
	* symbols.c (symbol_entry_find): Init all symbol_flags fields.
2020-09-30 14:31:15 +09:30
Tom Tromey
529908cbd0 Remove DW_UNSND
This removes DW_UNSND, replacing uses with either as_unsigned or
constant_value, depending primarily on whether or not the form is
already known to be appropriate.

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

	* dwarf2/read.c (lookup_dwo_id, get_type_unit_group)
	(read_file_scope, dwarf2_get_pc_bounds)
	(dwarf2_record_block_ranges, dwarf2_add_field, get_alignment)
	(read_structure_type, handle_struct_member_die)
	(read_enumeration_type, read_array_type, read_set_type)
	(read_tag_pointer_type, read_tag_reference_type)
	(read_subroutine_type, read_base_type, read_subrange_type)
	(read_full_die_1, partial_die_info::read)
	(partial_die_info::read, by, new_symbol)
	(dwarf2_const_value_data, dwarf2_const_value_attr)
	(dump_die_shallow, dwarf2_fetch_constant_bytes)
	(prepare_one_comp_unit): Update.
	* dwarf2/attribute.h (DW_UNSND): Remove.
2020-09-29 20:29:07 -06:00
Tom Tromey
c45bc3f8ab Add attribute::as_boolean method
This adds a new attribute::as_boolean method, and updates the reader
to use it.  The main benefit of this change is that now the code will
respect the attribute's form.

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

	* dwarf2/read.c (read_func_scope, prototyped_function_p)
	(read_subroutine_type, partial_die_info::read)
	(dwarf2_flag_true_p, new_symbol, dump_die_shallow)
	(dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <as_boolean>: Declare.
	* dwarf2/attribute.c (attribute::as_boolean): New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
23dca5c3d7 Add attribute::as_virtuality method
This adds a new attribute::as_virtuality method and changes the DWARF
reader to use it.  This also ensures that the attibute's form will now
be respected.

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

	* dwarf2/read.c (dwarf2_add_field, dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <as_virtuality>: New
	method.
	* dwarf2/attribute.c (attribute::as_virtuality): New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
52c14d1128 Change die_info methods to check the attribute's form
This changes two die_info methods to check the form of the attribute
before using it.

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

	* dwarf2/die.h (struct die_info) <addr_base, ranges_base>: Check
	the attribute's form.
2020-09-29 20:29:07 -06:00
Tom Tromey
e8e5c1585d Change is_valid_DW_AT_defaulted to a method on attribute
This changes is_valid_DW_AT_defaulted to be a method on struct attribute.
Now it correctly respects the form of the attribute.

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

	* dwarf2/read.c (is_valid_DW_AT_defaulted): Move to attribute.c.
	(dwarf2_add_member_fn): Update.
	* dwarf2/attribute.h (struct attribute) <defaulted>: Declare.
	* dwarf2/attribute.c (attribute::defaulted): New method, from
	is_valid_DW_AT_defaulted.
2020-09-29 20:29:07 -06:00
Tom Tromey
d4df075e8b Add attribute::as_unsigned method
This introduces a new attribute::as_unsigned method and changes a few
spots to use it.

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

	* dwarf2/read.c (dw2_get_file_names_reader)
	(dwarf2_build_include_psymtabs, handle_DW_AT_stmt_list)
	(dwarf2_cu::setup_type_unit_groups, fill_in_loclist_baton)
	(dwarf2_symbol_mark_computed): Use as_unsigned.
	* dwarf2/attribute.h (struct attribute) <as_unsigned>: New
	method.
	<form_is_section_offset>: Update comment.
2020-09-29 20:29:07 -06:00
Tom Tromey
bf23a26804 Change how accessibility is handled in dwarf2/read.c
dwarf2/read.c uses dwarf2_default_access_attribute to check for the
default access attribute.  This patch simplifies the code by moving
more of the access processing into this function, changing its name to
reflect the difference.  This also ensures that the attribute's form
is respected, by changing to code to use the constant_value method.

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

	* dwarf2/read.c (dwarf2_access_attribute): Rename from
	dwarf2_default_access_attribute.  Look up attribute.
	(dwarf2_add_field, dwarf2_add_type_defn, dwarf2_add_member_fn):
	Update.
2020-09-29 20:29:07 -06:00
Tom Tromey
7a5f294dbd Change how reprocessing is done
Currently gdb keeps a vector of attributes that require reprocessing.
However, now that there is a reprocessing flag in the attribute, we
can remove the vector and instead simply loop over attributes a second
time.  Normally there are not many attributes, so this should be
reasonably cheap.

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

	* dwarf2/read.c (skip_one_die): Update.
	(read_full_die_1): Change how reprocessing is done.
	(partial_die_info::read): Update.
	(read_attribute_value): Remove need_reprocess parameter.
	(read_attribute): Likewise.
	* dwarf2/attribute.h (struct attribute) <requires_reprocessing_p>:
	New method.
2020-09-29 20:29:07 -06:00
Tom Tromey
36d378cf86 Remove DW_ADDR
This removes DW_ADDR in favor of accessor methods.

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

	* dwarf2/read.c (read_attribute_reprocess, read_attribute_value)
	(dwarf2_const_value_attr, dump_die_shallow)
	(dwarf2_fetch_constant_bytes): Update.
	* dwarf2/attribute.h (struct attribute) <form_is_ref>: Update
	comment.
	<set_address>: New method.
	(DW_ADDR): Remove.
	* dwarf2/attribute.c (attribute::form_is_ref): Update comment.
	(attribute::as_string, attribute::as_address): Add assert.
2020-09-29 20:29:07 -06:00
Tom Tromey
fe56917a86 Add reprocessing flag to struct attribute
Some forms require "reprocessing" -- a second pass to update their
value appropriately.  In this case, we'll set the unsigned value on
the attribute, and then later set it to the correct value.

To handle this, we introduce a reprocessing flag to attribute.  Then,
we manage this flag to ensure that setting and unsetting is done
properly.

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

	* dwarf2/read.c (read_cutu_die_from_dwo): Use OBSTACK_ZALLOC.
	(read_attribute_reprocess, read_attribute_value): Update.
	(read_attribute): Clear requires_reprocessing.
	* dwarf2/attribute.h (struct attribute) <as_unsigned_reprocess,
	form_requires_reprocessing>: New methods.
	<string_init>: Clear requires_reprocessing.
	<set_unsigned_reprocess>: New method.
	<name>: Shrink by one bit.
	<requires_reprocessing>: New member.
	* dwarf2/attribute.c (attribute::form_requires_reprocessing): New
	method.
2020-09-29 20:29:06 -06:00
Tom Tromey
414ad644a8 Use setter for attribute's unsigned value
This adds form_is_unsigned and an unsigned setter method to struct
attribute, and updates the remaining code.  Now DW_UNSND is no longer
used as an lvalue.

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

	* dwarf2/read.c (read_attribute_value): Update.
	* dwarf2/attribute.h (struct attribute) <form_is_unsigned,
	set_unsigned>: New methods.
	* dwarf2/attribute.c (attribute::form_is_unsigned): New method.
2020-09-29 20:29:06 -06:00
Tom Tromey
1bc397c561 Remove DW_SND
This removes DW_SND in favor of accessors on struct attribute.
These accessors check that the form is appropriate.

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

	* dwarf2/read.c (get_alignment, read_array_order)
	(read_attribute_value, dwarf2_const_value_attr)
	(dump_die_shallow, dwarf2_fetch_constant_bytes): Update.
	* dwarf2/attribute.h (struct attribute) <as_signed, set_signed>:
	New methods.
	(DW_SND): Remove.
2020-09-29 20:29:06 -06:00