]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Oct 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Oct 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Oct 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: get jiter objfile from a bound minsym
Mihails Strasuns [Wed, 14 Oct 2020 08:44:36 +0000 (10:44 +0200)] 
gdb: get jiter objfile from a bound minsym

This fixes a regression introduced by the following commit:

fe053b9e853 gdb/jit: pass the jiter objfile as an argument to jit_event_handler

In the refactoring `handle_jit_event` function was changed to pass a matching
objfile pointer to the `jit_event_handler` explicitly, rather using internal
storage:

```
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5448,8 +5448,9 @@ handle_jit_event (void)

   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
+  objfile *jiter = symbol_objfile (get_frame_function (frame));

-  jit_event_handler (gdbarch);
+  jit_event_handler (gdbarch, jiter);
```

This was needed to add support for multiple jiters.  However it has also
introduced a regression, because `get_frame_function (frame)` here may
return `nullptr`, resulting in a crash.

A more resilient way would be to use an approach mirroring
`jit_breakpoint_re_set` - to find a minimal symbol matching the
breakpoint location and use its object file.  We know that this
breakpoint event comes from a breakpoint set by `jit_breakpoint_re_set`,
thus using the reverse approach should be reliable enough.

gdb/Changelog:
2020-10-14  Mihails Strasuns  <mihails.strasuns@intel.com>

* breakpoint.c (handle_jit_event): Add an argument, change how
`jit_event_handler` is called.

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Oct 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Oct 2020 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Oct 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Oct 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Oct 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Oct 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: don't pass TARGET_WNOHANG to targets that can't async (PR 26642)
Simon Marchi [Tue, 13 Oct 2020 16:01:19 +0000 (12:01 -0400)] 
gdb: don't pass TARGET_WNOHANG to targets that can't async (PR 26642)

Debugging with "maintenance set target-async off" on Linux has been
broken since 5b6d1e4fa4f ("Multi-target support").

The issue is easy to reproduce:

    $ ./gdb -q --data-directory=data-directory -nx ./test
    Reading symbols from ./test...
    (gdb) maintenance set target-async off
    (gdb) start
    Temporary breakpoint 1 at 0x1151: file test.c, line 5.
    Starting program: /home/simark/build/binutils-gdb/gdb/test

... and it hangs there.

The difference between pre-5b6d1e4fa4f and 5b6d1e4fa4f is that
fetch_inferior_event now calls target_wait with TARGET_WNOHANG for
non-async-capable targets, whereas it didn't before.

For non-async-capable targets, this is how it's expected to work when
resuming execution:

1. we call resume
2. the infrun async handler is marked in prepare_to_wait, to immediately
   wake up the event loop when we get back to it
3. fetch_inferior_event calls the target's wait method without
   TARGET_WNOHANG, effectively blocking until the target has something
   to report

However, since we call the target's wait method with TARGET_WNOHANG,
this happens:

1. we call resume
2. the infrun async handler is marked in prepare_to_wait, to immediately
   wake up the event loop when we get back to it
3. fetch_inferior_event calls the target's wait method with
   TARGET_WNOHANG, the target has nothing to report yet
4. we go back to blocking on the event loop
5. SIGCHLD finally arrives, but the event loop is not woken up, because
   we are not in async mode.  Normally, we should have been stuck in
   waitpid the SIGCHLD would have unblocked us.

We end up in this situation because these two necessary conditions are
met:

1. GDB uses the TARGET_WNOHANG option with a target that can't do async.
   I don't think this makes sense.  I mean, it's technically possible,
   the doc for TARGET_WNOHANG is:

  /* Return immediately if there's no event already queued.  If this
     options is not requested, target_wait blocks waiting for an
     event.  */
  TARGET_WNOHANG = 1,

   ... which isn't in itself necessarily incompatible with synchronous
   targets.  It could be possible for a target to support non-blocking
   polls, while not having a way to asynchronously wake up the event
   loop, which is also necessary to support async.  But as of today,
   we don't expect GDB and sync targets to work this way.

2. The linux-nat target, even in the mode where it emulates a
   synchronous target (with "maintenance set target-async off") respects
   TARGET_WNOHANG.  Other non-async targets, such as windows_nat_target,
   simply don't check / support TARGET_WNOHANG, so their wait method is
   always blocking.

Fix the first issue by avoiding using TARGET_WNOHANG on non-async
targets, in do_target_wait_1.  Add an assert in target_wait to verify it
doesn't happen.

The new test gdb.base/maint-target-async-off.exp is a simple test that
just tries running to main and then to the end of the program, with
"maintenance set target-async off".

gdb/ChangeLog:

PR gdb/26642
* infrun.c (do_target_wait_1): Clear TARGET_WNOHANG if the
target can't do async.
* target.c (target_wait): Assert that we don't pass
TARGET_WNOHANG to a target that can't async.

gdb/testsuite/ChangeLog:

PR gdb/26642
* gdb.base/maint-target-async-off.c: New test.
* gdb.base/maint-target-async-off.exp: New test.

Change-Id: I69ad3a14598863d21338a8c4e78700a58ce7ad86

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Oct 2020 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Oct 2020 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Oct 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Oct 2020 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agognulib: fix stat/fstat build errors on old Windows version or using old MinGW
Joel Brobecker [Fri, 9 Oct 2020 19:50:50 +0000 (12:50 -0700)] 
gnulib: fix stat/fstat build errors on old Windows version or using old MinGW

This commit imports two commits from gnulib's master branch fixing
a build error when building on a version of Windows that's older
than Vista, or when using an mingw's MinGW.

gnulib/ChangeLog:

GDB PR build/26607
* patches/0002-stat-fstat-windows-older-vista: New patch.
* patches/0003-stat-fstat-windows-old-mingw: New patch.
* update-gnulib.sh: Update to use the two new patches above.
* import/m4/fstat.m4: Update after applying patches above.
* import/m4/stat.m4: Ditto.
* import/stat-w32.c: Ditto.
* config.in: Regenerate.
* configure: Regenerate.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Oct 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoUpdate GDB NEWS with ARC support in GDBserver
Shahab Vahedi [Wed, 7 Oct 2020 15:13:33 +0000 (17:13 +0200)] 
Update GDB NEWS with ARC support in GDBserver

gdb/ChangeLog:

* NEWS: Mention ARC support in GDBserver.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 8 Oct 2020 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoarc: Add support for Linux coredump files
Anton Kolesov [Mon, 30 Jan 2017 15:32:10 +0000 (18:32 +0300)] 
arc: Add support for Linux coredump files

With the implemenations in this patch, ARC gdb can handle
coredump related matters.  The binutils counter part of
this patch has already been pushed [1].

v2 [2]:
- arc_linux_collect_gregset: Use "reg <= ARC_LAST_REGNUM" instead of
  "reg < ARC_LAST_REGNUM" for the condition check of the for-loop.
- arc-linux-tdep.c: Use "ARC_LAST_REGNUM < ARRAY_SIZE (...)" instead of
  "ARC_LAST_REGNUM <= ARRAY_SIZE (...)" for the "asserts".
- Use "buf + arc_linux_core_reg_offsets[ARC_ERET_REGNUM]" instead of
  "buf + REG_OFF (6)".
- Fix a few typos/indentation.

v3 [3]:
- Use gdb_assert_not_reached(text) instead of gdb_assert (!text).
- Remove unnecessary braces in the for loop.

[1] arc: Add support for ARC HS extra registers in core files
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=2745674244d6aecddcf636475034bdb9c0a6b4a0

[2] First remarks
https://sourceware.org/pipermail/gdb-patches/2020-September/171912.html

[3] Second remarks
https://sourceware.org/pipermail/gdb-patches/2020-October/172302.html

gdb/ChangeLog:

* arc-linux-tdep.h: New file.
* arc-linux-tdep.c (arc_linux_core_reg_offsets,
arc_linux_supply_gregset, arc_linux_supply_v2_regset,
arc_linux_collect_gregset, arc_linux_collect_v2_regset,
arc_linux_gregset, arc_linux_v2_regset,
arc_linux_iterate_over_regset_sections,
arc_linux_core_read_description): Implement.
(arc_linux_init_osabi): Set iterate_over_regset_sections.
* arc-tdep.h (ARC_OFFSET_NO_REGISTER): Declare.
        (arc_gdbarch_features_create): Add.
* arc-tdep.c (arc_gdbarch_features_create): Not static anymore.

3 years agogdb/gdbserver: Add the missing ChangeLog entries
Shahab Vahedi [Wed, 7 Oct 2020 16:16:19 +0000 (18:16 +0200)] 
gdb/gdbserver: Add the missing ChangeLog entries

I forgot to add the ChangeLog entries for these 2 patches:

b13599da1ae gdbserver: Add GNU/Linux support for ARC
e26d3e9b761 arc: Rename "arc_gdbarch_features" struct

3 years agogdbserver: Add GNU/Linux support for ARC
Anton Kolesov [Wed, 6 Jul 2016 17:30:29 +0000 (20:30 +0300)] 
gdbserver: Add GNU/Linux support for ARC

This gdbserver implementation supports ARC ABI v3 and v4 (older ARC ABI
versions are not supported by other modern GNU tools or Linux itself).
Gdbserver supports inspection of ARC HS registers R30, R58 and R59 - feature
that has been added to Linux 4.12.  Whether gdbserver build will actually
support this feature depends on the version of Linux headers used to build
the server.

v2 [1]:
- Use "this->read_memory ()" instead of "the_target->read_memory ()".
- Remove the unnecessary "arch-arc.o:" target from the "Makefile.in".
- Got rid of "ntohs()" function and added lots of comments about
  endianness.
- Clarify why "pc" value is read from and saved to different fields
  in user regs struct.
- In function "is_reg_name_available_p()", use a range-based iterator
  to loop over the registers.
- Removed mentioning of issue number that was not related to sourceware.
- A few typo's fixed.

[1] Remarks
https://sourceware.org/pipermail/gdb-patches/2020-September/171911.html
https://sourceware.org/pipermail/gdb-patches/2020-September/171919.html

gdbserver/ChangeLog:

* configure.srv: Support ARC architecture.
* Makefile.in: Add linux-arc-low.cc and arch/arc.o.
* linux-arc-low.cc: New file.

3 years agoarc: Rename "arc_gdbarch_features" struct
Shahab Vahedi [Mon, 5 Oct 2020 15:10:47 +0000 (17:10 +0200)] 
arc: Rename "arc_gdbarch_features" struct

"arc_gdbarch_features" is a data structure containing information
about the ARC architecture: ISA version, register size, etc.
This name is misleading, because although it carries the phrase
"gdbarch", it has nothing to do with the type/interface in GDB.
Traditionaly, "gdbarch" structures are only used for that purpose.
To rectify this, this patch changes the name to "arc_arch_features".

gdb/ChangeLog:

* arch/arc.h: Rename "arc_gdbarch_features" to
"arc_arch_features".
* arc-tdep.h: Likewise.
* arc-tdep.c: Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Oct 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Oct 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Oct 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Oct 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Oct 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Oct 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Oct 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Sep 2020 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Sep 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: Fix from_tty argument to gdb.execute in Python.
Gareth Rees [Sat, 26 Sep 2020 18:01:45 +0000 (11:01 -0700)] 
gdb: Fix from_tty argument to gdb.execute in Python.

Prior to commit 56bcdbea2b, the from_tty keyword argument to the
Python function gdb.execute controlled whether the command took input
from the terminal. When from_tty=True, "starti" and similar commands
prompted the user:

    (gdb) python gdb.execute("starti", from_tty=True)
    The program being debugged has been started already.
    Start it from the beginning? (y or n) y
    Starting program: /bin/true

    Program stopped.

When from_tty=False, these commands did not prompt the user, and "yes"
was assumed:

    (gdb) python gdb.execute("starti", from_tty=False)

    Program stopped.

However, after commit 56bcdbea2b, the from_tty keyword argument no
longer had this effect. For example, as of commit 7ade7fba75:

    (gdb) python gdb.execute("starti", from_tty=True)
    The program being debugged has been started already.
    Start it from the beginning? (y or n) [answered Y; input not from terminal]
    Starting program: /bin/true

    Program stopped.

Note the "[answered Y; input not from terminal]" in the output even
though from_tty=True was requested.

Looking at commit 56bcdbea2b, it seems that the behaviour of the
from_tty argument was changed accidentally. The commit message said:

    Let gdb.execute handle multi-line commands

    This changes the Python API so that gdb.execute can now handle
    multi-line commands, like "commands" or "define".

and there was no mention of changing the effect of the from_tty
argument. It looks as though the code for setting the instream to
nullptr was accidentally moved from execute_user_command() to
execute_control_commands() along with the other scoped restores.

Accordingly, the simplest way to fix this is to partially reverse
commit 56bcdbea2b by moving the code for setting the instream to
nullptr back to execute_user_command() where it was to begin with.

Additionally, add a test case to reduce the risk of similar breakage
in future.

gdb/ChangeLog:

PR python/26586
* cli/cli-script.c (execute_control_commands): don't set
instream to nullptr here as this breaks the from_tty argument
to gdb.execute in Python.
(execute_user_command): set instream to nullptr here instead.

gdb/testsuite/ChangeLog:

PR python/26586
* gdb.python/python.exp: add test cases for the from_tty
argument to gdb.execute.

(cherry picked from commit 8f9929bb97dc0f0fdf60269ac8c9a7d50746646f)

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Sep 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Sep 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Sep 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb/breakpoint: make a copy of the "commands" command's argument
Tankut Baris Aktemur [Fri, 11 Sep 2020 13:04:01 +0000 (15:04 +0200)] 
gdb/breakpoint: make a copy of the "commands" command's argument

When GDB reads commands from the input, its internal buffer is re-used
for each line.  This is usually just fine because commands are
executed in order; by the time we read the next line, we are already
done with the current line.  However, a problematic case is breakpoint
commands that are input from a script.  The header (e.g. commands 1 2)
is overwritten with the next line before the breakpoint numbers are
processed completely.

For example, suppose we have the following script:

  break main
  break main
  commands 1 2
    print 100123
  end

and source this script:

  (gdb) source script.gdb
  Breakpoint 1 at 0x1245: file main.cpp, line 27.
  Breakpoint 2 at 0x1245: file main.cpp, line 27.
  No breakpoint number 123.

Note the "No breakpoint number 123." error message.  This happens
because GDB first reads "commands 1 2" into its internal buffer

  buffer -> "commands 1 2"

and then starts parsing the breakpoint numbers.  After parsing the first
token, the "next token" pointer is as below:

  buffer -> "commands 1 2"
  next-token -----------^

So, if we continue parsing, we would tokenize "2" correctly.  However,
before parsing the next number, GDB reads the commands to attach them
to breakpoint 1.  Reading the commands causes the buffer to be
overwritten:

  buffer -> "  print 100123"
  next-token -----------^

So, the next time we parse the breakpoint number, we read "123".

To fix, simply create a copy of the arguments of the header.

gdb/ChangeLog:
2020-09-25  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* breakpoint.c (commands_command_1): Make a copy of the 'arg'
argument.

gdb/testsuite/ChangeLog:
2020-09-25  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* gdb.base/bp-cmds-sourced-script.c: New file.
* gdb.base/bp-cmds-sourced-script.exp: New test.
* gdb.base/bp-cmds-sourced-script.gdb: New file.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Sep 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoDon't let TUI focus on locator
Tom Tromey [Wed, 23 Sep 2020 18:57:19 +0000 (12:57 -0600)] 
Don't let TUI focus on locator

PR tui/26638 notes that the C-x o binding can put the focus on the
locator window.  However, this is not useful and did not happen
historically.  This patch changes the TUI to skip this window when
switching focus.

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

PR tui/26638:
* tui/tui-stack.h (struct tui_locator_window) <can_focus>: New
method.
* tui/tui-data.h (struct tui_win_info) <can_focus>: New method.
* tui/tui-data.c (tui_next_win): Exclude non-focusable windows.
(tui_prev_win): Rewrite.

gdb/testsuite/ChangeLog
2020-09-24  Tom Tromey  <tromey@adacore.com>

PR tui/26638:
* gdb.tui/list.exp: Check output of "focus next".

3 years agoHandle 64bit breakpoints of WOW64 processes as SIGINT
Hannes Domani [Wed, 23 Sep 2020 16:16:24 +0000 (18:16 +0200)] 
Handle 64bit breakpoints of WOW64 processes as SIGINT

When a WOW64 process triggers a breakpoint exception in 64bit code (which
happens when a 64bit gdb calls DebugBreakProcess for a 32bit target),
gdb ignores the breakpoint (because Wow64GetThreadContext can only report
the pc of 32bit code, and there is not int3 at this location).

But if these 64bit breakpoint exceptions are handled as SIGINT, gdb
doesn't check for int3, and always stops the target.

gdb/ChangeLog:

2020-09-23  Hannes Domani  <ssbssa@yahoo.de>

* nat/windows-nat.c (handle_exception): Handle 64bit breakpoints
in WOW64 processes as SIGINT.
* nat/windows-nat.h: Make wow64_process a shared variable.
* windows-nat.c: Remove static wow64_process variable.

gdbserver/ChangeLog:

2020-09-23  Hannes Domani  <ssbssa@yahoo.de>

* win32-low.cc: Remove local wow64_process variable.
* win32-low.h: Remove local wow64_process variable.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Sep 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Sep 2020 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Sep 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Sep 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Sep 2020 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: Update i386_analyze_prologue to skip endbr32
Victor Collod [Sat, 19 Sep 2020 00:53:02 +0000 (17:53 -0700)] 
gdb: Update i386_analyze_prologue to skip endbr32

With -m32 -fcf-protection, GCC generates an `endbr32` instruction at the
function entry:

[hjl@gnu-cfl-2 gdb]$ cat /tmp/x.c
int
main(void)
{
  return 0;
}
[hjl@gnu-cfl-2 gdb]$ gcc -g -fcf-protection /tmp/x.c -m32
(gdb) b main
Breakpoint 1 at 0x8049176: file /tmp/x.c, line 3.
(gdb) r
Breakpoint 1, main () at /tmp/x.c:3
3 {
(gdb) disass
Dump of assembler code for function main:
=> 0x08049176 <+0>: endbr32
   0x0804917a <+4>: push   %ebp
   0x0804917b <+5>: mov    %esp,%ebp
   0x0804917d <+7>: mov    $0x0,%eax
   0x08049182 <+12>: pop    %ebp
   0x08049183 <+13>: ret
End of assembler dump.
(gdb)

Update i386_analyze_prologue to skip `endbr32`:

(gdb) b main
Breakpoint 1 at 0x804917d: file /tmp/x.c, line 4.
(gdb) r
Breakpoint 1, main () at /tmp/x.c:4
4   return 0;
(gdb) disass
Dump of assembler code for function main:
   0x08049176 <+0>: endbr32
   0x0804917a <+4>: push   %ebp
   0x0804917b <+5>: mov    %esp,%ebp
=> 0x0804917d <+7>: mov    $0x0,%eax
   0x08049182 <+12>: pop    %ebp
   0x08049183 <+13>: ret
End of assembler dump.
(gdb)

Tested with

$ make check RUNTESTFLAGS="--target_board='unix{-m32,}' i386-prologue-skip-cf-protection.exp"

on Fedora 32/x86-64.

2020-0X-YY  Victor Collod  <vcollod@nvidia.com>

gdb/ChangeLog:

PR gdb/26635
* i386-tdep.c (i386_skip_endbr): Add a helper function to skip endbr.
(i386_analyze_prologue): Call i386_skip_endbr.

gdb/testsuite/ChangeLog:

PR gdb/26635
* gdb.arch/amd64-prologue-skip-cf-protection.exp: Make the test
compatible with i386, and move it to...
* gdb.arch/i386-prologue-skip-cf-protection.exp: ... here.
* gdb.arch/amd64-prologue-skip-cf-protection.c: Move to...
* gdb.arch/i386-prologue-skip-cf-protection.c: ... here.

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Sep 2020 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoFix "thread find" with multiple inferiors/targets (PR gdb/26631)
Pedro Alves [Fri, 18 Sep 2020 12:40:55 +0000 (13:40 +0100)] 
Fix "thread find" with multiple inferiors/targets (PR gdb/26631)

"thread find" with multiple inferiors got broken with the multi-target
work:

 Thread 1 "gdb" hit Breakpoint 1, internal_error (...) at ../../src/gdbsupport/errors.cc:51
 51      {
 (top-gdb) bt
 #0  internal_error (file=0xffffd4d0 <error: Cannot access memory at address 0xffffd4d0>, line=0, fmt=0x555556330320 "en_US.UTF-8") at ../../src/gdbsupport/errors.cc:51
 #1  0x0000555555bca4c7 in target_thread_name (info=0x555556801290) at ../../src/gdb/target.c:2035
 #2  0x0000555555beb07a in thread_find_command (arg=0x7fffffffe08e "1", from_tty=0) at ../../src/gdb/thread.c:1959
 #3  0x000055555572ec49 in do_const_cfunc (c=0x555556786bc0, args=0x7fffffffe08e "1", from_tty=0) at ../../src/gdb/cli/cli-decode.c:95
 #4  0x0000555555732abd in cmd_func (cmd=0x555556786bc0, args=0x7fffffffe08e "1", from_tty=0) at ../../src/gdb/cli/cli-decode.c:2181
 #5  0x0000555555bf1245 in execute_command (p=0x7fffffffe08e "1", from_tty=0) at ../../src/gdb/top.c:664
 #6  0x00005555559cad10 in catch_command_errors (command=0x555555bf0c31 <execute_command(char const*, int)>, arg=0x7fffffffe082 "thread find 1", from_tty=0) at ../../src/gdb/main.c:457
 #7  0x00005555559cc33d in captured_main_1 (context=0x7fffffffdb60) at ../../src/gdb/main.c:1218
 #8  0x00005555559cc571 in captured_main (data=0x7fffffffdb60) at ../../src/gdb/main.c:1243
 #9  0x00005555559cc5e8 in gdb_main (args=0x7fffffffdb60) at ../../src/gdb/main.c:1268
 #10 0x0000555555623816 in main (argc=17, argv=0x7fffffffdc78) at ../../src/gdb/gdb.c:32

The problem is that we're not switching to the inferior/target before
calling target methods, which trips on an assertion put in place
exactly to catch this sort of problem.

gdb/testsuite/ChangeLog:

PR gdb/26631
* gdb.multi/multi-target-thread-find.exp: New file.

gdb/ChangeLog:

PR gdb/26631
* thread.c (thread_find_command): Switch inferior before calling
target methods.

3 years agoSplit gdb.multi/multi-target.exp into separate testcases
Pedro Alves [Fri, 18 Sep 2020 12:40:55 +0000 (13:40 +0100)] 
Split gdb.multi/multi-target.exp into separate testcases

gdb.multi/multi-target.exp sets up a debug environment with multiple
gdbservers, multiple native processes, and multiple cores, which has
proved useful for exercising a number of multi-target scenarios.

But, as we add more tests to gdb.base/multi-target.exp, it is growing
a bit too large (making a bit cumbersome to debug) and too slow to run
(if you have glibc debug info).

This commit thus splits the multi-target.exp into several testcases,
one per use case.  The common setup code is moved to a new
multi-target.exp.tcl file that is included by all the resulting
multi-target testcases.

gdb/testsuite/ChangeLog:

* gdb.multi/multi-target-continue.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-info-inferiors.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-interrupt.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-no-resumed.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target-ping-pong-next.exp: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target.exp.tcl: New file, factored out from
multi-target.exp.
* gdb.multi/multi-target.exp: Delete.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Sep 2020 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Sep 2020 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoMatch demangled name in "skip"
Tom Tromey [Wed, 16 Sep 2020 15:49:36 +0000 (09:49 -0600)] 
Match demangled name in "skip"

PR gdb/26598 notes that, before commit bcfe6157ca28 ("Use the linkage
name if it exists"), the "skip" command would match the demangled name
of a symbol, but now only matches the linkage name.

This patch fixes this regression.  I looked at all calls to
function_name_is_marked_for_skip, and only one used the linkage name.

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

PR gdb/26598:
* infrun.c (fill_in_stop_func): Use find_pc_partial_function_sym.

gdb/testsuite/ChangeLog
2020-09-16  Tom Tromey  <tromey@adacore.com>

PR gdb/26598:
* gdb.base/skipcxx.exp: New file.
* gdb.base/skipcxx.cc: New file.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Sep 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAvoid running one Rust test against older LLVM
Tom Tromey [Tue, 15 Sep 2020 15:27:01 +0000 (09:27 -0600)] 
Avoid running one Rust test against older LLVM

LLVM 8.0 introduced some changes to let the Rust compiler emit DWARF
variant parts.  Before this change, the compiler would emit two types
with the same name, and unfortunately gdb happens to pick the wrong
one.  So, this patch disables the test when using an older version of
LLVM.

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

PR rust/26197:
* lib/rust-support.exp (rust_llvm_version): New proc.
* gdb.rust/simple.exp: Check rust_llvm_version.

3 years agoFix exception stack unwinding for ARM Cortex-M
Fredrik Hederstierna [Mon, 14 Sep 2020 13:56:34 +0000 (14:56 +0100)] 
Fix exception stack unwinding for ARM Cortex-M

For Cortex-M targets using floating-point, eg the Cortex-M4F, its not possible
to get any call-stack backtrace if setting a breakpoint in ISR.

The exception stack unwinder for Cortex-M does not consider if floating-point
registers was stacked or not, further the Cortex-M has two stack pointers: MSP
(Main Stack Pointer) and PSP (Process Stack Pointer).
This is not handled when GDB tries to backtrace in the exception stack
unwinder.

This patch fixes this, and gives a correct call-stack backtrace from
breakpoints set in a handler or ISR.

gdb/ChangeLog:

        * arm-tdep.c (arm_m_exception_cache): Try use correct stack
        pointer and stack frame offset when unwinding.

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Sep 2020 00:00:51 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Sep 2020 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoBump GDB version number to 10.0.90.DATE-git.
Joel Brobecker [Sun, 13 Sep 2020 03:06:27 +0000 (20:06 -0700)] 
Bump GDB version number to 10.0.90.DATE-git.

gdb/ChangeLog:

* version.in: Set GDB version number to 10.0.90.DATE-git.

3 years agoDocument the GDB 10.0.90 release in gdb/ChangeLog
Joel Brobecker [Sun, 13 Sep 2020 03:06:13 +0000 (20:06 -0700)] 
Document the GDB 10.0.90 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 10.0.90 released.

3 years agoSet GDB version number to 10.0.90.
Joel Brobecker [Sun, 13 Sep 2020 02:57:18 +0000 (19:57 -0700)] 
Set GDB version number to 10.0.90.

gdb/ChangeLog:

* version.in: Set GDB version number to 10.0.90.

3 years agogdb/NEWS: Change "since GDB 9" to "in GDB 10"
Joel Brobecker [Sun, 13 Sep 2020 02:49:53 +0000 (19:49 -0700)] 
gdb/NEWS: Change "since GDB 9" to "in GDB 10"

gdb/ChangeLog:

* NEWS: Change "Changes since GDB 9" to "Changes in GDB 10".

3 years agoSet development mode to "off" by default.
Joel Brobecker [Sun, 13 Sep 2020 02:34:37 +0000 (19:34 -0700)] 
Set development mode to "off" by default.

bfd/ChangeLog:

* development.sh (development): Set to false.

3 years agoBump version to 10.0.90.DATE-git.
Joel Brobecker [Sun, 13 Sep 2020 02:34:15 +0000 (19:34 -0700)] 
Bump version to 10.0.90.DATE-git.

Now that the GDB 10 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 10 branch created (8087c3fa8b5d695e3e29e69d70d0b35ec902ac59):
* version.in: Bump version to 10.0.90.DATE-git.

3 years agoFix GDB build in infrun.c when configured with unit tests disabled gdb-10-branchpoint
Joel Brobecker [Sat, 12 Sep 2020 19:30:56 +0000 (12:30 -0700)] 
Fix GDB build in infrun.c when configured with unit tests disabled

I noticed this while testing the GDB in the context of the upcoming
GDB 10 release branching, because part of the process involves setting
development to False, which in turn changes the default for including
unittest to false as well. As a result, without this patch, we get
compilation errors in infrun.c such as:

    infrun.c:9219:5: error: `scoped_mock_context' was not declared in this scope

This patch fixes it by bracketing the unitttest in namespace selftest
with an #if GDB_SELF_TEST.

gdb/ChangeLog:

        * infrun.c (namespace selftests): Only define #if GDB_SELF_TEST.

Tested on x86_64-linux, with and without self-tests.

3 years agoelf: Add -z unique-symbol to avoid duplicated local symbol names
H.J. Lu [Sat, 12 Sep 2020 12:37:30 +0000 (05:37 -0700)] 
elf: Add -z unique-symbol to avoid duplicated local symbol names

The symbol string table in the .symtab section is optional and cosmetic.
The contents of the .symtab section have no impact on run-time execution.
The symbol names in the symbol string table help distinguish addresses at
different locations.  Add a linker option, -z unique-symbol, to avoid
duplicated local symbol names in the symbol string table.

This feature was well received by the livepatch maintainers.  It not only
solves the duplicated local symbol name problem, but also would allow
livepatch to more precisely locate duplicate symbols in general for
patching.

bfd/

PR ld/26391
* elflink.c (elf_final_link_info): Add local_hash_table.
(local_hash_entry): New.
(local_hash_newfunc): Likewise.
(elf_link_output_symstrtab): Append ".COUNT" to duplicated local
symbols.
(bfd_elf_final_link): Initialize and free local_hash_table for
"-z unique-symbol".

include/

PR ld/26391
* bfdlink.h (bfd_link_info): Add unique_symbol.

ld/

PR ld/26391
* NEWS: Mention "-z unique-symbol".
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Handle
"-z unique-symbol" and "-z nounique-symbol".
* ld.texi: Document "-z unique-symbol" and "-z nounique-symbol".
* lexsup.c (elf_static_list_options): Add "-z unique-symbol" and
"-z nounique-symbol".
* testsuite/ld-elf/elf.exp: Add PR ld/26391 tests.
* testsuite/ld-elf/pr26391.nd: New file.
* testsuite/ld-elf/pr26391.out: Likewise.
* testsuite/ld-elf/pr26391a.c: Likewise.
* testsuite/ld-elf/pr26391b.c: Likewise.
* testsuite/ld-elf/pr26391c.c: Likewise.
* testsuite/ld-elf/pr26391d.c: Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Sep 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAdd bfloat16 support for AVX512 register view.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:53 +0000 (14:29 +0200)] 
Add bfloat16 support for AVX512 register view.

This adds support for the bfloat16 datatype, which can be seen as a short
version of FP32, skipping the least significant 16 bits of the mantissa.
Since the datatype is currently only supported by the AVX512 registers,
the printing of bfloat16 values is only supported for xmm, ymm and zmm
registers.

gdb/ChangeLog:
2020-09-11  Moritz Riesterer  <moritz.riesterer@intel.com>
    Felix Willgerodt  <Felix.Willgerodt@intel.com>

* gdbarch.sh: Added bfloat16 type.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_bfloat16): New struct.
(gdbtypes_post_init): Add builtin_bfloat16.
* gdbtypes.h (struct builtin_type) <builtin_bfloat16>: New member.
(floatformats_bfloat16): New struct.
* i386-tdep.c (i386_zmm_type): Add field "v32_bfloat16"
(i386_ymm_type): Add field "v16_bfloat16"
(i386_gdbarch_init): Add set_gdbarch_bfloat16_format.
* target-descriptions.c (make_gdb_type): Add case TDESC_TYPE_BFLOAT16.
* gdbsupport/tdesc.cc (tdesc_predefined_types): New member bfloat16.
* gdbsupport/tdesc.h (tdesc_type_kind): New member TDESC_TYPE_BFLOAT16.
* features/i386/64bit-avx512.xml: Add bfloat16 type.
* features/i386/64bit-avx512.c: Regenerated.
* features/i386/64bit-sse.xml: Add bfloat16 type.
* features/i386/64bit-sse.c: Regenerated.

gdb/testsuite/ChangeLog:
2020-09-11  Moritz Riesterer  <moritz.riesterer@intel.com>
    Felix Willgerodt  <Felix.Willgerodt@intel.com>

* x86-avx512bf16.c: New file.
* x86-avx512bf16.exp: Likewise.
* lib/gdb.exp (skip_avx512bf16_tests): New function.

3 years agoi386-tdep: Fix naming in zmm and ymm type descriptions.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:52 +0000 (14:29 +0200)] 
i386-tdep: Fix naming in zmm and ymm type descriptions.

gdb/Changelog:
2020-07-02  Felix Willgerodt  <felix.willgerodt@intel.com>

* i386-tdep.c (i386_zmm_type): Fix field names.
(i386_ymm_type): Fix field names.

3 years agoSync include, libiberty with GCC.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:51 +0000 (14:29 +0200)] 
Sync include, libiberty with GCC.

include:
2020-09-10  Felix Willgerodt  <felix.willgerodt@intel.com>

    Sync with GCC
    2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

    * floatformat.h (floatformat_bfloat16_big): New.
    (floatformat_bfloat16_little): New.

libiberty:
2020-09-10  Felix Willgerodt  <felix.willgerodt@intel.com>

    Sync with GCC
    2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

    * floatformat.c (floatformat_bfloat16_big): New.
    (floatformat_bfloat16_little): New.

3 years agogas: Don't error when .debug_line already exists, unless .loc was used
Mark Wielaard [Mon, 7 Sep 2020 12:25:25 +0000 (14:25 +0200)] 
gas: Don't error when .debug_line already exists, unless .loc was used

When -g was used to generate DWARF gas would error out when a .debug_line
already exists. But when a .debug_info section already exists it would
simply skip generating one without warning or error. Do the same for
.debug_line. It is only an error when the user explicitly uses .loc
directives and also generates the .debug_line table itself.

The tests are unfortunately arch specific because the line table is only
generated when actual instructions have been emitted. Use i386 because
that is probably the most used architecture. Before this patch the new
dwarf-line-2 testcase would fail, with this patch it succeeds (and doesn't
try to add its own line table).

gas/ChangeLog:

    * as.texi (-g): Explicitly mention when .debug_info and .debug_line
    are generated for the DWARF format.
    (Loc): Add that it is an error to both use a .loc directive and
    generate a .debug_line yourself.
    * dwarf2dbg.c (dwarf2_any_loc_directive_seen): New static variable.
    (dwarf2_directive_loc): Set dwarf2_any_loc_directive_seen to TRUE.
    (dwarf2_finish): Check dwarf2_any_loc_directive_seen before emitting
    an error. Only create .debug_line if it is empty (or doesn't exist).
    * testsuite/gas/i386/i386.exp: Add dwarf2-line-{1,2,3,4} when testing
    an elf target.
    * testsuite/gas/i386/dwarf2-line-{1,2,3,4}.{s,d,l}: New test files.

3 years agoCSKY: Change ISA flag's type to bfd_uint64_t and fix build error.
Cooper Qu [Fri, 11 Sep 2020 15:58:11 +0000 (23:58 +0800)] 
CSKY: Change ISA flag's type to bfd_uint64_t and fix build error.

The previous patch missed one modification.
Following is the error message:
gas/config/tc-csky.c:806:5: error: 'CSKY_ARCH_804' undeclared here
(not in a function); did you mean 'CSKY_ARCH_807'?

include/
* opcode/csky.h (CSKYV1_ISA_E1): Convert to bfd_uint64_t type.
(CSKYV2_ISA_E1): Likewise.
(CSKYV2_ISA_1E2): Likewise.
(CSKYV2_ISA_2E3): Likewise.
(CSKYV2_ISA_3E7): Likewise.
(CSKYV2_ISA_7E10): Likewise.
(CSKYV2_ISA_3E3R1): Likewise.
(CSKYV2_ISA_3E3R2): Likewise.
(CSKYV2_ISA_10E60): Likewise.
(CSKYV2_ISA_3E3R3): Likewise.
(CSKY_ISA_TRUST): Likewise.
(CSKY_ISA_CACHE): Likewise.
(CSKY_ISA_NVIC): Likewise.
(CSKY_ISA_CP): Likewise.
(CSKY_ISA_MP): Likewise.
(CSKY_ISA_MP_1E2): Likewise.
(CSKY_ISA_JAVA): Likewise.
(CSKY_ISA_MAC): Likewise.
(CSKY_ISA_MAC_DSP): Likewise.
(CSKY_ISA_DSP): Likewise.
(CSKY_ISA_DSP_1E2): Likewise.
(CSKY_ISA_DSP_ENHANCE): Likewise.
(CSKY_ISA_DSPE60): Likewise.
(CSKY_ISA_FLOAT_E1): Likewise.
(CSKY_ISA_FLOAT_1E2): Likewise.
(CSKY_ISA_FLOAT_1E3): Likewise.
(CSKY_ISA_FLOAT_3E4): Likewise.
(CSKY_ISA_FLOAT_7E60): Likewise.
(CSKY_ISA_VDSP): Likewise.
(CSKY_ISA_VDSP_2): Likewise.
(CSKY_ARCH_804): Define.
(CSKY_ARCH_805): Define.
(CSKY_ARCH_800): Define.

3 years agoFix a segfault when creating an import library with 0 exports.
Jeremy Drake [Fri, 11 Sep 2020 16:51:16 +0000 (17:51 +0100)] 
Fix a segfault when creating an import library with 0 exports.

PR 26588
* emultempl/pe.em (_finish): Only generate a import library if not
exporting relocs.
* emultempl/pep.em: Likewise.

3 years ago[gdb/testsuite] Kfail gdb.cp/ambiguous.exp FAILs for PR26602
Tom de Vries [Fri, 11 Sep 2020 13:56:44 +0000 (15:56 +0200)] 
[gdb/testsuite] Kfail gdb.cp/ambiguous.exp FAILs for PR26602

Kfail these FAILs as caused by PR exp/26602:
...
FAIL: gdb.cp/ambiguous.exp: print x.x
FAIL: gdb.cp/ambiguous.exp: print n.x
FAIL: gdb.cp/ambiguous.exp: print j.x
FAIL: gdb.cp/ambiguous.exp: print jva1.x
FAIL: gdb.cp/ambiguous.exp: print jva2.x
FAIL: gdb.cp/ambiguous.exp: print (A1)j
FAIL: gdb.cp/ambiguous.exp: print (A1)jva1
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

PR exp/26602
* gdb.cp/ambiguous.exp: Add KFAILs for PR26602.

3 years agox86: Add NT_X86_CET note
H.J. Lu [Fri, 11 Sep 2020 12:51:53 +0000 (05:51 -0700)] 
x86: Add NT_X86_CET note

Define NT_X86_CET which is the proposed note for x86 CET state to support
Intel CET in Linux kernel.  Double check it after Intel CET patches have
been merged into Linux kernel.

binutils/

* readelf.c (get_note_type): Support NT_X86_CET.

include/

* elf/common.h (NT_X86_CET): New.

3 years agoFix the debuglink following code to recursively load links found in the newly loaded...
Nick Clifton [Fri, 11 Sep 2020 12:30:38 +0000 (13:30 +0100)] 
Fix the debuglink following code to recursively load links found in the newly loaded debug info.

PR 26595
* dwarf.c (load_separate_debug_info): Return NULL rather than
FALSE in error situations.
(load_separate_debug_file): Move code to load debug links to ...
(check_for_and_load_links): ... here.  New function.  Load
separate debug information pointed to by debuglink and
debugaltlink sections.  Recursively scan newly loaded debug
information for more links and load them too.

3 years agogdb/breakpoint: fix typo in help message of "set breakpoint condition-evaluation"
Tankut Baris Aktemur [Fri, 11 Sep 2020 11:50:09 +0000 (13:50 +0200)] 
gdb/breakpoint: fix typo in help message of "set breakpoint condition-evaluation"

The options for the "breakpoint condition-evaluation" setting are
"host", "target", and "auto".  The help message mentions the option
"gdb" at one point instead of "host".  Fix this typo.  Also add a period.

gdb/ChangeLog:
2020-09-11  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* breakpoint.c: Fix typo in the help message of the
"set breakpoint condition-evaluation" command.

3 years agogdb/testsuite: remove stale comment in gdb.base/bp-cmds-execution-x-script.exp
Tankut Baris Aktemur [Fri, 11 Sep 2020 11:40:41 +0000 (13:40 +0200)] 
gdb/testsuite: remove stale comment in gdb.base/bp-cmds-execution-x-script.exp

Remove a stale command that is apparently forgotten after a copy-paste
from 'gdb.base/break-main-file-remove-fail.exp'.

gdb/testsuite/ChangeLog:
2020-09-11  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* gdb.base/bp-cmds-execution-x-script.exp: Remove a stale comment.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Sep 2020 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoaarch64: Return an error on conditional branch to an undefined symbol
Siddhesh Poyarekar [Tue, 1 Sep 2020 08:55:52 +0000 (14:25 +0530)] 
aarch64: Return an error on conditional branch to an undefined symbol

The fix in 7e05773767820b441b23a16628b55c98cb1aef46 introduced a PLT
for conditional jumps when the target symbol is undefined.  This is
incorrect because conditional branch relocations are not allowed to
clobber IP0/IP1 and hence, should not result in a dynamic relocation.

Revert that change and in its place, issue an error when the target
symbol is undefined.

bfd/

2020-09-10  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>

* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Revert
changes in 7e05773767820b441b23a16628b55c98cb1aef46.  Set
error for undefined symbol in BFD_RELOC_AARCH64_BRANCH19 and
BFD_RELOC_AARCH64_TSTBR14 relocations.

ld/

2020-09-10  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>

* testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead
of valid output.

3 years agold: Add more tests for --as-needed
H.J. Lu [Thu, 10 Sep 2020 14:52:03 +0000 (07:52 -0700)] 
ld: Add more tests for --as-needed

Prior to

commit 1e3b96fd6cf0c7d018083994ad951ccf92aba582
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Sep 4 13:54:21 2020 +0930

    Allow plugin syms to mark as-needed shared libs needed

when removing unused IR symbol references, ld didn't add unnecessary
DT_NEEDED libraries which may lead to undefined symbol reference in a
--as-needed library when the symbol is defined in a prior --as-needed
library and there is no reference in relocatable inputs.  This behavior
is desirable since it ensures that both lazy and non-lazy bindings work
the same way.  The problem is with --as-needed libraries, which happens
with and without LTO.  Now, the linker may add many unnecessary DT_NEEDED
libraries for IR inputs.

PR ld/26590
* testsuite/ld-elf/pr26590.err: New file.
* testsuite/ld-elf/pr26590a.c: Likewise.
* testsuite/ld-elf/pr26590b.c: Likewise.
* testsuite/ld-elf/pr26590c.c: Likewise.
* testsuite/ld-elf/pr26590d.c: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/26590 tests.

3 years agoPR26597, FAIL: gdb.dlang/demangle.exp: _D8demangle4testFI5identZv
Alan Modra [Thu, 10 Sep 2020 14:16:11 +0000 (23:46 +0930)] 
PR26597, FAIL: gdb.dlang/demangle.exp: _D8demangle4testFI5identZv

gcc commit 387d0773f3 changed the D demangler, with the following
commit log:

    libiberty: Add support for `in' and `in ref' storage classes.

    The storage class `in' is now a first-class citizen with its own mangle
    symbol, of which also permits `in ref'.  Previously, `in' was an alias
    to `const [scope]', which is a type constructor.

    The mangle symbol repurposed for this is `I', which was originally used
    by identifier types.  However, while TypeIdentifier is part of the
    grammar, it must be resolved to some other entity during the semantic
    passes, and so shouldn't appear anywhere in the mangled name.

    Old tests that are now no longer valid have been removed.

This patch makes the same changes to the gdb testsuite as were made to
the upstream gcc libiberty testsuite.

gdb/testsuite/
PR 26597
* gdb.dlang/demangle.exp: Update tests as per gcc commit 387d0773f3.

3 years agoAdd minimal and functional NetBSD/amd64 gdbserver
Kamil Rytarowski [Wed, 2 Sep 2020 17:35:42 +0000 (19:35 +0200)] 
Add minimal and functional NetBSD/amd64 gdbserver

Implement the following functionality: create_inferior,
post_create_inferior, attach, kill, detach, mourn, join, thread_alive,
resume, wait, fetch_registers, store_registers, read_memory, write_memory,
request_interrupt, supports_read_auxv, read_auxv,
supports_hardware_single_step, sw_breakpoint_from_kind,
supports_z_point_type, insert_point, remove_point,
stopped_by_sw_breakpoint, supports_qxfer_siginfo, qxfer_siginfo,
supports_stopped_by_sw_breakpoint, supports_non_stop,
supports_multi_process, supports_fork_events, supports_vfork_events,
supports_exec_events, supports_disable_randomization,
supports_qxfer_libraries_svr4, qxfer_libraries_svr4,
supports_pid_to_exec_file, pid_to_exec_file, thread_name,
supports_catch_syscall.

The only CPU architecture supported: x86_64.

Implement only support for hardware assisted single step and
software breakpoint.

Implement support only for regular X86 registers, thus no FPU.

gdbserver/ChangeLog:

       * netbsd-low.cc: Add.
       * netbsd-low.h: Likewise.
       * netbsd-amd64-low.cc: Likewise.
       * Makefile.in (SFILES): Register "netbsd-low.cc", "netbsd-low.h",
       "netbsd-amd64-low.cc".
       * configure.srv: Add x86_64-*-netbsd*.

3 years agoSwitch local native code to gdb/nat shared functions
Kamil Rytarowski [Wed, 2 Sep 2020 17:32:54 +0000 (19:32 +0200)] 
Switch local native code to gdb/nat shared functions

No functional change as the same functionality inlined in nbsd-nat.c
is offered in gdb/nat/netbsd-nat.c.

gdb/ChangeLog:

* nbsd-nat.c: Include "nat/netbsd-nat.h".
* (nbsd_nat_target::pid_to_exec_file)
(nbsd_nat_target::thread_alive, nbsd_nat_target::thread_name)
(nbsd_nat_target::post_startup_inferior)
(nbsd_nat_target::post_attach, nbsd_nat_target::xfer_partial)
(nbsd_add_threads): Switch local code to common gdb/nat functions.
* (nbsd_pid_to_cmdline): Call sysctl from the global namespace.
* (nbsd_thread_lister): Remove.

3 years agoAvoid double free in startup_inferior
Kamil Rytarowski [Wed, 2 Sep 2020 17:24:05 +0000 (19:24 +0200)] 
Avoid double free in startup_inferior

Do not free the last execd pathname as it will be used in
prepare_resume_reply(), after attaching a client side.

gdb/ChangeLog:

* fork-inferior.c (startup_inferior): Avoid double free.

3 years agoAdd a common utility function to read and write siginfo_t in inferior
Kamil Rytarowski [Wed, 2 Sep 2020 17:21:19 +0000 (19:21 +0200)] 
Add a common utility function to read and write siginfo_t in inferior

gdb/ChangeLog:

        * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.
        * netbsd-nat.c (netbsd_nat::qxfer_siginfo): Likewise.

3 years agoAdd netbsd_nat::enable_proc_events in gdb/nat
Kamil Rytarowski [Wed, 2 Sep 2020 17:18:55 +0000 (19:18 +0200)] 
Add netbsd_nat::enable_proc_events in gdb/nat

Add generic function to enable debugger events in a process.

gdb/ChangeLog:

        * netbsd-nat.h (netbsd_nat::enable_proc_events): Add.
* netbsd-nat.c: Include <sys/ptrace.h>.
* (netbsd_nat::enable_proc_events): Add.

3 years agoAdd gdb/nat common functions for listing threads
Kamil Rytarowski [Wed, 2 Sep 2020 17:13:19 +0000 (19:13 +0200)] 
Add gdb/nat common functions for listing threads

Add netbsd_nat::netbsd_thread_lister a generic thread lister, used
internally in netbsd-nat.c, copied from gdb/nbsd-nat.c.

Add public extern functions for listing threads:
 * netbsd_nat::thread_alive
 * netbsd_nat::thread_name
 * netbsd_nat::for_each_thread

gdb/ChangeLog:

* netbsd-nat.h: Include "gdbsupport/function-view.h".
* (netbsd_nat::thread_alive, netbsd_nat::thread_name)
(netbsd_nat::for_each_thread): Add.
* netbsd-nat.c: Include "gdbsupport/common-defs.h" and
"gdbsupport/common-debug.h".
* (netbsd_nat::netbsd_thread_lister)
(netbsd_nat::thread_alive, netbsd_nat::thread_name)
(netbsd_nat::for_each_thread): Add.

3 years agoAdd netbsd_nat::pid_to_exec_file
Kamil Rytarowski [Wed, 2 Sep 2020 17:08:37 +0000 (19:08 +0200)] 
Add netbsd_nat::pid_to_exec_file

gdb/ChangeLog:

        * netbsd-nat.h: Include <unistd.h>.
        * (netbsd_nat::pid_to_exec_file): Add.
        * netbsd-nat.c: Include <sys/types.h> and <sys/sysctl.h>.
        * (netbsd_nat::pid_to_exec_file) Add.

3 years agoBuild nat/netbsd-nat.o for the NetBSD native target
Kamil Rytarowski [Wed, 2 Sep 2020 17:02:13 +0000 (19:02 +0200)] 
Build nat/netbsd-nat.o for the NetBSD native target

gdb/ChangeLog:

* configure.nat (NATDEPFILES): Add nat/netbsd-nat.o when needed.

3 years agoRegister a placeholder for NetBSD shared functions in gdb/nat
Kamil Rytarowski [Wed, 2 Sep 2020 16:53:41 +0000 (18:53 +0200)] 
Register a placeholder for NetBSD shared functions in gdb/nat

gdb/ChangeLog:

* netbsd-nat.h: New file.
* netbsd-nat.c: Likewise.

3 years agoAdd handle_eintr to wrap EINTR handling in syscalls
Kamil Rytarowski [Wed, 2 Sep 2020 16:20:53 +0000 (18:20 +0200)] 
Add handle_eintr to wrap EINTR handling in syscalls

gdbsupport/ChangeLog:

* eintr.h: New file.

3 years agoStop symbols generated by the annobin gcc plugin from breaking the disassembly of...
Nick Clifton [Thu, 10 Sep 2020 12:23:11 +0000 (13:23 +0100)] 
Stop symbols generated by the annobin gcc plugin from breaking the disassembly of PowerPC binaries.

* ppc-dis.c (ppc_symbol_is_valid): New function.  Returns false
for hidden, local, no-type symbols.
(disassemble_init_powerpc): Point the symbol_is_valid field in the
info structure at the new function.

3 years agoCSKY: Enable extend lrw by default for CK802, CK803 and CK860.
Cooper Qu [Thu, 10 Sep 2020 09:37:05 +0000 (17:37 +0800)] 
CSKY: Enable extend lrw by default for CK802, CK803 and CK860.

gas/
* config/tc-csky.c (md_begin): Enable extend lrw by default for
CK802, CK803 and CK860.

3 years agoCSKY: Add L2Cache instructions for CK860.
Cooper Qu [Thu, 10 Sep 2020 09:36:51 +0000 (17:36 +0800)] 
CSKY: Add L2Cache instructions for CK860.

opcodes/
* csky-opc.h (csky_v2_opcodes): Add L2Cache instructions.
* testsuite/gas/csky/cskyv2_ck860.d : Adjust to icache.iva
opcode fixing.

3 years agoCSKY: Add new arches while refine the cpu option process.
Cooper Qu [Thu, 10 Sep 2020 09:36:24 +0000 (17:36 +0800)] 
CSKY: Add new arches while refine the cpu option process.

Add arches CK804, CK805 and CK800. CK800 is an special arch which
support all instructions for CSKYV2. Refine the cpu tables to
simplify adding a new cpu.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (struct csky_cpu_info): Add new members
isa_flag, features and ver.
(struct csky_cpu_feature): New.
(struct csky_cpu_version): New.
(CSKY_FEATURE_MAX): Define.
(CSKY_CPU_REVERISON_MAX): Define.
(FEATURE_DSP_EXT, FEATURE_DSP, FEATURE_MMU, FEATURE_VDSP,
 FEATURE_FLOAT, FEATURE_TRUST, FEATURE_JAVA, FEATURE_SHIELD):
Define, each standard one collection of instructions.
(CSKY_FEATURES_DEF_NULL, CSKY_FEATURES_DEF_e,
 CSKY_FEATURES_DEF_t, CSKY_FEATURES_DEF_f, CSKY_FEATURES_DEF_v,
 CSKY_FEATURES_DEF_ef, CSKY_FEATURES_DEF_jt,
 CSKY_FEATURES_DEF_efht, CSKY_FEATURES_DEF_efv,
 CSKY_FEATURES_DEF_eft, CSKY_FEATURES_DEF_d,
 CSKY_FEATURES_DEF_df, CSKY_FEATURES_DEF_ft,
 CSKY_FEATURES_DEF_tv, CSKY_FEATURES_DEF_fv,
 CSKY_FEATURES_DEF_dft, CSKY_FEATURES_DEF_dfv,
 CSKY_FEATURES_DEF_ftv, CSKY_FEATURES_DEF_eftv): Define,
the features combination used by cpu.
(CSKY_CPU_REVERISON_r0p0, CSKY_CPU_REVERISON_r1p0,
 CSKY_CPU_REVERISON_r2p0, CSKY_CPU_REVERISON_r3p0,
 CSKY_CPU_REVERISON_RESERVED, CSKY_CPU_REVERISON_R3):
Define, version information used by cpu.
(csky_cpus): Refine, and add CK804, CK805 and CK800.
(parse_cpu): Refine.
(parse_arch): Refine.
(md_show_usage): Refine.
(md_begin): Refine.

include/
* opcode/csky.h (CSKY_ARCH_804): Define.
(CSKY_ARCH_805): Define.
(CSKY_ARCH_800): Define.

3 years agoRe: PR26580, Size and alignment of commons vs as-needed shared lib
Alan Modra [Thu, 10 Sep 2020 09:16:14 +0000 (18:46 +0930)] 
Re: PR26580, Size and alignment of commons vs as-needed shared lib

Some MIPS targets, for reasons I didn't analyse, use the larger common
symbol in a shared lib rather than a smaller common in an executable.
That doesn't seem unreasonable, so allow that to pass for pr26580-2.

bfin-elf complains about not supporting copy relocs, but it's quite
silly to want a copy reloc for common symbols, so leave the fail
there.  mn10300-elf and score-elf both fail the test with "PHDR
segment not covered by LOAD segment".  Other tests fail similarly so
one more doesn't hurt.  The failure is a consequence of supporting
dynamic objects but setting EMBEDDED in ld scripts.

PR 26580
* testsuite/ld-elf/pr26580-2.sd: Accept undefined symbol.

3 years agoRe: lto-18 test
Alan Modra [Thu, 10 Sep 2020 07:40:57 +0000 (17:10 +0930)] 
Re: lto-18 test

Extend the test a little to archives, not that we expect this to
fail.  Nor has the lto-18 test ever failed without -flto.

* testsuite/ld-plugin/lto-18b.c (select): Remove.
* testsuite/ld-plugin/lto-18c.c (select): Remove.
* testsuite/ld-plugin/lto.exp: Build archives for lto-18 too,
and run static versions of the test.

3 years agoFix compile time warnings when building for the CSKY target on a 32-bit host.
Nick Clifton [Thu, 10 Sep 2020 08:58:15 +0000 (09:58 +0100)] 
Fix compile time warnings when building for the CSKY target on a 32-bit host.

incldue * opcode/csky.h (CSKY_ISA_FLOAT_7E60): Use a long long type for
this value.

opcodes * csky-dis.c (csky_output_operand): Coerce the immediate values to
long before printing.

3 years agosprintf arg overlaps destination
Alan Modra [Thu, 10 Sep 2020 04:42:52 +0000 (14:12 +0930)] 
sprintf arg overlaps destination

* csky-dis.c (csky_output_operand): Don't sprintf str to itself.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Sep 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in