Compare commits

...

299 Commits

Author SHA1 Message Date
Joel Brobecker
ce35d7163e Set GDB version number to 10.2.
gdb/ChangeLog:

	* version.in: Set GDB version number to 10.2.
2021-04-25 08:06:27 +04:00
GDB Administrator
8dfccda274 Automatic date update in version.in 2021-04-25 00:00:28 +00:00
GDB Administrator
f55843920a Automatic date update in version.in 2021-04-24 00:00:28 +00:00
GDB Administrator
8402ba96dd Automatic date update in version.in 2021-04-23 00:00:27 +00:00
Simon Marchi
28ba2379de gdb/testsuite: add Python support check in gdb.python/flexible-array-member.exp
We don't want to execute this test if Python support is not compiled in
GDB, add the necessary check.

gdb/testsuite/ChangeLog:

	* gdb.python/flexible-array-member.exp: Add check for Python
	support.

Change-Id: I853b937d2a193a0bb216566bef1a35354264b1c5
2021-04-22 15:46:17 -04:00
Simon Marchi
a260236550 gdb: fix getting range of flexible array member in Python
As reported in bug 27757, we get an internal error when doing:

    $ cat test.c
    struct foo {
        int len;
        int items[];
    };

    struct foo *p;

    int main() {
        return 0;
    }
    $ gcc test.c -g -O0 -o test
    $ ./gdb -q -nx --data-directory=data-directory ./test -ex 'python gdb.parse_and_eval("p").type.target()["items"].type.range()'
    Reading symbols from ./test...
    /home/simark/src/binutils-gdb/gdb/gdbtypes.h:435: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n)

This is because the Python code (typy_range) blindly reads the high
bound of the type of `items` as a constant value.  Since it is a
flexible array member, it has no high bound, the property is undefined.
Since commit 8c2e4e0689 ("gdb: add accessors to struct dynamic_prop"),
the getters check that you are not getting a property value of the wrong
kind, so this causes a failed assertion.

Fix it by checking if the property is indeed a constant value before
accessing it as such.  Otherwise, use 0.  This restores the previous GDB
behavior: because the structure was zero-initialized, this is what was
returned before.  But now this behavior is explicit and not accidental.

Add a test, gdb.python/flexible-array-member.exp, that is derived from
gdb.base/flexible-array-member.exp.  It tests the same things, but
through the Python API.  It also specifically tests getting the range
from the various kinds of flexible array member types (AFAIK it wasn't
possible to do the equivalent through the CLI).

gdb/ChangeLog:

	PR gdb/27757
	* python/py-type.c (typy_range): Check that bounds are constant
	before accessing them as such.
	* guile/scm-type.c (gdbscm_type_range): Likewise.

gdb/testsuite/ChangeLog:

	PR gdb/27757
	* gdb.python/flexible-array-member.c: New test.
	* gdb.python/flexible-array-member.exp: New test.
	* gdb.guile/scm-type.exp (test_range): Add test for flexible
	array member.
	* gdb.guile/scm-type.c (struct flex_member): New.
	(main): Use it.

Change-Id: Ibef92ee5fd871ecb7c791db2a788f203dff2b841
2021-04-22 15:05:18 -04:00
GDB Administrator
36dd66f195 Automatic date update in version.in 2021-04-22 00:00:37 +00:00
GDB Administrator
20899db053 Automatic date update in version.in 2021-04-21 00:00:31 +00:00
GDB Administrator
2b52bbdfa4 Automatic date update in version.in 2021-04-20 00:00:38 +00:00
GDB Administrator
26dfea7696 Automatic date update in version.in 2021-04-19 00:00:26 +00:00
GDB Administrator
91fdd5b9ce Automatic date update in version.in 2021-04-18 00:00:43 +00:00
GDB Administrator
70b55e8f46 Automatic date update in version.in 2021-04-17 00:00:28 +00:00
GDB Administrator
0b1e6d082d Automatic date update in version.in 2021-04-16 00:00:36 +00:00
GDB Administrator
9f70e0a347 Automatic date update in version.in 2021-04-15 00:00:32 +00:00
GDB Administrator
7a1d243e6d Automatic date update in version.in 2021-04-14 00:00:31 +00:00
GDB Administrator
025466feac Automatic date update in version.in 2021-04-13 00:00:40 +00:00
GDB Administrator
f2a2b0148b Automatic date update in version.in 2021-04-12 00:00:26 +00:00
GDB Administrator
37e43ac47b Automatic date update in version.in 2021-04-11 00:00:26 +00:00
GDB Administrator
d86882b2ab Automatic date update in version.in 2021-04-10 00:00:26 +00:00
GDB Administrator
7ab567f249 Automatic date update in version.in 2021-04-09 00:00:36 +00:00
GDB Administrator
0c5bba95b5 Automatic date update in version.in 2021-04-08 00:00:30 +00:00
GDB Administrator
ae13cfbbf5 Automatic date update in version.in 2021-04-07 00:00:38 +00:00
GDB Administrator
d7efdd505a Automatic date update in version.in 2021-04-06 00:00:27 +00:00
GDB Administrator
816bb2b5d0 Automatic date update in version.in 2021-04-05 00:00:31 +00:00
GDB Administrator
416378899e Automatic date update in version.in 2021-04-04 00:00:25 +00:00
GDB Administrator
1832ebfe68 Automatic date update in version.in 2021-04-03 00:00:25 +00:00
GDB Administrator
bd46cc054b Automatic date update in version.in 2021-04-02 00:00:32 +00:00
GDB Administrator
3f97a091c4 Automatic date update in version.in 2021-04-01 00:00:23 +00:00
GDB Administrator
fb587aeda1 Automatic date update in version.in 2021-03-31 00:00:26 +00:00
Simon Marchi
314d069cd6 gdb/dwarf: disable per-BFD resource sharing for -readnow objfiles
As described in PR 27541, we hit an internal error when loading a binary
the standard way and then loading it with the -readnow option:

    $ ./gdb -nx -q --data-directory=data-directory ~/a.out -ex "set confirm off" -ex "file -readnow ~/a.out"
    Reading symbols from /home/simark/a.out...
    Reading symbols from ~/a.out...
    /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8098: internal-error: void create_all_comp_units(dwarf2_per_objfile*): Assertion `per_objfile->per_bfd->all_comp_units.empty ()' failed.

This is a recurring problem that exposes a design issue in the DWARF
per-BFD sharing feature.  Things work well when loading a binary with
the same method (with/without index, with/without readnow) twice in a
row.  But they don't work so well when loading a binary with different
methods.  See this previous fix, for example:

    efb763a5ea ("gdb: check for partial symtab presence in dwarf2_initialize_objfile")

That one handled the case where the first load is normal (uses partial
symbols) and the second load uses an index.

The problem is that when loading an objfile with a method A, we create a
dwarf2_per_bfd and some dwarf2_per_cu_data and initialize them with the
data belonging to that method.  When loading another obfile sharing the
same BFD but with a different method B, it's not clear how to re-use the
dwarf2_per_bfd/dwarf2_per_cu_data previously created, because they
contain the data specific to method A.

I think the most sensible fix would be to not share a dwarf2_per_bfd
between two objfiles loaded with different methods.  That means that two
objfiles sharing the same BFD and loaded the same way would share a
dwarf2_per_bfd.  Two objfiles sharing the same BFD but loaded with
different methods would use two different dwarf2_per_bfd structures.

However, this isn't a trivial change.  So to fix the known issue quickly
(including in the gdb 10 branch), this patch just disables all
dwarf2_per_bfd sharing for objfiles using READNOW.

Generalize the gdb.base/index-cache-load-twice.exp test to test all
the possible combinations of loading a file with partial symtabs, index
and readnow.  Move it to gdb.dwarf2, since it really exercises features
of the DWARF reader.

gdb/ChangeLog:

	PR gdb/27541
	* dwarf2/read.c (dwarf2_has_info): Don't share dwarf2_per_bfd
	with objfiles using READNOW.

gdb/testsuite/ChangeLog:

	PR gdb/27541
	* gdb.base/index-cache-load-twice.exp: Remove.
	* gdb.base/index-cache-load-twice.c: Remove.
	* gdb.dwarf2/per-bfd-sharing.exp: New.
	* gdb.dwarf2/per-bfd-sharing.c: New.

Change-Id: I9ffcf1e136f3e75242f70e4e58e4ba1fd3083389
2021-03-30 13:37:56 -04:00
GDB Administrator
2b639bbbaa Automatic date update in version.in 2021-03-30 00:00:27 +00:00
GDB Administrator
6ca7d43588 Automatic date update in version.in 2021-03-29 00:00:23 +00:00
GDB Administrator
8726b997ba Automatic date update in version.in 2021-03-28 00:00:27 +00:00
GDB Administrator
8e219339f7 Automatic date update in version.in 2021-03-27 00:00:24 +00:00
GDB Administrator
9f8ac95928 Automatic date update in version.in 2021-03-26 00:00:26 +00:00
GDB Administrator
6a20cdb0af Automatic date update in version.in 2021-03-25 00:00:21 +00:00
GDB Administrator
5e0f8a51e9 Automatic date update in version.in 2021-03-24 00:00:28 +00:00
GDB Administrator
51077ff2f5 Automatic date update in version.in 2021-03-23 00:00:25 +00:00
GDB Administrator
3501b624ae Automatic date update in version.in 2021-03-22 00:00:31 +00:00
GDB Administrator
e22c0c5153 Automatic date update in version.in 2021-03-21 00:00:25 +00:00
GDB Administrator
4d6b822f36 Automatic date update in version.in 2021-03-20 00:00:16 +00:00
GDB Administrator
805ef76461 Automatic date update in version.in 2021-03-19 00:00:18 +00:00
GDB Administrator
762684cacc Automatic date update in version.in 2021-03-18 00:00:32 +00:00
GDB Administrator
7db48cc66a Automatic date update in version.in 2021-03-17 00:00:18 +00:00
GDB Administrator
fc9b4c828d Automatic date update in version.in 2021-03-16 00:00:27 +00:00
GDB Administrator
60fedf2ec5 Automatic date update in version.in 2021-03-15 00:00:32 +00:00
GDB Administrator
11a4913c8a Automatic date update in version.in 2021-03-14 00:00:23 +00:00
GDB Administrator
b061d44241 Automatic date update in version.in 2021-03-13 00:00:26 +00:00
Christian Biesinger
1ee63759b0 Use RAII to set the per-thread SIGSEGV handler
This avoids using a thread-local extern variable, which causes link errors
on some platforms, notably Cygwin.  But I think this is a better pattern
even outside of working around linker bugs because it encapsulates direct
access to the variable inside the class, instead of having a global extern
variable.

The cygwin link error is:
cp-support.o: in function `gdb_demangle(char const*, int)':
/home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-support.c:1619:(.text+0x6472): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `TLS init function for thread_local_segv_handler'
/home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-support.c:1619:(.text+0x648b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `TLS init function for thread_local_segv_handler'
collect2: error: ld returned 1 exit status

2021-03-12  Christian Biesinger  <cbiesinger@google.com>

	PR threads/27239
	* cp-support.c: Use scoped_segv_handler_restore.
	* event-top.c (thread_local_segv_handler): Made static.
	(scoped_segv_handler_restore::scoped_segv_handler_restore):
	New function.
	(scoped_segv_handler_restore::~scoped_segv_handler_restore): New
	function.
	* event-top.h (class scoped_segv_handler_restore): New class.
	(thread_local_segv_handler): Removed.
2021-03-12 11:27:04 -06:00
GDB Administrator
354d37286a Automatic date update in version.in 2021-03-12 00:00:32 +00:00
GDB Administrator
bb1f773386 Automatic date update in version.in 2021-03-11 00:00:33 +00:00
GDB Administrator
203e692fc1 Automatic date update in version.in 2021-03-10 00:00:43 +00:00
GDB Administrator
6427605cd4 Automatic date update in version.in 2021-03-09 00:00:40 +00:00
GDB Administrator
f260932cf5 Automatic date update in version.in 2021-03-08 00:00:39 +00:00
Tom de Vries
cdb986e09e [gdb/symtab] Fix element type modification in read_array_type
When running test-case gdb.fortran/function-calls.exp with target board
unix/gdb:debug_flags=-gdwarf-5, I run into:
...
(gdb) PASS: gdb.fortran/function-calls.exp: \
  p derived_types_and_module_calls::pass_cart(c)
p derived_types_and_module_calls::pass_cart_nd(c_nd)^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x0000000000400f73 in derived_types_and_module_calls::pass_cart_nd \
  (c=<error reading variable: Cannot access memory at address 0xc>) at \
  function-calls.f90:130^M
130             pass_cart_nd = ubound(c%d,1,4)^M
The program being debugged was signaled while in a function called from GDB.^M
GDB has restored the context to what it was before the call.^M
To change this behavior use "set unwindonsignal off".^M
Evaluation of the expression containing the function^M
(derived_types_and_module_calls::pass_cart_nd) will be abandoned.^M
(gdb) FAIL: gdb.fortran/function-calls.exp: p
...

The problem originates in read_array_type, when reading a DW_TAG_array_type
with a dwarf-5 DW_TAG_generic_subrange child.  This is not supported, and the
fallout of this is that rather than constructing a new array type, the code
proceeds to modify the element type.

Fix this conservatively by issuing a complaint and bailing out in
read_array_type when not being able to construct an array type, such that we
have:
...
(gdb) maint expand-symtabs function-calls.f90^M
During symbol reading: unable to find array range \
  - DIE at 0xe1e [in module function-calls]^M
During symbol reading: unable to find array range \
  - DIE at 0xe1e [in module function-calls]^M
(gdb) KFAIL: gdb.fortran/function-calls.exp: no complaints in srcfile \
  (PRMS: symtab/27388)
...

Tested on x86_64-linux.

gdb/ChangeLog:

2021-03-07  Tom de Vries  <tdevries@suse.de>

	PR symtab/27341
	* dwarf2/read.c (read_array_type): Return NULL when not being able to
	construct an array type.  Add assert to ensure that element_type is
	not being modified.

gdb/testsuite/ChangeLog:

2021-03-07  Tom de Vries  <tdevries@suse.de>

	PR symtab/27341
	* lib/gdb.exp (with_complaints): New proc, factored out of ...
	(gdb_load_no_complaints): ... here.
	* gdb.fortran/function-calls.exp: Add test-case.
2021-03-07 17:58:28 +01:00
Kevin Buettner
86bcfb117c Fix date in ChangeLog 2021-03-06 18:32:04 -07:00
GDB Administrator
a7656c7e60 Automatic date update in version.in 2021-03-07 00:00:44 +00:00
Kevin Buettner
4cacb69393 Fix aarch64-linux-hw-point.c build problem
Due to a recent glibc header file change, the file
nat/aarch64-linux-hw-point.c no longer builds on Fedora rawhide.

An enum for PTRACE_SYSEMU is now provided by <sys/ptrace.h>.  In the
past, PTRACE_SYSEMU was defined only in <asm/ptrace.h>.  This is
what it looks like...

In <asm/ptrace.h>:

 #define PTRACE_SYSEMU		  31

In <sys/ptrace.h>:

enum __ptrace_request
{
  ...
  PTRACE_SYSEMU = 31,
 #define PT_SYSEMU PTRACE_SYSEMU

  ...
}

When <asm/ptrace.h> and <sys/ptrace.h> are both included in a source
file, we run into the following build problem when the former is
included before the latter:

In file included from nat/aarch64-linux-hw-point.c:26:
/usr/include/sys/ptrace.h:86:3: error: expected identifier before numeric constant
   86 |   PTRACE_SYSEMU = 31,
      |   ^~~~~~~~~~~~~

(There are more errors after this one too.)

The file builds without error when <asm/ptrace.h> is included after
<sys/ptrace.h>.  I found that this is already done in
nat/aarch64-sve-linux-ptrace.h (which is included by
nat/aarch64-linux-ptrace.c).

I've tested this change on Fedora rawhide and Fedora 33, both
running on an aarch64 machine.

gdb/ChangeLog:

	PR build/27536
	* nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
	<sys/ptrace.h>.
2021-03-06 10:09:28 -07:00
Kevin Buettner
aebc4aa2ec amd64-linux-siginfo.c: Adjust include order to avoid gnulib error
On Fedora rawhide, after updating to glibc-2.33, I'm seeing the
following build failure:

  CXX    nat/amd64-linux-siginfo.o
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:315,
                 from ../gnulib/import/signal.h:52,
                 from /ironwood1/sourceware-git/rawhide-gnulib/bld/../../worktree-gnulib/gdbserver/../gdb/nat/amd64-linux-siginfo.c:20:
../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
  663 |  #error "Please include config.h first."
      |   ^~~~~

glibc-2.33 has changed signal.h to now include <bits/sigstksz.h> which,
in turn, includes <unistd.h>. For a gdb build, this causes the gnulib
version of unistd.h to be pulled in first.  The build failure shown
above happens because gnulib's config.h has not been included before
the include of <signal.h>.

The fix is simple - we just rearrange the order of the header file
includes to make sure that gdbsupport/commondefs.h is included before
attempting to include signal.h.  Note that gdbsupport/commondefs.h
includes <gnulib/config.h>.

Build and regression tested on Fedora 33.  On Fedora rawhide, GDB
builds again.

gdb/ChangeLog:

	PR build/27535
	* nat/amd64-linux-siginfo.c: Include "gdbsupport/common-defs.h"
	(which in turn includes <gnulib/config.h>) before include
	of <signal.h>.
2021-03-06 09:58:32 -07:00
Tom de Vries
df3ec334b8 [gdb/symtab] Handle DW_TAG_type_unit in process_psymtab_comp_unit
When running test-case gdb.cp/cpexprs-debug-types.exp with target board
unix/gdb:debug_flags=-gdwarf-5, I run into:
...
(gdb) file cpexprs-debug-types^M
Reading symbols from cpexprs-debug-types...^M
ERROR: Couldn't load cpexprs-debug-types into GDB (eof).
ERROR: Couldn't send delete breakpoints to GDB.
ERROR: GDB process no longer exists
GDB process exited with wait status 23054 exp9 0 0 CHILDKILLED SIGABRT SIGABRT
...

We're running into this abort in process_psymtab_comp_unit:
...
  switch (reader.comp_unit_die->tag)
    {
    case DW_TAG_compile_unit:
      this_cu->unit_type = DW_UT_compile;
      break;
    case DW_TAG_partial_unit:
      this_cu->unit_type = DW_UT_partial;
      break;
    default:
      abort ();
    }
...
because reader.comp_unit_die->tag == DW_TAG_type_unit.

Fix this by adding a DW_TAG_type_unit case.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

	PR symtab/27333
	* dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.

(cherry picked from commit e77b0004dd)
2021-03-06 10:34:13 +04:00
GDB Administrator
52a4867a01 Automatic date update in version.in 2021-03-06 00:00:27 +00:00
GDB Administrator
b507c0e4a1 Automatic date update in version.in 2021-03-05 00:00:36 +00:00
Simon Marchi
ffc17e2c02 gdb: set current thread in sparc_{fetch,collect}_inferior_registers (PR gdb/27147)
PR 27147 shows that on sparc64, GDB is unable to properly unwind:

Expected result (from GDB 9.2):

    #0  0x0000000000108de4 in puts ()
    #1  0x0000000000100950 in hello () at gdb-test.c:4
    #2  0x0000000000100968 in main () at gdb-test.c:8

Actual result (from GDB latest git):

    #0  0x0000000000108de4 in puts ()
    #1  0x0000000000100950 in hello () at gdb-test.c:4
    Backtrace stopped: previous frame inner to this frame (corrupt stack?)

The first failing commit is 5b6d1e4fa4 ("Multi-target support").  The cause
of the change in behavior is due to (thanks for Andrew Burgess for finding
this):

 - inferior_ptid is no longer set on entry of target_ops::wait, whereas
   it was set to something valid previously
 - deep down in linux_nat_target::wait (see stack trace below), we fetch
   the registers of the event thread
 - on sparc64, fetching registers involves reading memory (in
   sparc_supply_rwindow, see stack trace below)
 - reading memory (target_ops::xfer_partial) relies on inferior_ptid
   being set to the thread from which we want to read memory

This is where things go wrong:

    #0  linux_nat_target::xfer_partial (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x7feffe3b000 "", writebuf=0x0, offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3697
    #1  0x00000100007f5b10 in raw_memory_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:912
    #2  0x00000100007f60e8 in memory_xfer_partial_1 (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1043
    #3  0x00000100007f61b4 in memory_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, readbuf=0x7feffe3b000 "", writebuf=0x0, memaddr=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1072
    #4  0x00000100007f6538 in target_xfer_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x7feffe3b000 "", writebuf=0x0, offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1129
    #5  0x00000100007f7094 in target_read_partial (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7feffe3b000 "", offset=8791798050744, len=8, xfered_len=0x7feffe3ae88) at /home/simark/src/binutils-gdb/gdb/target.c:1375
    #6  0x00000100007f721c in target_read (ops=0x10000fa2c40 <the_sparc64_linux_nat_target>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7feffe3b000 "", offset=8791798050744, len=8) at /home/simark/src/binutils-gdb/gdb/target.c:1415
    #7  0x00000100007f69d4 in target_read_memory (memaddr=8791798050744, myaddr=0x7feffe3b000 "", len=8) at /home/simark/src/binutils-gdb/gdb/target.c:1218
    #8  0x0000010000758520 in sparc_supply_rwindow (regcache=0x10000fea4f0, sp=8791798050736, regnum=-1) at /home/simark/src/binutils-gdb/gdb/sparc-tdep.c:1960
    #9  0x000001000076208c in sparc64_supply_gregset (gregmap=0x10000be3190 <sparc64_linux_ptrace_gregmap>, regcache=0x10000fea4f0, regnum=-1, gregs=0x7feffe3b230) at /home/simark/src/binutils-gdb/gdb/sparc64-tdep.c:1974
    #10 0x0000010000751b64 in sparc_fetch_inferior_registers (regcache=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/sparc-nat.c:170
    #11 0x0000010000759d68 in sparc64_linux_nat_target::fetch_registers (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, regcache=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/sparc64-linux-nat.c:38
    #12 0x00000100008146ec in target_fetch_registers (regcache=0x10000fea4f0, regno=80) at /home/simark/src/binutils-gdb/gdb/target.c:3287
    #13 0x00000100006a8c5c in regcache::raw_update (this=0x10000fea4f0, regnum=80) at /home/simark/src/binutils-gdb/gdb/regcache.c:584
    #14 0x00000100006a8d94 in readable_regcache::raw_read (this=0x10000fea4f0, regnum=80, buf=0x7feffe3b7c0 "") at /home/simark/src/binutils-gdb/gdb/regcache.c:598
    #15 0x00000100006a93b8 in readable_regcache::cooked_read (this=0x10000fea4f0, regnum=80, buf=0x7feffe3b7c0 "") at /home/simark/src/binutils-gdb/gdb/regcache.c:690
    #16 0x00000100006b288c in readable_regcache::cooked_read<unsigned long, void> (this=0x10000fea4f0, regnum=80, val=0x7feffe3b948) at /home/simark/src/binutils-gdb/gdb/regcache.c:777
    #17 0x00000100006a9b44 in regcache_cooked_read_unsigned (regcache=0x10000fea4f0, regnum=80, val=0x7feffe3b948) at /home/simark/src/binutils-gdb/gdb/regcache.c:791
    #18 0x00000100006abf3c in regcache_read_pc (regcache=0x10000fea4f0) at /home/simark/src/binutils-gdb/gdb/regcache.c:1295
    #19 0x0000010000507920 in save_stop_reason (lp=0x10000fc5b10) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:2612
    #20 0x00000100005095a4 in linux_nat_filter_event (lwpid=520983, status=1407) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3050
    #21 0x0000010000509f9c in linux_nat_wait_1 (ptid=..., ourstatus=0x7feffe3c8f0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3194
    #22 0x000001000050b1d0 in linux_nat_target::wait (this=0x10000fa2c40 <the_sparc64_linux_nat_target>, ptid=..., ourstatus=0x7feffe3c8f0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3432
    #23 0x00000100007f8ac0 in target_wait (ptid=..., status=0x7feffe3c8f0, options=...) at /home/simark/src/binutils-gdb/gdb/target.c:2000
    #24 0x00000100004ac17c in do_target_wait_1 (inf=0x1000116d280, ptid=..., status=0x7feffe3c8f0, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3464
    #25 0x00000100004ac3b8 in operator() (__closure=0x7feffe3c678, inf=0x1000116d280) at /home/simark/src/binutils-gdb/gdb/infrun.c:3527
    #26 0x00000100004ac7cc in do_target_wait (wait_ptid=..., ecs=0x7feffe3c8c8, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3540
    #27 0x00000100004ad8c4 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:3880
    #28 0x0000010000485568 in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
    #29 0x000001000050d394 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
    #30 0x0000010000ab5c8c in handle_file_event (file_ptr=0x10001207270, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
    #31 0x0000010000ab6334 in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
    #32 0x0000010000ab487c in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
    #33 0x0000010000542668 in start_event_loop () at /home/simark/src/binutils-gdb/gdb/main.c:348
    #34 0x000001000054287c in captured_command_loop () at /home/simark/src/binutils-gdb/gdb/main.c:408
    #35 0x0000010000544e84 in captured_main (data=0x7feffe3d188) at /home/simark/src/binutils-gdb/gdb/main.c:1242
    #36 0x0000010000544f2c in gdb_main (args=0x7feffe3d188) at /home/simark/src/binutils-gdb/gdb/main.c:1257
    #37 0x00000100000c1f14 in main (argc=4, argv=0x7feffe3d548) at /home/simark/src/binutils-gdb/gdb/gdb.c:32

There is a target_read_memory call in sparc_supply_rwindow, whose return
value is not checked.  That call fails, because inferior_ptid does not
contain a valid ptid, and uninitialized buffer contents is used.
Ultimately it results in a corrupt stop_pc.

target_ops::fetch_registers can be (and should remain, in my opinion)
independent of inferior_ptid, because the ptid of the thread from which
to fetch registers can be obtained from the regcache.  In other words,
implementations of target_ops::fetch_registers should not rely on
inferior_ptid having a sensible value on entry.

The sparc64_linux_nat_target::fetch_registers case is special, because it calls
a target method that is dependent on the inferior_ptid value
(target_read_inferior, and ultimately target_ops::xfer_partial).  So I would
say it's the responsibility of sparc64_linux_nat_target::fetch_registers to set
up inferior_ptid correctly prior to calling target_read_inferior.

This patch makes sparc64_linux_nat_target::fetch_registers (and
store_registers, since it works the same) temporarily set inferior_ptid.  If we
ever make target_ops::xfer_partial independent of inferior_ptid, setting
inferior_ptid won't be necessary, we'll simply pass down the ptid as a
parameter in some way.

I chose to set/restore inferior_ptid in sparc_fetch_inferior_registers, because
I am not convinced that doing so in an inner location (in sparc_supply_rwindow
for instance) would always be correct.  We have access to the ptid in
sparc_supply_rwindow (from the regcache), so we _could_ set inferior_ptid
there.  However, I don't want to just set inferior_ptid, as that would make it
not desync'ed with `current_thread ()` and `current_inferior ()`.  It's
preferable to use switch_to_thread instead, as that switches all the global
"current" stuff in a coherent way.  But doing so requires a `thread_info *`,
and getting a `thread_info *` from a ptid requires a `process_stratum_target
*`.  We could use `current_inferior()->process_target()` in
sparc_supply_rwindow for this (using target_read_memory uses the current
inferior's target stack anyway).  However, sparc_supply_rwindow is also used in
the context of BSD uthreads, where a thread stratum target defines threads.  I
presume the ptid in the regcache would be the ptid of the uthread, defined by
the thread stratum target (bsd_uthread_target).  Using
`current_inferior()->process_target()` would look up a ptid defined by the
thread stratum target using the process stratum target.  I don't think it would
give good results.  So I prefer playing it safe and looking up the thread
earlier, in sparc_fetch_inferior_registers.

I added some assertions (in sparc_supply_rwindow and others) to verify
that the regcache's ptid matches inferior_ptid.  That verifies that the
caller has properly set the correct global context.  This would have
caught (though a failed assertion) the current problem.

gdb/ChangeLog:

	PR gdb/27147
	* sparc-nat.h (sparc_fetch_inferior_registers): Add
	process_stratum_target parameter,
	sparc_store_inferior_registers): update callers.
	* sparc-nat.c (sparc_fetch_inferior_registers,
	sparc_store_inferior_registers): Add process_stratum_target
	parameter.  Switch current thread before calling
	sparc_supply_gregset / sparc_collect_rwindow.
	(sparc_store_inferior_registers): Likewise.
	* sparc-obsd-tdep.c (sparc32obsd_supply_uthread): Add assertion.
	(sparc32obsd_collect_uthread): Likewise.
	* sparc-tdep.c (sparc_supply_rwindow, sparc_collect_rwindow):
	Add assertion.
	* sparc64-obsd-tdep.c (sparc64obsd_collect_uthread,
	sparc64obsd_supply_uthread): Add assertion.

Change-Id: I16c658cd70896cea604516714f7e2428fbaf4301
2021-03-04 11:07:40 -05:00
GDB Administrator
3526b862cb Automatic date update in version.in 2021-03-04 00:00:31 +00:00
GDB Administrator
17c518fa1b Automatic date update in version.in 2021-03-03 00:00:35 +00:00
GDB Administrator
94f0ef5d31 Automatic date update in version.in 2021-03-02 00:00:41 +00:00
GDB Administrator
ba5745709d Automatic date update in version.in 2021-03-01 00:00:50 +00:00
GDB Administrator
3fd24a87a1 Automatic date update in version.in 2021-02-28 00:00:25 +00:00
GDB Administrator
d00f8af8c3 Automatic date update in version.in 2021-02-27 00:00:32 +00:00
GDB Administrator
04e2525cd0 Automatic date update in version.in 2021-02-26 00:00:31 +00:00
Simon Marchi
962ba37a92 gdb: relax assertion in target_mourn_inferior
As reported in PR 26861, when killing an inferior on macOS, we hit the
assert:

    ../../gdb-10.1/gdb/target.c:2149: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.

This is because darwin_nat_target::kill passes a pid-only ptid to
target_mourn_inferior, with the pid of the current inferior:

    target_mourn_inferior (ptid_t (inf->pid));

... which doesn't satisfy the assert in target_mourn_inferior:

    gdb_assert (ptid == inferior_ptid);

The reason for this assertion is that target_mourn_inferior is a
prototype shared between GDB and GDBserver, so that shared code in
gdb/nat (used in both GDB and GDBserver) can call target_mourn_inferior.
In GDB's implementation, it is likely that some targets still rely on
inferior_ptid being set to "the current thread we are working on".  So
until targets are completely decoupled from inferior_ptid (at least
their mourn_inferior implementations), we need to ensure the passed in
ptid matches inferior_ptid, to ensure the calling code called
target_mourn_inferior with the right global context.

However, I think the assert is a bit too restrictive.  The
mourn_inferior operation works on an inferior, not a specific thread.
And by the time we call mourn_inferior, the threads of the inferior
don't exist anymore, the process is gone, so it doesn't really make
sense to require inferior_ptid to point a specific thread.

I looked at all the target_ops::mourn_inferior implementations, those
that read inferior_ptid only care about the pid field, which supports
the idea that only the inferior matters.  Other implementations look at
the current inferior (call `current_inferior ()`).

I think it would make sense to change target_mourn_inferior to accept
only a pid rather than a ptid.  It would then assert that the pid is the
same as the current inferior's pid.  However, this would be a quite
involved change, so I'll keep it for later.

To fix the macOS issue immediately, I propose to relax the assert to
only compare the pids, as is done in this patch.

Another solution would obviously be to make darwin_nat_target::kill pass
inferior_ptid to target_mourn_inferior.  However, the solution I propose
is more in line with where I think we want to go (passing a pid to
target_mourn_inferior).

gdb/ChangeLog:

	PR gdb/26861
	* target.c (target_mourn_inferior): Only compare pids in
	target_mourn_inferior.

Change-Id: If2439ccc5aa67272ea16148a43c5362ef23fb2b8
2021-02-25 15:53:18 -05:00
GDB Administrator
de4e5d0886 Automatic date update in version.in 2021-02-25 00:00:34 +00:00
GDB Administrator
e94ea07548 Automatic date update in version.in 2021-02-24 00:00:31 +00:00
Simon Marchi
ad4eb5acba gdb/dwarf: create and destroy dwarf2_per_bfd's CUs-to-expand queue
As described in the log of patch "gdb/dwarf: add assertion in
maybe_queue_comp_unit", it would happen that a call to
maybe_queue_comp_unit would enqueue a CU in the to-expand queue while
nothing up the stack was processing the queue.  This is not desirable,
as items are then left lingering in the queue when we exit the
dwarf2/read code.  This is an inconsistent state.

The normal case of using the queue is when we go through
dw2_do_instantiate_symtab and process_queue.  As depended-on CUs are
found, they get added to the queue.  process_queue expands CUs until the
queue is empty.

To catch these cases where things are enqueued while nothing up the
stack is processing the queue, change dwarf2_per_bfd::queue to be an
optional.  The optional is instantiated in dwarf2_queue_guard, just
before where we call process_queue.  In the dwarf2_queue_guard
destructor, the optional gets reset.  Therefore, the queue object is
instantiated only when something up the stack is handling it.  If
another entry point tries to enqueue a CU for expansion, an assertion
will fail and we know we have something to fix.

dwarf2_queue_guard sounds like the good place for this, as it's
currently responsible for making sure the queue gets cleared if we exit
due to an error.

This also allows asserting that when age_comp_units or remove_all_cus
run, the queue is not instantiated, and gives us one more level of
assurance that we won't free the DIEs of a CU that is in the
CUs-to-expand queue.

gdb/ChangeLog:

	PR gdb/26828
	* dwarf2/read.c (dwarf2_queue_guard) <dwarf2_queue_guard>:
	Instantiate queue.
	(~dwarf2_queue_guard): Clear queue.
	(queue_comp_unit): Assert that queue is
	instantiated.
	(process_queue): Adjust.
	* dwarf2/read.h (struct dwarf2_per_bfd) <queue>: Make optional.

Change-Id: I8fe3d77845bb4ad3d309eac906acebe79d9f0a9d
2021-02-23 13:48:19 -05:00
Simon Marchi
1c8a25b683 gdb/dwarf: don't enqueue CU in maybe_queue_comp_unit if already expanded
The previous commit log described how items could be left lingering in
the dwarf2_per_bfd::queue and how that could cause trouble.

This patch fixes the issue by changing maybe_queue_comp_unit so that it
doesn't put a CU in the to-expand queue if that CU is already expanded.
This will make it so that when dwarf2_fetch_die_type_sect_off calls
follow_die_offset and maybe_queue_comp_unit, it won't enqueue the target
CU, because it will see the CU is already expanded.

This assumes that if a CU is dwarf2_fetch_die_type_sect_off's target CU,
it will have previously been expanded.  I think it is the case, but I
can't be 100% sure.  If that's not true, the assertions added in the
following patch will catch it, and it means we'll have to re-think a bit
more how things work (it wouldn't be well handled at all today anyway).

This fixes something else in maybe_queue_comp_unit that looks wrong.
Imagine the DIEs of a CU are loaded in memory, but that CU is not
expanded.  In that case, maybe_queue_comp_unit will use this early
return:

  /* If the compilation unit is already loaded, just mark it as
     used.  */
  dwarf2_cu *cu = per_objfile->get_cu (per_cu);
  if (cu != nullptr)
    {
      cu->last_used = 0;
      return 0;
    }

... so the CU won't be queued for expansion.  Whether the DIEs of a CU
are loaded in memory and whether that CU is expanded are two orthogonal
things, but that function appears to mix them.  So, move the queuing
above that check / early return, so that if the CU's DIEs are loaded in
memory but the CU is not expanded yet, it gets enqueued.

I tried to improve maybe_queue_comp_unit's documentation to clarify what
the return value means.  By clarifying this, I noticed that two callers
(follow_die_offset and follow_die_sig_1) access the CU's DIEs after
calling maybe_queue_comp_unit, only relying on maybe_queue_comp_unit's
return value to tell whether DIEs need to be loaded first or not.  As
explained in the new comment, this is problematic:
maybe_queue_comp_unit's return value doesn't tell whether DIEs are
currently loaded, it means whether maybe_queue_comp_unit requires the
caller to load them.  If the CU is already expanded but the DIEs to have
been freed, maybe_queue_comp_unit returns 0, meaning "I don't need you
to load the DIEs".  So if these two functions (follow_die_offset and
follow_die_sig_1) need to access the DIEs in any case, for their own
usage, they should make sure to load them if they are not loaded
already.  I therefore added an extra check to the condition they use,
making it so they will always load the DIEs if they aren't already.

From what I found, other callers don't care for the CU's DIEs, they call
maybe_queue_comp_unit to ensure the CU gets expanded eventually, but
don't care for it after that.

gdb/ChangeLog:

	PR gdb/26828
	* dwarf2/read.c (maybe_queue_comp_unit): Check if CU is expanded
	to decide whether or not to enqueue it for expansion.
	(follow_die_offset, follow_die_sig_1): Ensure we load the DIEs
	after calling maybe_queue_comp_unit.

Change-Id: Id98c6b60669f4b4b21b9be16d0518fc62bdf686a
2021-02-23 13:45:51 -05:00
GDB Administrator
aa6592f515 Automatic date update in version.in 2021-02-23 00:00:26 +00:00
Simon Marchi
2907db7e77 gdb: push target earlier in procfs_target::attach (PR 27435)
Since this is a GDB 9 -> 10 regression, I would like to push it to
gdb-10-branch.

This is a follow-up to:

  https://sourceware.org/pipermail/gdb-patches/2021-February/176202.html

This patch fixes a segfault seen when attaching to a process on Solaris.
The steps leading to the segfault are:

 - procfs_target::attach calls do_attach, at this point the inferior's
   process slot in the target stack is empty.
 - do_attach adds a thread with `add_thread (&the_procfs_target, ptid)`
 - in add_thread_silent, the passed target (&the_procfs_target) is
   passed to find_inferior_ptid
 - find_inferior_ptid returns nullptr, as there is no inferior with this
   ptid that has &the_procfs_target as its process target
 - the nullptr `inf` is passed to find_thread_ptid, which dereferences
   it, causing a segfault
 - back in procfs_target::attach, after do_attach, we push the
   the_procfs_target on the inferior's target stack, although we never
   reach this because the segfault happens before.

To fix this, I think we need to do the same as is done in
inf_ptrace_target::attach: push the target early and unpush it in case
the attach fails (and keep it if the attach succeeds).

Implement it by moving target_unpush_up to target.h, so it can be
re-used here.  Make procfs_target::attach use it.  Note that just like
is mentioned in inf_ptrace_target::attach, we should push the target
before calling target_pid_to_str, so that calling target_pid_to_str ends
up in procfs_target::pid_to_str.

Tested by trying to attach on a process on gcc211 on the gcc compile
farm.

gdb/ChangeLog:

	PR gdb/27435
	* inf-ptrace.c (struct target_unpusher): Move to target.h.
	(target_unpush_up): Likewise.
	* procfs.c (procfs_target::attach): Push target early.  Use
	target_unpush_up to unpush target in case of error.
	* target.h (struct target_unpusher): Move here.
	(target_unpush_up): Likewise.

Change-Id: I88aff8b20204e1ca1d792e27ac6bc34fc1aa0d52
2021-02-22 11:43:40 -05:00
GDB Administrator
44da9f63e1 Automatic date update in version.in 2021-02-22 00:00:29 +00:00
GDB Administrator
4271e70d39 Automatic date update in version.in 2021-02-21 00:00:26 +00:00
GDB Administrator
3b192a4ff1 Automatic date update in version.in 2021-02-20 00:00:33 +00:00
GDB Administrator
d45dd78e4c Automatic date update in version.in 2021-02-19 00:00:32 +00:00
GDB Administrator
2c47dea327 Automatic date update in version.in 2021-02-18 00:00:54 +00:00
GDB Administrator
cf877e6b71 Automatic date update in version.in 2021-02-17 00:00:32 +00:00
GDB Administrator
5102c507de Automatic date update in version.in 2021-02-16 00:00:31 +00:00
GDB Administrator
0783554565 Automatic date update in version.in 2021-02-15 00:00:23 +00:00
GDB Administrator
fec94df9b5 Automatic date update in version.in 2021-02-14 00:00:23 +00:00
GDB Administrator
924c60ee7c Automatic date update in version.in 2021-02-13 00:00:23 +00:00
GDB Administrator
aa20553024 Automatic date update in version.in 2021-02-12 00:00:33 +00:00
GDB Administrator
548cc50426 Automatic date update in version.in 2021-02-11 00:00:26 +00:00
GDB Administrator
4afc066f0a Automatic date update in version.in 2021-02-10 00:00:39 +00:00
Shahab Vahedi
15e1376fea arc: Fix gcc-4.8 compilation failure for arc.c
Building an arc target:

$ configulre --target=arc-elf32                \
             --enable-targets=arc-linux-uclibc \
	     ...

On a system with gcc-4.8 (CentOS 7.x), fails with:
--------8<---------
../../gdb/arch/arc.c:117:43:   required from here
/usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: error: no matching
function for call to 'std::pair<const arc_arch_features, const
std::unique_ptr<target_desc, target_desc_deleter> >::pair(const
arc_arch_features&, target_desc*&)'
  : _M_v(std::forward<_Args>(__args)...) { }
                                       ^
/usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: note: candidates are:
In file included from /usr/include/c++/4.8.2/utility:70:0,
                 from /usr/include/c++/4.8.2/tuple:38,
                 from /usr/include/c++/4.8.2/functional:55,
                 from ../../gdb/../gdbsupport/ptid.h:35,
                 from ../../gdb/../gdbsupport/common-defs.h:123,
                 from ../../gdb/arch/arc.c:19:
/usr/include/c++/4.8.2/bits/stl_pair.h:206:9: note: template<class ...
_Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int
..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&,
std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>,
std::_Index_tuple<_Indexes2 ...>)
         pair(tuple<_Args1...>&, tuple<_Args2...>&,
         ^
-------->8---------

The corresponding line in arc.c must use an explicit ctor:
--------8<---------
 arc_lookup_target_description (...)
 {

   /* Add the newly created target description to the repertoire.  */
-  arc_tdesc_cache.emplace (features, tdesc);
+  arc_tdesc_cache.emplace (features, target_desc_up (tdesc));

   return tdesc;
 }
-------->8---------
See "PR gcc/96537" for more details.

Last but not least, this problem has originally been investigated
by Tom de Vries for RISCV targets (see 38f8aa06d9).

gdb/ChangeLog:

	PR build/27385
	* arch/arc.c (arc_lookup_target_description): Use
	target_desc_up() ctor explicitly.
2021-02-09 18:38:35 +01:00
GDB Administrator
7d375ca308 Automatic date update in version.in 2021-02-09 00:00:35 +00:00
Shahab Vahedi
d8979e81fd gdb: Do not interrupt atomic sequences for ARC
When stepping over thread-lock related codes (in uClibc), the inferior process
gets stuck and never manages to enter the critical section:

------8<-------
 1 size_t fwrite(const void * __restrict ptr, size_t size,
 2               size_t nmemb, register FILE * __restrict stream)
 3 {
 4     size_t retval;
 5     __STDIO_AUTO_THREADLOCK_VAR;
 6
 7 >   __STDIO_AUTO_THREADLOCK(stream);
 8
 9     retval = fwrite_unlocked(ptr, size, nmemb, stream);
10
11     __STDIO_AUTO_THREADUNLOCK(stream);
12
13     return retval;
14 }
------>8-------

Here, we are at line 7.  Using the "next" command leads no where.
However, setting a breakpoint on line 9 and issuing "continue" works.

Looking at the assembly instructions reveals that we're dealing with the
critical section entry code [1] that should never be interrupted, in this
case by the debugger's implicit breakpoints:

------8<-------
  ...
1 add_s   r0,r13,0x38
2 mov_s   r3,1
3 llock   r2,[r0]        <-.
4 brne.nt r2,0,14     --.  |
5 scond   r3,[r0]       |  |
6 bne     -10         --|--'
7 brne_s  r2,0,84     <-'
  ...
------>8-------

Lines 3 until 5 (inclusive) are supposed to be executed atomically.
Therefore, GDB should never (implicitly) insert a breakpoint on lines
4 and 5, else the program will try to acquire the lock again by jumping
back to line 3 and gets stuck in an infinite loop.

The solution is to make GDB aware of these patterns so it inserts
breakpoints after the sequence -- line 6 in this example.

[1]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/bits/atomic.h#n46
------8<-------
  ({									\
	__typeof(oldval) prev;						\
									\
	__asm__ __volatile__(						\
	"1:	llock   %0, [%1]	\n"				\
	"	brne    %0, %2, 2f	\n"				\
	"	scond   %3, [%1]	\n"				\
	"	bnz     1b		\n"				\
	"2:				\n"				\
	: "=&r"(prev)							\
	: "r"(mem), "ir"(oldval),					\
	  "r"(newval) /* can't be "ir". scond can't take limm for "b" */\
	: "cc", "memory");						\
									\
	prev;								\
  })
------>8-------
"llock" (Load Locked) loads the 32-bit word pointed by the source
operand.  If the load is completed without any interruption or
exception, the physical address is remembered, in Lock Physical Address
(LPA), and the Lock Flag (LF) is set to 1.  LF is a non-architecturally
visible flag and is cleared whenever an interrupt or exception takes
place.  LF is also cleared (atomically) whenever another process writes
to the LPA.

"scond" (Store Conditional) will write to the destination address if
and only if the LF is set to 1.  When finished, with or without a write,
it atomically copies the LF value to ZF (Zero Flag).

These two instructions together provide the mechanism for entering a
critical section.  The code snippet above comes from uClibc:
-----------------------

v3 (after Tom's remarks[2]):
 handle_atomic_sequence()
  - no need to initialize the std::vector with "{}"
  - fix typo in comments: "conditial" -> "conditional"
  - add braces to the body of "if" condition because of the comment line
 arc_linux_software_single_step()
  - make the performance slightly more efficient by moving a few
    variables after the likely "return" point.

v2 (after Simon's remarks[3]):
- handle_atomic_sequence() gets a copy of an instruction instead of
  a reference.
- handle_atomic_sequence() asserts if the given instruction is an llock.

[2]
https://sourceware.org/pipermail/gdb-patches/2021-February/175805.html

[3]
https://sourceware.org/pipermail/gdb-patches/2021-January/175487.html

gdb/ChangeLog:

	PR tdep/27369
	* arc-linux-tdep.c (handle_atomic_sequence): New.
	(arc_linux_software_single_step): Call handle_atomic_sequence().
2021-02-08 13:11:44 +01:00
GDB Administrator
770b89e3aa Automatic date update in version.in 2021-02-08 00:00:21 +00:00
GDB Administrator
be60078888 Automatic date update in version.in 2021-02-07 00:00:22 +00:00
GDB Administrator
2ad61d8c29 Automatic date update in version.in 2021-02-06 00:00:24 +00:00
Tom de Vries
a1cf3cf356 [gdb/breakpoints] Handle glibc with debuginfo in create_exception_master_breakpoint
The test-case nextoverthrow.exp is failing on targets with unstripped libc.

This is a regression since commit 1940319c0e "[gdb] Fix internal-error in
process_event_stop_test".

The problem is that this code in create_exception_master_breakpoint:
...
      for (objfile *sepdebug = obj->separate_debug_objfile;
      	   sepdebug != nullptr; sepdebug = sepdebug->separate_debug_objfile)
        if (create_exception_master_breakpoint_hook (sepdebug))
...
iterates over all the separate debug object files, but fails to handle the
case that obj itself has the debug info we're looking for.

Fix this by using the separate_debug_objfiles () range instead, which does
iterate both over obj and the obj->separate_debug_objfile chain.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-02-05  Tom de Vries  <tdevries@suse.de>

	PR breakpoints/27330
	* breakpoint.c (create_exception_master_breakpoint): Handle case that
	glibc object file has debug info.
2021-02-05 20:54:39 +01:00
GDB Administrator
e1a808d134 Automatic date update in version.in 2021-02-05 00:00:28 +00:00
GDB Administrator
e1591e85dc Automatic date update in version.in 2021-02-04 00:00:22 +00:00
Simon Marchi
2da8a05a92 gdb/testsuite: add test for .debug_{rng,loc}lists section without offset array
It is possible for the tables in the .debug_{rng,loc}lists sections to
not have an array of offsets.  In that case, the offset_entry_count
field of the header is 0.  The forms DW_FORM_{rng,loc}listx (reference
by index) can't be used with that table.  Instead, the
DW_FORM_sec_offset form, which references a {rng,loc}list by direct
offset in the section, must be used.  From what I saw, this is what GCC
currently produces.

Add tests for this case.  I didn't see any bug related to this, I just
think that it would be nice to have coverage for this. A new
`-with-offset-array` option is added to the `table` procs, used when
generating {rng,loc}lists, to decide whether to generate the offset
array.

gdb/testsuite/ChangeLog:

	* lib/dwarf.exp (rnglists): Add -no-offset-array option to
	table proc.
	* gdb.dwarf2/rnglists-sec-offset.exp: Add test for
	.debug_rnglists table without offset array.
	* gdb.dwarf2/loclists-sec-offset.exp: Add test for
	.debug_loclists table without offset array.

Change-Id: I8e34a7bf68c9682215ffbbf66600da5b7db91ef7
2021-02-03 10:32:43 -05:00
Simon Marchi
c974ecf55d gdb/testsuite: add .debug_loclists tests
Add tests for the various issues fixed in the previous patches.

Add a new "loclists" procedure to the DWARF assembler, to allow
generating .debug_loclists sections.

gdb/testsuite/ChangeLog:

	PR gdb/26813
	* lib/dwarf.exp (_handle_DW_FORM): Handle DW_FORM_loclistx.
	(loclists): New proc.
	* gdb.dwarf2/loclists-multiple-cus.c: New.
	* gdb.dwarf2/loclists-multiple-cus.exp: New.
	* gdb.dwarf2/loclists-sec-offset.c: New.
	* gdb.dwarf2/loclists-sec-offset.exp: New.

Change-Id: I209bcb2a9482762ae943e518998d1f7761f76928
2021-02-03 10:31:47 -05:00
Simon Marchi
9b92ac3564 gdb/testsuite: DWARF assembler: add context parameters to _location
The _location proc is used to assemble a location description.  It needs
to know some contextual information:

- size of an address
- size of an offset (into another DWARF section)
- DWARF version

It currently get all this directly from global variables holding the
compilation unit information.  This is fine because as of now, all
location descriptions are generated in the context of creating a
compilation unit.  However, a subsequent patch will generate location
descriptions while generating a .debug_loclists section.  _location
should therefore no longer rely on the current compilation unit's
properties.

Change it to accept these values as parameters instead of accessing the
values for the CU.

No functional changes intended.

gdb/testsuite/ChangeLog:

	* lib/dwarf.exp (_location): Add parameters.
	(_handle_DW_FORM): Adjust.

Change-Id: Ib94981979c83ffbebac838081d645ad71c221637
2021-02-03 10:01:18 -05:00
Simon Marchi
908d9586a6 gdb/testsuite: add .debug_rnglists tests
Add tests for the various issues fixed in the previous patches.

Add a new "rnglists" procedure to the DWARF assembler, to allow
generating .debug_rnglists sections.  A trivial change is required to
support the DWARF 5 CU header layout.

gdb/testsuite/ChangeLog:

	PR gdb/26813
	* lib/dwarf.exp (_handle_DW_FORM): Handle DW_FORM_rnglistx.
	(cu): Generate header for DWARF 5.
	(rnglists): New proc.
	* gdb.dwarf2/rnglists-multiple-cus.exp: New.
	* gdb.dwarf2/rnglists-sec-offset.exp: New.

Change-Id: I5b297e59c370c60cf671dec19796a6c3b9a9f632
2021-02-03 10:01:12 -05:00
Simon Marchi
1211342072 gdb/dwarf: read correct rnglist/loclist header in read_{rng,loc}list_index
When loading the binary from PR 26813 in GDB, we get:

    DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array [in module /home/simark/build/binutils-gdb/gdb/MagicPurse]

... and the symbols fail to load.

In read_rnglist_index and read_loclist_index, we read the header
(documented in sections 7.28 and 7.29 of DWARF 5) of the CU's
contribution to the .debug_rnglists / .debug_loclists sections to
validate that the index we want to read makes sense.  However, we always
read the header at the beginning of the section, rather than the header
for the contribution from which we want to read the index.

To illustrate, here's what the binary from PR 26813 contains.  There are
two compile units:

0x0000000c: DW_TAG_compile_unit 1
              DW_AT_ranges [DW_FORM_rnglistx]: 0x0
              DW_AT_rnglists_base [DW_FORM_sec_offset]: 0xC

0x00003ec9: DW_TAG_compile_unit 2
              DW_AT_ranges [DW_FORM_rnglistx]: 0xB
              DW_AT_rnglists_base [DW_FORM_sec_offset]: 0x85

The layout of the .debug_rnglists is the following:

    [0x00, 0x0B]: header for CU 1's contribution
    [0x0C, 0x0F]: list of offsets for CU 1 (1 element)
    [0x10, 0x78]: range lists data for CU 1

    [0x79, 0x84]: header for CU 2's contribution
    [0x85, 0xB4]: list of offsets for CU 2 (12 elements)
    [0xB5, 0xBD7]: range lists data for CU 2

The DW_AT_rnglists_base attrbute points to the beginning of the list of
offsets for that CU, relative to the start of the .debug_rnglists
section.  That's right after the header for that contribution.

When we try to read the DW_AT_ranges attribute for CU 2,
read_rnglist_index reads the header for CU 1 instead of the one for CU
2.  Since there's only one element in CU 1's offset list, it believes
(wrongfully) that the index 0xB is out of range.

Fix it by reading the header just before where DW_AT_rnglists_base
points to.  With this patch, I am able to load GDB built with clang-11
and -gdwarf-5 in itself, with and without -readnow.

gdb/ChangeLog:

	PR gdb/26813
	* dwarf2/read.c (read_loclists_rnglists_header): Add
	header_offset parameter and use it.
	(read_loclist_index): Read header of the current contribution,
	not the one at the beginning of the section.
	(read_rnglist_index): Likewise.

Change-Id: Ie53ff8251af8c1556f0a83a31aa8572044b79e3d
2021-02-03 10:00:48 -05:00
Simon Marchi
21ef610906 gdb/dwarf: add missing bound check to read_loclist_index
read_rnglist_index has a bound check to make sure that we don't go past
the end of the section while reading the offset, but read_loclist_index
doesn't.  Add it to read_loclist_index.

gdb/ChangeLog:

	* dwarf2/read.c (read_loclist_index): Add bound check for the end
	of the offset.

Change-Id: Ic4b55c88860fdc3e007740949c78ec84cdb4da60
2021-02-03 09:52:42 -05:00
Simon Marchi
39658ce654 gdb/dwarf: fix bound check in read_rnglist_index
I think this check in read_rnglist_index is wrong:

      /* Validate that reading won't go beyond the end of the section.  */
      if (start_offset + cu->header.offset_size > rnglist_base + section->size)
        error (_("Reading DW_FORM_rnglistx index beyond end of"
                 ".debug_rnglists section [in module %s]"),
               objfile_name (objfile));

The addition `rnglist_base + section->size` doesn't make sense.
rnglist_base is an offset into `section`, so it doesn't make sense to
add it to `section`'s size.  `start_offset` also is an offset into
`section`, so we should just compare it to just `section->size`.

gdb/ChangeLog:

	* dwarf2/read.c (read_rnglist_index): Fix bound check.

Change-Id: If0ff7c73f4f80f79aac447518f4e8f131f2db8f2
2021-02-03 09:52:04 -05:00
Simon Marchi
767fbfe95e gdb/dwarf: change read_loclist_index complaints into errors
Unlike read_rnglists_index, read_loclist_index uses complaints when it
detects an inconsistency (a DW_FORM_loclistx value without a
.debug_loclists section or an offset outside of the section).  I really
think they should be errors, since there's no point in continuing if
this situation happens, we will likely segfault or read garbage.

gdb/ChangeLog:

	* dwarf2/read.c (read_loclist_index): Change complaints into
	errors.

Change-Id: Ic3a1cf6e682d47cb6e739dd76fd7ca5be2637e10
2021-02-03 09:51:49 -05:00
GDB Administrator
288ff897b1 Automatic date update in version.in 2021-02-03 00:00:17 +00:00
GDB Administrator
9d21b05676 Automatic date update in version.in 2021-02-02 00:00:23 +00:00
GDB Administrator
83d5d47a5a Automatic date update in version.in 2021-02-01 00:00:24 +00:00
GDB Administrator
93219218fd Automatic date update in version.in 2021-01-31 00:00:32 +00:00
GDB Administrator
7ab9b78176 Automatic date update in version.in 2021-01-30 00:00:20 +00:00
GDB Administrator
a32952edde Automatic date update in version.in 2021-01-29 00:00:17 +00:00
GDB Administrator
1c66b95070 Automatic date update in version.in 2021-01-28 00:00:24 +00:00
GDB Administrator
d459c23b8f Automatic date update in version.in 2021-01-27 00:00:24 +00:00
GDB Administrator
1cdf95e6f1 Automatic date update in version.in 2021-01-26 00:00:24 +00:00
GDB Administrator
6b6b2d104b Automatic date update in version.in 2021-01-25 00:00:25 +00:00
GDB Administrator
7f6d881f34 Automatic date update in version.in 2021-01-24 00:00:20 +00:00
GDB Administrator
b0b98f533b Automatic date update in version.in 2021-01-23 00:00:23 +00:00
GDB Administrator
4d5f61fa3b Automatic date update in version.in 2021-01-22 00:00:30 +00:00
GDB Administrator
345fde490c Automatic date update in version.in 2021-01-21 00:00:41 +00:00
GDB Administrator
b4bd1a9565 Automatic date update in version.in 2021-01-20 00:00:37 +00:00
GDB Administrator
b9e813d879 Automatic date update in version.in 2021-01-19 00:00:43 +00:00
GDB Administrator
0b9cf185f6 Automatic date update in version.in 2021-01-18 00:00:30 +00:00
GDB Administrator
09bc0e8c72 Automatic date update in version.in 2021-01-17 00:00:26 +00:00
Eduard-Mihai Burtescu
f42f69f6f3 libiberty: Support the new ("v0") mangling scheme in rust-demangle
This is the libiberty (mainly for binutils/gdb) counterpart of
https://github.com/alexcrichton/rustc-demangle/pull/23.

Relevant links for the new Rust mangling scheme (aka "v0"):
* Rust RFC: https://github.com/rust-lang/rfcs/pull/2603
* tracking issue: https://github.com/rust-lang/rust/issues/60705
* implementation: https://github.com/rust-lang/rust/pull/57967

This implementation includes full support for UTF-8 identifiers
via punycode, so I've included a testcase for that as well.

libiberty/ChangeLog
2021-01-16  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

	* rust-demangle.c (struct rust_demangler): Add
	skipping_printing and bound_lifetime_depth fields.
	(eat): Add (v0-only).
	(parse_integer_62): Add (v0-only).
	(parse_opt_integer_62): Add (v0-only).
	(parse_disambiguator): Add (v0-only).
	(struct rust_mangled_ident): Add punycode{,_len} fields.
	(parse_ident): Support v0 identifiers.
	(print_str): Respect skipping_printing.
	(print_uint64): Add (v0-only).
	(print_uint64_hex): Add (v0-only).
	(print_ident): Respect skipping_printing,
	Support v0 identifiers.
	(print_lifetime_from_index): Add (v0-only).
	(demangle_binder): Add (v0-only).
	(demangle_path): Add (v0-only).
	(demangle_generic_arg): Add (v0-only).
	(demangle_type): Add (v0-only).
	(demangle_path_maybe_open_generics): Add (v0-only).
	(demangle_dyn_trait): Add (v0-only).
	(demangle_const): Add (v0-only).
	(demangle_const_uint): Add (v0-only).
	(basic_type): Add (v0-only).
	(rust_demangle_callback): Support v0 symbols.
	* testsuite/rust-demangle-expected: Add v0 testcases.
2021-01-16 10:25:55 -07:00
GDB Administrator
a6006e11b4 Automatic date update in version.in 2021-01-16 00:00:29 +00:00
GDB Administrator
43626e8c2c Automatic date update in version.in 2021-01-15 00:00:33 +00:00
GDB Administrator
944a82cd87 Automatic date update in version.in 2021-01-14 00:00:31 +00:00
GDB Administrator
81c1122fe7 Automatic date update in version.in 2021-01-13 00:00:25 +00:00
GDB Administrator
4549169861 Automatic date update in version.in 2021-01-12 00:00:22 +00:00
GDB Administrator
d40664e961 Automatic date update in version.in 2021-01-11 00:00:18 +00:00
GDB Administrator
435bbaa6b7 Automatic date update in version.in 2021-01-10 00:00:21 +00:00
GDB Administrator
126cd362c4 Automatic date update in version.in 2021-01-09 00:00:18 +00:00
Tom de Vries
360ecc5313 [gdb] Fix internal-error in process_event_stop_test
The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile.  It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
   for (objfile *objfile : current_program_space->objfiles ())
     {
        /* Try using probes.  */
        if (/* successful */)
          continue;

        /* Try using _Unwind_DebugHook */
     }
...

The preference scheme works ok both if the objfile has debug info, and if it's
stripped.

But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present).  What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).

This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
  void process_event_stop_test(execution_control_state*): \
  Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
  failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...

To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".

Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-01-08  Tom de Vries  <tdevries@suse.de>

	PR gdb/26881
	* breakpoint.c (create_exception_master_breakpoint_probe)
	(create_exception_master_breakpoint_hook): Factor out
	of ...
	(create_exception_master_breakpoint): ... here.  Only try to install
	the master exception breakpoint in objfile.debug using the
	_Unwind_DebugHook method, if the install using probes in objfile
	failed.
2021-01-08 11:58:41 +01:00
GDB Administrator
dee26f89a8 Automatic date update in version.in 2021-01-08 00:00:29 +00:00
Pedro Alves
f498adf03f [gdb/remote] Fix invalid pointer in remote_async_serial_handler
On rare occasions, we run into this ERROR/UNRESOLVED on gdb-10-branch:
...
(gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=on: inferior 2
Remote debugging from host ::1, port 34088^M
Process outputs/gdb.multi/multi-target/multi-target created; pid = 8649^M
monitor exit^M
(gdb) Killing process(es): 8649^M
ERROR: GDB process no longer exists
GDB process exited with wait status 8627 exp14 0 0 CHILDKILLED SIGABRT SIGABRT
UNRESOLVED: gdb.multi/multi-target.exp: continue: non-stop=on: inferior 5
...

A trigger patch makes the crash happen all the time:
...
diff --git a/gdb/remote.c b/gdb/remote.c
index 71f814efb365..53ff8b63a1dc 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14161,14 +14161,12 @@ remote_target::is_async_p ()
    will be able to delay notifying the client of an event until the
    point where an entire packet has been received.  */

-static serial_event_ftype remote_async_serial_handler;
-
 static void
 remote_async_serial_handler (struct serial *scb, void *context)
 {
-  /* Don't propogate error information up to the client.  Instead let
-     the client find out about the error by querying the target.  */
-  inferior_event_handler (INF_REG_EVENT);
+  remote_state *rs = (remote_state *) context;
+
+  mark_async_event_handler (rs->remote_async_inferior_event_token);
 }

 static void
...

And using -fsanitizer=address we can get a more elaborate error message:
...
==7196==ERROR: AddressSanitizer: heap-use-after-free on address \
  0x6170000bf258 at pc 0x000001481755 bp 0x7fff05b20840 sp 0x7fff05b20838
READ of size 8 at 0x6170000bf258 thread T0
    #0 0x1481754 in std::_Hashtable<gdbarch*, std::pair<gdbarch* const,
    remote_arch_state>, std::allocator<std::pair<gdbarch* const,
    remote_arch_state> >, std::__detail::_Select1st, std::equal_to<gdbarch*>,
    std::hash<gdbarch*>, std::__detail::_Mod_range_hashing,
    std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
    std::__detail::_Hashtable_traits<false, false, true>
    >::_M_bucket_index(unsigned long) const
    /usr/include/c++/11/bits/hashtable.h:719
    #1 0x147c8ab in std::_Hashtable<gdbarch*, std::pair<gdbarch* const,
    remote_arch_state>, std::allocator<std::pair<gdbarch* const,
    remote_arch_state> >, std::__detail::_Select1st, std::equal_to<gdbarch*>,
    std::hash<gdbarch*>, std::__detail::_Mod_range_hashing,
    std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
    std::__detail::_Hashtable_traits<false, false, true> >::find(gdbarch*
    const&) /usr/include/c++/11/bits/hashtable.h:1500
    #2 0x147852c in std::unordered_map<gdbarch*, remote_arch_state,
    std::hash<gdbarch*>, std::equal_to<gdbarch*>,
    std::allocator<std::pair<gdbarch* const, remote_arch_state> >
    >::find(gdbarch* const&) /usr/include/c++/11/bits/unordered_map.h:869
    #3 0x14306db in remote_state::get_remote_arch_state(gdbarch*)
    src/gdb/remote.c:1203
    #4 0x14309dc in remote_target::get_remote_state() src/gdb/remote.c:1232
    #5 0x1470c08 in remote_async_inferior_event_handler src/gdb/remote.c:14169
    #6 0xaa9f6b in check_async_event_handlers() src/gdb/async-event.c:295
    #7 0x1e93ab4 in gdb_do_one_event() src/gdbsupport/event-loop.cc:194
    #8 0x118f5f9 in start_event_loop src/gdb/main.c:356
    #9 0x118f8ed in captured_command_loop src/gdb/main.c:416
    #10 0x1192d6a in captured_main src/gdb/main.c:1253
    #11 0x1192dfa in gdb_main(captured_main_args*) src/gdb/main.c:1268
    #12 0x97b380 in main src/gdb/gdb.c:32
    #13 0x7f550c211349 in __libc_start_main ../csu/libc-start.c:308
    #14 0x97b199 in _start (build/gdb/gdb+0x97b199)

0x6170000bf258 is located 600 bytes inside of 648-byte region \
  [0x6170000bf000,0x6170000bf288)
freed by thread T0 here:
    #0 0x7f550f516a57 in operator delete(void*, unsigned long)
    (/usr/lib64/libasan.so.6+0xaea57)
    #1 0x148b1fe in extended_remote_target::~extended_remote_target()
    src/gdb/remote.c:958
    #2 0x143b483 in remote_target::close() src/gdb/remote.c:4074
    #3 0x16cb90f in target_close(target_ops*) src/gdb/target.c:3230
    #4 0x16a2635 in decref_target(target_ops*) src/gdb/target.c:557
    #5 0x16a2abb in target_stack::unpush(target_ops*) src/gdb/target.c:645
    #6 0x16d01ef in inferior::unpush_target(target_ops*)
    src/gdb/inferior.h:356
    #7 0x16a2877 in unpush_target(target_ops*) src/gdb/target.c:607
    #8 0x16a2adf in unpush_target_and_assert src/gdb/target.c:655
    #9 0x16a2c57 in pop_all_targets_at_and_above(strata) src/gdb/target.c:678
    #10 0x1442749 in remote_unpush_target src/gdb/remote.c:5522
    #11 0x1458c16 in remote_target::readchar(int) src/gdb/remote.c:9137
    #12 0x145b25b in remote_target::getpkt_or_notif_sane_1(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int, int,
    int*) src/gdb/remote.c:9683
    #13 0x145bc9a in remote_target::getpkt_sane(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int)
    src/gdb/remote.c:9790
    #14 0x145b040 in remote_target::getpkt(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int)
    src/gdb/remote.c:9623
    #15 0x145780b in remote_target::remote_read_bytes_1(unsigned long,
    unsigned char*, unsigned long, int, unsigned long*) src/gdb/remote.c:8860
    #16 0x145805e in remote_target::remote_read_bytes(unsigned long,
    unsigned char*, unsigned long, int, unsigned long*) src/gdb/remote.c:8987
    #17 0x146113a in remote_target::xfer_partial(target_object, char const*,
    unsigned char*, unsigned char const*, unsigned long, unsigned long,
    unsigned long*) src/gdb/remote.c:10987
    #18 0x16a4004 in raw_memory_xfer_partial(target_ops*, unsigned char*,
    unsigned char const*, unsigned long, long, unsigned long*)
    src/gdb/target.c:918
    #19 0x16a4fcf in target_xfer_partial(target_ops*, target_object, char
    const*, unsigned char*, unsigned char const*, unsigned long, unsigned
    long, unsigned long*) src/gdb/target.c:1156
    #20 0x16a5d65 in target_read_partial src/gdb/target.c:1387
    #21 0x16a5f19 in target_read(target_ops*, target_object, char const*,
    unsigned char*, unsigned long, long) src/gdb/target.c:1427
    #22 0x16a5666 in target_read_raw_memory(unsigned long, unsigned char*,
    long) src/gdb/target.c:1260
    #23 0xd22f2a in dcache_read_line src/gdb/dcache.c:336
    #24 0xd232b7 in dcache_peek_byte src/gdb/dcache.c:403
    #25 0xd23845 in dcache_read_memory_partial(target_ops*, dcache_struct*,
    unsigned long, unsigned char*, unsigned long, unsigned long*) src/gdb/dcache.c:484
    #26 0x16a47da in memory_xfer_partial_1 src/gdb/target.c:1041
    #27 0x16a4a1e in memory_xfer_partial src/gdb/target.c:1084
    #28 0x16a4f44 in target_xfer_partial(target_ops*, target_object,
    char const*, unsigned char*, unsigned char const*, unsigned long,
    unsigned long, unsigned long*) src/gdb/target.c:1141
    #29 0x18203d4 in read_value_memory(value*, long, int, unsigned long,
    unsigned char*, unsigned long) src/gdb/valops.c:956

previously allocated by thread T0 here:
    #0 0x7f550f515c37 in operator new(unsigned long)
    (/usr/lib64/libasan.so.6+0xadc37)
    #1 0x14429f0 in remote_target::open_1(char const*, int, int)
    src/gdb/remote.c:5562
    #2 0x14405e6 in extended_remote_target::open(char const*, int)
    src/gdb/remote.c:4907
    #3 0x16a0f3c in open_target src/gdb/target.c:242
    #4 0xc19ff5 in do_sfunc src/gdb/cli/cli-decode.c:111
    #5 0xc221db in cmd_func(cmd_list_element*, char const*, int)
    src/gdb/cli/cli-decode.c:2181
    #6 0x16feda6 in execute_command(char const*, int) src/gdb/top.c:668
    #7 0xee9dc9 in command_handler(char const*) src/gdb/event-top.c:588
    #8 0xeea6a8 in command_line_handler(std::unique_ptr<char,
    gdb::xfree_deleter<char> >&&) src/gdb/event-top.c:773
    #9 0xee8a12 in gdb_rl_callback_handler src/gdb/event-top.c:219
    #10 0x7f550f24aead in rl_callback_read_char
    (/lib64/libreadline.so.7+0x31ead)
...

The problem is here in remote_async_inferior_event_handler:
...
static void
remote_async_inferior_event_handler (gdb_client_data data)
{
  inferior_event_handler (INF_REG_EVENT);

  remote_target *remote = (remote_target *) data;
  remote_state *rs = remote->get_remote_state ();
...

The remote target (passed in the data argument) can be destroyed during the
call to inferior_event_handler.  If so, the call to remote->get_remote_state
() is done using a dangling pointer.

Fix this by increasing the reference count on the remote target before calling
inferior_event_handler, such that it won't get destroyed until right before
returning from remote_async_inferior_event_handler.

Tested on x86_64-linux.

Intended for gdb-10-branch.

The problem has stopped reproducing with the trigger patch since master commit
79952e6963 "Make scoped_restore_current_thread's cdtors exception free
(RFC)".  We could still apply this to master though.

gdb/ChangeLog:

2021-01-07  Pedro Alves  <pedro@palves.net>
	    Simon Marchi  <simon.marchi@polymtl.ca>
	    Tom de Vries  <tdevries@suse.de>

	PR remote/26614
	* remote.c (remote_async_inferior_event_handler):  Hold a strong
	reference to the remote target while handling an event.
2021-01-07 21:41:03 +01:00
GDB Administrator
bfd46c030e Automatic date update in version.in 2021-01-07 00:00:36 +00:00
GDB Administrator
7173ab08ca Automatic date update in version.in 2021-01-06 00:00:27 +00:00
GDB Administrator
4e23936ff1 Automatic date update in version.in 2021-01-05 00:00:23 +00:00
GDB Administrator
8cb021b633 Automatic date update in version.in 2021-01-04 00:00:25 +00:00
GDB Administrator
fbbdd14038 Automatic date update in version.in 2021-01-03 00:00:20 +00:00
GDB Administrator
c504e70057 Automatic date update in version.in 2021-01-02 00:00:20 +00:00
Joel Brobecker
58eb95d632 Manual updates of copyright year range not covered by gdb/copyright.py
gdb/ChangeLog:

        * gdbarch.sh: Update copyright year range.

gdb/doc/ChangeLog:

        * gdb.texinfo, refcard.tex: Update copyright year range.

(cherry picked from commit b5b5650a49)
2021-01-01 12:24:28 +04:00
Joel Brobecker
671a7cab7d Update copyright year range in all GDB files
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...

gdb/ChangeLog

        Update copyright year range in copyright header of all GDB files.
2021-01-01 12:22:49 +04:00
Joel Brobecker
18b166df9f gdb/copyright.py: Also update sources in "gdbserver" and "gdbsupport"
This commit adjusts GDB's copyright.py script, following two past changes:
  - gdb/gdbserver/ being move to the toplevel directory;
  - gdb/common/ being renamed to gdbsupport/.

gdb/ChangeLog:

        * copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
        to the list of directories to update.

(cherry picked from commit ff7e39b613)
2021-01-01 12:20:52 +04:00
Joel Brobecker
16d2343d4e Update copyright year in version message for gdb, gdbserver and gdbreplay
gdb/ChangeLog:

        * top.c (print_gdb_version): Update copyright year.

gdbserver/ChangeLog:

        * server.cc (gdbserver_version): Update copyright year.
        * gdbreplay.cc (gdbreplay_version): Likewise.

(cherry picked from commit 2b47c078fd)
2021-01-01 12:20:19 +04:00
GDB Administrator
7e0c60bb71 Automatic date update in version.in 2021-01-01 00:00:17 +00:00
GDB Administrator
9a1097cd1c Automatic date update in version.in 2020-12-31 00:00:29 +00:00
GDB Administrator
8aca6e7bed Automatic date update in version.in 2020-12-30 00:00:22 +00:00
GDB Administrator
cc323ac189 Automatic date update in version.in 2020-12-29 00:00:19 +00:00
GDB Administrator
9fff6cda98 Automatic date update in version.in 2020-12-28 00:00:27 +00:00
GDB Administrator
ed3c75e141 Automatic date update in version.in 2020-12-27 00:00:34 +00:00
Jeanne Rasata
75b2e5a442 Fix capitalization in the GDB manual
gdb/doc/ChangeLog:
2020-12-26  Jeanne Rasata <jeanne@fsf.org>

* gdb.texinfo: Fix capitalization in many sections following CMS
style-guide rules, remove period at end of a few headings.

Copyright-paperwork-exempt: yes
2020-12-26 11:16:38 +02:00
GDB Administrator
1fdfa82c20 Automatic date update in version.in 2020-12-26 00:00:16 +00:00
GDB Administrator
b5978f7dee Automatic date update in version.in 2020-12-25 00:00:22 +00:00
GDB Administrator
065440a290 Automatic date update in version.in 2020-12-24 00:00:31 +00:00
GDB Administrator
cdb04c69ef Automatic date update in version.in 2020-12-23 00:00:23 +00:00
GDB Administrator
4c5df995cb Automatic date update in version.in 2020-12-22 00:00:31 +00:00
GDB Administrator
af40c13550 Automatic date update in version.in 2020-12-21 00:00:17 +00:00
GDB Administrator
bb94a43eac Automatic date update in version.in 2020-12-20 00:00:18 +00:00
GDB Administrator
3639436bef Automatic date update in version.in 2020-12-19 00:00:17 +00:00
GDB Administrator
ab91f7fe0f Automatic date update in version.in 2020-12-18 00:00:30 +00:00
GDB Administrator
081a480696 Automatic date update in version.in 2020-12-17 00:00:33 +00:00
GDB Administrator
20c256c726 Automatic date update in version.in 2020-12-16 00:00:30 +00:00
GDB Administrator
8b0dcfd47c Automatic date update in version.in 2020-12-15 00:00:33 +00:00
GDB Administrator
a05b378489 Automatic date update in version.in 2020-12-14 00:00:28 +00:00
GDB Administrator
125aa25b17 Automatic date update in version.in 2020-12-13 00:00:30 +00:00
GDB Administrator
8030c16ad5 Automatic date update in version.in 2020-12-12 00:00:32 +00:00
GDB Administrator
1757dad1a5 Automatic date update in version.in 2020-12-11 00:00:36 +00:00
GDB Administrator
be4fd5ee3e Automatic date update in version.in 2020-12-10 00:00:35 +00:00
Simon Marchi
969da52cb0 gdb: address review comments of previous series
I forgot to include fixes for review comments I got before pushing the
previous commits (or I pushed the wrong commits).  This one fixes it.

 - Return {} instead of false in get_discrete_low_bound and
   get_discrete_high_bound.
 - Compute high bound after confirming low bound is valid in
   get_discrete_bounds.

gdb/ChangeLog:

	* gdbtypes.c (get_discrete_low_bound, get_discrete_high_bound):
	Return {} instead of false.
	(get_discrete_bounds): Compute high bound only if low bound is
	valid.

Change-Id: I5f9a66b3672adfac9441068c899ab113ab2c331a
2020-12-09 15:36:28 -05:00
Simon Marchi
138084b248 gdb: fix value_subscript when array upper bound is not known
Since commit 7c6f271296 ("gdb: make get_discrete_bounds check for
non-constant range bounds"), subscripting  flexible array member fails:

    struct no_size
    {
      int n;
      int items[];
    };

    (gdb) p *ns
    $1 = {n = 3, items = 0x5555555592a4}
    (gdb) p ns->items[0]
    Cannot access memory at address 0xfffe555b733a0164
    (gdb) p *((int *) 0x5555555592a4)
    $2 = 101  <--- we would expect that
    (gdb) p &ns->items[0]
    $3 = (int *) 0xfffe5559ee829a24  <--- wrong address

Since the flexible array member (items) has an unspecified size, the array type
created for it in the DWARF doesn't have dimensions (this is with gcc 9.3.0,
Ubuntu 20.04):

    0x000000a4:   DW_TAG_array_type
                    DW_AT_type [DW_FORM_ref4]       (0x00000038 "int")
                    DW_AT_sibling [DW_FORM_ref4]    (0x000000b3)

    0x000000ad:     DW_TAG_subrange_type
                      DW_AT_type [DW_FORM_ref4]     (0x00000031 "long unsigned int")

This causes GDB to create a range type (TYPE_CODE_RANGE) with a defined
constant low bound (dynamic_prop with kind PROP_CONST) and an undefined
high bound (dynamic_prop with kind PROP_UNDEFINED).

value_subscript gets both bounds of that range using
get_discrete_bounds.  Before commit 7c6f271296, get_discrete_bounds
didn't check the kind of the dynamic_props and would just blindly read
them as if they were PROP_CONST.  It would return 0 for the high bound,
because we zero-initialize the range_bounds structure.  And it didn't
really matter in this case, because the returned high bound wasn't used
in the end.

Commit 7c6f271296 changed get_discrete_bounds to return a failure if
either the low or high bound is not a constant, to make sure we don't
read a dynamic prop that isn't a PROP_CONST as a PROP_CONST.  This
change made get_discrete_bounds start to return a failure for that
range, and as a result would not set *lowp and *highp.  And since
value_subscript doesn't check get_discrete_bounds' return value, it just
carries on an uses an uninitialized value for the low bound.  If
value_subscript did check the return value of get_discrete_bounds, we
would get an error message instead of a bogus value.  But it would still
be a bug, as we wouldn't be able to print the flexible array member's
elements.

Looking at value_subscript, we see that the low bound is always needed,
but the high bound is only needed if !c_style.  So, change
value_subscript to use get_discrete_low_bound and
get_discrete_high_bound separately.  This fixes the case described
above, where the low bound is known but the high bound isn't (and is not
needed).  This restores the original behavior without accessing a
dynamic_prop in a wrong way.

A test is added.  In addition to the case described above, a case with
an array member of size 0 is added, which is a GNU C extension that
existed before flexible array members were introduced.  That case
currently fails when compiled with gcc <= 8.  gcc <= 8 produces DWARF
similar to the one shown above, while gcc 9 adds a DW_AT_count of 0 in
there, which makes the high bound known.  A case where an array member
of size 0 is the only member of the struct is also added, as that was
how PR 28675 was originally reported, and it's an interesting corner
case that I think could trigger other funny bugs.

Question about the implementation: in value_subscript, I made it such
that if the low or high bound is unknown, we fall back to zero.  That
effectively makes it the same as it was before 7c6f271296.  But should
we instead error() out?

gdb/ChangeLog:

	PR 26875, PR 26901
	* gdbtypes.c (get_discrete_low_bound): Make non-static.
	(get_discrete_high_bound): Make non-static.
	* gdbtypes.h (get_discrete_low_bound): New declaration.
	(get_discrete_high_bound): New declaration.
	* valarith.c (value_subscript): Only fetch high bound if
	necessary.

gdb/testsuite/ChangeLog:

	PR 26875, PR 26901
	* gdb.base/flexible-array-member.c: New test.
	* gdb.base/flexible-array-member.exp: New test.

Change-Id: I832056f80e6c56f621f398b4780d55a3a1e299d7
2020-12-09 15:35:18 -05:00
Simon Marchi
bd1768de21 gdb: split get_discrete_bounds in two
get_discrete_bounds is not flexible for ranges (TYPE_CODE_RANGE), in the
sense that it returns true (success) only if both bounds are present and
constant values.

This is a problem for code that only needs to know the low bound and
fails unnecessarily if the high bound is unknown.

Split the function in two, get_discrete_low_bound and
get_discrete_high_bound, that both return an optional.  Provide a new
implementation of get_discrete_bounds based on the two others, so the
callers don't have to be changed.

gdb/ChangeLog:

	* gdbtypes.c (get_discrete_bounds): Implement with
	get_discrete_low_bound and get_discrete_high_bound.
	(get_discrete_low_bound): New.
	(get_discrete_high_bound): New.

Change-Id: I986b5e9c0dd969800e3fb9546af9c827d52e80d0
2020-12-09 15:31:44 -05:00
Simon Marchi
f47d1c255d gdb: make get_discrete_bounds return bool
get_discrete_bounds currently has three possible return values (see its
current doc for details).  It appears that for all callers, it would be
sufficient to have a boolean "worked" / "didn't work" return value.

Change the return type of get_discrete_bounds to bool and adjust all
callers.  Doing so simplifies the following patch.

gdb/ChangeLog:

	* gdbtypes.h (get_discrete_bounds): Return bool, adjust all
	callers.
	* gdbtypes.c (get_discrete_bounds): Return bool.

Change-Id: Ie51feee23c75f0cd7939742604282d745db59172
2020-12-09 15:23:56 -05:00
Simon Marchi
f5fca0ec15 gdb: make discrete_position return optional
Instead of returning a boolean status and returning the value through a
pointer, return an optional that does both jobs.  This helps in the
following patches, and I think it is an improvement in general.

gdb/ChangeLog:

	* ada-lang.c (ada_value_slice_from_ptr): Adjust.
	(ada_value_slice): Adjust.
	(pos_atr): Adjust.
	* gdbtypes.c (get_discrete_bounds): Adjust.
	(discrete_position): Return optional.
	* gdbtypes.h (discrete_position): Return optional.

Change-Id: I758dbd8858b296ee472ed39ec35db1dbd624a5ae
2020-12-09 14:05:48 -05:00
GDB Administrator
8d55943698 Automatic date update in version.in 2020-12-09 00:00:44 +00:00
GDB Administrator
7205c99163 Automatic date update in version.in 2020-12-08 00:00:47 +00:00
GDB Administrator
eca082c05c Automatic date update in version.in 2020-12-07 00:00:34 +00:00
Giancarlo Frix
47c4623c75 s390: Fix BC instruction breakpoint handling
This fixes a long-lived bug in the s390 port.

When trying to step over a breakpoint set on a BC (branch on condition)
instruction with displaced stepping on IBM Z, gdb would incorrectly
adjust the pc regardless of whether or not the branch was taken. Since
the branch target is an absolute address, this would cause the inferior
to jump around wildly whenever the branch was taken, either crashing it
or causing it to behave unpredictably.

It turns out that the logic to handle BC instructions correctly was in
the code, but that the enum value representing its opcode has always
been incorrect.

This patch corrects the enum value to the actual opcode, fixing the
stepping problem. The enum value is also used in the prologue analysis
code, so this also fixes a minor bug where more of the prologue would
be read than was necessary.

gdb/ChangeLog:

        PR breakpoints/27009
        * s390-tdep.h (op_bc): Correct BC opcode value.
2020-12-06 14:30:53 +04:00
GDB Administrator
bc6989cbd3 Automatic date update in version.in 2020-12-06 00:00:39 +00:00
GDB Administrator
a4245c0961 Automatic date update in version.in 2020-12-05 00:00:28 +00:00
Shahab Vahedi
4cf1920e40 Update gdb/ChangeLog to reflect the PR for a bug fix
This is just an update in the gdb/ChangeLog to reflect a newly
created PR [27015] for a bugfix commit:

abaf3df9  arc: Write correct "eret" value during register collection
2020-12-04 16:28:37 +01:00
Shahab Vahedi
abaf3df98b arc: Write correct "eret" value during register collection
In collect_register() function of arc-linux-tdep.c, the "eret"
(exception return) register value was not being reported correctly.
This patch fixes that.

Background:
When asked for the "pc" value, we have to update the "eret" register
with GDB's STOP_PC.  The "eret" instructs the kernel code where to
jump back when an instruction has stopped due to a breakpoint.  This
is how collect_register() was doing so:

--------------8<--------------
  if (regnum == gdbarch_pc_regnum (gdbarch))
    regnum = ARC_ERET_REGNUM;
  regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
-------------->8--------------

Root cause:
Although this is using the correct offset (ERET register's), it is also
changing the REGNUM itself.  Therefore, raw_collect (regnum, ...) is
not reading from "pc" anymore.

v2:
- Fix a copy/paste issue as rightfully addressed by Tom [1].

[1]
https://sourceware.org/pipermail/gdb-patches/2020-November/173208.html

gdb/ChangeLog:

	* arc-linux-tdep.c (collect_register): Populate "eret" by
	"pc" value from the regcache when asked for "pc" value.
2020-12-04 11:41:47 +01:00
GDB Administrator
774f775cad Automatic date update in version.in 2020-12-04 00:00:48 +00:00
GDB Administrator
a2e9100aa8 Automatic date update in version.in 2020-12-03 00:00:34 +00:00
GDB Administrator
866f1b1c9a Automatic date update in version.in 2020-12-02 00:00:42 +00:00
GDB Administrator
2ff9a46fd6 Automatic date update in version.in 2020-12-01 00:00:48 +00:00
GDB Administrator
1429d8beb4 Automatic date update in version.in 2020-11-30 00:00:40 +00:00
Hannes Domani
815c8f80e2 Fix Value.format_string docu for static members argument
The argument is called static_members, not static_fields.

gdb/doc/ChangeLog:

2020-11-29  Hannes Domani  <ssbssa@yahoo.de>

	PR python/26974
	* python.texi: Fix docu for static members argument.
2020-11-29 19:11:38 +01:00
Hannes Domani
b03dac541f Don't delete the locator win info
The locator win info is special because it is static, all the others are
created dynamically.

gdb/ChangeLog:

2020-11-29  Hannes Domani  <ssbssa@yahoo.de>

	PR tui/26973
	* tui/tui-layout.c (tui_apply_current_layout): Don't delete the
	static locator win info.
2020-11-29 18:53:52 +01:00
GDB Administrator
f2fb5e6f21 Automatic date update in version.in 2020-11-29 00:00:41 +00:00
GDB Administrator
9ca51a9034 Automatic date update in version.in 2020-11-28 00:00:45 +00:00
GDB Administrator
8dad16200e Automatic date update in version.in 2020-11-27 00:00:55 +00:00
GDB Administrator
2d409e3adc Automatic date update in version.in 2020-11-26 00:00:47 +00:00
GDB Administrator
fe3088f6ef Automatic date update in version.in 2020-11-25 00:00:35 +00:00
GDB Administrator
12f93c92d0 Automatic date update in version.in 2020-11-24 00:00:47 +00:00
GDB Administrator
08d79fde1a Automatic date update in version.in 2020-11-23 00:00:32 +00:00
GDB Administrator
6427533f8f Automatic date update in version.in 2020-11-22 00:00:35 +00:00
GDB Administrator
a7ca0db2a9 Automatic date update in version.in 2020-11-21 00:00:39 +00:00
GDB Administrator
68f7ee1f46 Automatic date update in version.in 2020-11-20 00:00:37 +00:00
GDB Administrator
77477f6d04 Automatic date update in version.in 2020-11-19 00:00:33 +00:00
GDB Administrator
a90a7eb266 Automatic date update in version.in 2020-11-18 00:00:36 +00:00
GDB Administrator
45c0714276 Automatic date update in version.in 2020-11-17 00:00:36 +00:00
GDB Administrator
c7409b74dd Automatic date update in version.in 2020-11-16 00:00:35 +00:00
GDB Administrator
4028013ab8 Automatic date update in version.in 2020-11-15 00:00:33 +00:00
GDB Administrator
2b8bbb9c5e Automatic date update in version.in 2020-11-14 00:00:40 +00:00
GDB Administrator
8584763bdc Automatic date update in version.in 2020-11-13 00:00:54 +00:00
GDB Administrator
7d73ecece6 Automatic date update in version.in 2020-11-12 00:00:45 +00:00
GDB Administrator
625214b4bc Automatic date update in version.in 2020-11-11 00:00:30 +00:00
GDB Administrator
44f04519db Automatic date update in version.in 2020-11-10 00:00:48 +00:00
GDB Administrator
068a9f4698 Automatic date update in version.in 2020-11-09 00:00:25 +00:00
GDB Administrator
1370d58819 Automatic date update in version.in 2020-11-08 00:00:27 +00:00
GDB Administrator
b99d8d8bfe Automatic date update in version.in 2020-11-07 00:00:37 +00:00
Romain Geissler
60714c0fc0 gdb: better static python detection in configure machinery
In python 3, itertools is a builtin module, so whether or not the
python you link against is a shared or a static one, importing it
works.

Change the import test to use ctypes which is a dynamic module in both
python 2 and 3.

gdb/ChangeLog:

	PR python/26832
	* configure: Regenerate.
	* configure.ac: Check for python modules ctypes instead of
	itertools.
2020-11-06 18:02:24 +00:00
GDB Administrator
2aec92379f Automatic date update in version.in 2020-11-06 00:00:49 +00:00
GDB Administrator
7736ed8327 Automatic date update in version.in 2020-11-05 00:00:39 +00:00
GDB Administrator
923b14f187 Automatic date update in version.in 2020-11-04 00:00:42 +00:00
GDB Administrator
b558fb22bc Automatic date update in version.in 2020-11-03 00:00:41 +00:00
GDB Administrator
8aa3beab03 Automatic date update in version.in 2020-11-02 00:00:39 +00:00
GDB Administrator
3163819a76 Automatic date update in version.in 2020-11-01 00:00:30 +00:00
GDB Administrator
4b8bc9ac85 Automatic date update in version.in 2020-10-31 00:00:31 +00:00
GDB Administrator
82c494b0d1 Automatic date update in version.in 2020-10-30 00:00:32 +00:00
GDB Administrator
805187e6cd Automatic date update in version.in 2020-10-29 00:00:41 +00:00
GDB Administrator
f3fb4a77f2 Automatic date update in version.in 2020-10-28 00:00:35 +00:00
GDB Administrator
32e63cccb8 Automatic date update in version.in 2020-10-27 00:00:27 +00:00
GDB Administrator
eac45cf79a Automatic date update in version.in 2020-10-26 00:00:27 +00:00
GDB Administrator
e8f9da19bc Automatic date update in version.in 2020-10-25 00:00:31 +00:00
Joel Brobecker
4f2b5ace6f Bump GDB version number to 10.1.90.DATE-git.
gdb/ChangeLog:

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

gdb/testsuite/ChangeLog:

	* gdb.base/default.exp: Change $_gdb_minor to 2.
2020-10-24 08:41:57 +04:00
Joel Brobecker
606e3fd147 Document the GDB 10.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 10.1 released.
2020-10-24 08:36:33 +04:00
Joel Brobecker
1510de4294 Set GDB version number to 10.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 10.1.
2020-10-24 08:23:02 +04:00
GDB Administrator
893aa14fb9 Automatic date update in version.in 2020-10-24 00:00:32 +00:00
GDB Administrator
34718bcc22 Automatic date update in version.in 2020-10-23 00:00:45 +00:00
Hannes Domani
7565d82a50 Don't create _Complex type name if there is no target type name
This causes gdb to crash in strlen.

Happens if init_complex_type is called for a type created by
dbx_init_float_type in stabsread.c.

gdb/ChangeLog:

2020-10-22  Hannes Domani  <ssbssa@yahoo.de>

	* gdbtypes.c (init_complex_type): Check target type name.
2020-10-22 20:05:32 +02:00
Andrew Burgess
a9e3b91950 opcodes/csky: return the default disassembler when there is no bfd
The disassembler function should return a valid disassembler function
even when there is no BFD present.  This is implied (I believe) by the
comment in dis-asm.h which says the BFD may be NULL.  Further, it
makes sense when considering that the disassembler is used in GDB, and
GDB may connect to a target and perform debugging even without a BFD
being supplied.

This commit makes the csky_get_disassembler function return the
default disassembler configuration when no bfd is supplied, this is
the same default configuration as is used when a BFD is supplied, but
the BFD has no attributes section.

Before the change configuring GDB with --enable-targets=all and
running the tests gdb.base/all-architectures-2.exp results in many
errors, but after this change there are no failures.

opcodes/ChangeLog:

	* csky-dis.c (csky_get_disassembler): Don't return NULL when there
	is no BFD.
2020-10-22 17:11:34 +02:00
Simon Marchi
4c02be1198 gdb/dwarf: fix reading subprogram with DW_AT_specification (PR gdb/26693)
Fix a regression introduced by commit 7188ed02d2 ("Replace
dwarf2_per_cu_data::cu backlink with per-objfile map").

This patch targets both master and gdb-10-branch, since this is a
regression from GDB 9.

Analysis
--------

The DWARF generated by the included test case looks like:

    0x0000000b: DW_TAG_compile_unit
                  DW_AT_language [DW_FORM_sdata]    (4)

    0x0000000d:   DW_TAG_base_type
                    DW_AT_name [DW_FORM_string]     ("int")
                    DW_AT_byte_size [DW_FORM_data1] (0x04)
                    DW_AT_encoding [DW_FORM_sdata]  (5)

    0x00000014:   DW_TAG_subprogram
                    DW_AT_name [DW_FORM_string]     ("apply")

    0x0000001b:   DW_TAG_subprogram
                    DW_AT_specification [DW_FORM_ref4]      (0x00000014 "apply")
                    DW_AT_low_pc [DW_FORM_addr]     (0x0000000000001234)
                    DW_AT_high_pc [DW_FORM_data8]   (0x0000000000000020)

    0x00000030:     DW_TAG_template_type_parameter
                      DW_AT_name [DW_FORM_string]   ("T")
                      DW_AT_type [DW_FORM_ref4]     (0x0000000d "int")

    0x00000037:     NULL

    0x00000038:   NULL

Simply loading the file in GDB makes it crash:

    $ ./gdb -nx --data-directory=data-directory testsuite/outputs/gdb.dwarf2/pr26693/pr26693
    [1]    15188 abort (core dumped)  ./gdb -nx --data-directory=data-directory

The crash happens here, where htab (a dwarf2_cu::die_hash field) is
unexpectedly NULL while generating partial symbols:

    #0  0x000055555fa28188 in htab_find_with_hash (htab=0x0, element=0x7fffffffbfa0, hash=27) at /home/simark/src/binutils-gdb/libiberty/hashtab.c:591
    #1  0x000055555cb4eb2e in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22951
    #2  0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968
    #3  0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441
    #4  0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469
    #5  0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737
    #6  0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230
    #7  0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614
    #8  0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712
    #9  0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073

The special thing about this DWARF is that the subprogram at 0x1b is a
template specialization described with DW_AT_specification, and has no
DW_AT_name in itself.  To compute the name of this subprogram,
partial_die_full_name needs to load the full DIE for this partial DIE.
The name is generated from the templated function name and the actual
tempalate parameter values of the specialization.

To load the full DIE, partial_die_full_name creates a dummy DWARF
attribute of form DW_FORM_ref_addr that points to our subprogram's DIE,
and calls follow_die_ref on it.  This eventually causes
load_full_comp_unit to be called for the exact same CU we are currently
making partial symbols for:

    #0  load_full_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, skip_partial=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:9238
    #1  0x000055555cb4e943 in follow_die_offset (sect_off=(unknown: 27), offset_in_dwz=0, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22942
    #2  0x000055555cb4edfb in follow_die_ref (src_die=0x0, attr=0x7fffffffc130, ref_cu=0x7fffffffc110) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:22968
    #3  0x000055555caa48c5 in partial_die_full_name (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8441
    #4  0x000055555caa4d79 in add_partial_symbol (pdi=0x621000157e70, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8469
    #5  0x000055555caa7d8c in add_partial_subprogram (pdi=0x621000157e70, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8737
    #6  0x000055555caa265c in scan_partial_symbols (first_die=0x621000157e00, lowpc=0x7fffffffc5c0, highpc=0x7fffffffc5e0, set_addrmap=1, cu=0x615000023f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8230
    #7  0x000055555ca98e3f in process_psymtab_comp_unit_reader (reader=0x7fffffffc6b0, info_ptr=0x60600009650d "\003int", comp_unit_die=0x621000157d10, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7614
    #8  0x000055555ca9aa2c in process_psymtab_comp_unit (this_cu=0x621000155510, per_objfile=0x613000009f80, want_partial_unit=false, pretend_language=language_minimal) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7712
    #9  0x000055555caa051a in dwarf2_build_psymtabs_hard (per_objfile=0x613000009f80) at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8073

load_full_comp_unit creates a cutu_reader for the CU.  Since a dwarf2_cu
object already exists for the CU, load_full_comp_unit is expected to
find it and pass it to cutu_reader, so that cutu_reader doesn't create
a new dwarf2_cu for the CU.

And this is the difference between before and after the regression.
Before commit 7188ed02d2, the dwarf2_per_cu_data -> dwarf2_cu link was
a simple pointer in dwarf2_per_cu_data.  This pointer was set up when
starting the read the partial symbols.  So it was already available at
that point where load_full_comp_unit gets called.  Post-7188ed02d2a7,
this link is per-objfile, kept in the dwarf2_per_objfile::m_dwarf2_cus
hash map.  The entry is only put in the hash map once the partial
symbols have been successfully read, when cutu_reader::keep is called.
Therefore, it is _not_ set at the point load_full_comp_unit is called.

As a consequence, a new dwarf2_cu object gets created and initialized by
load_full_comp_unit (including initializing that dwarf2_cu::die_hash
field).  Meanwhile, the dwarf2_cu object created and used by the callers
up the stack does not get initialized for full symbol reading, and the
dwarf2_cu::die_hash field stays unexpectedly NULL.

Solution
--------

Since the caller of load_full_comp_unit knows about the existing
dwarf2_cu object for the CU we are reading (the one load_full_comp_unit
is expected to find), we can simply make it pass it down, instead of
having load_full_comp_unit look up the per-objfile map.

load_full_comp_unit therefore gets a new `existing_cu` parameter.  All
other callers get updated to pass `per_objfile->get_cu (per_cu)`, so the
behavior shouldn't change for them, compared to the current HEAD.

A test is added, which is the bare minimum to reproduce the issue.

Notes
-----

The original problem was reproduced by downloading

    https://github.com/oneapi-src/oneTBB/releases/download/v2020.3/tbb-2020.3-lin.tgz

and loading libtbb.so in GDB.  This code was compiled with the Intel
C/C++ compiler.  I was not able to reproduce the issue using GCC, I
think because GCC puts a DW_AT_name in the specialized subprogram, so
there's no need for partial_die_full_name to load the full DIE of the
subprogram, and the faulty code doesn't execute.

gdb/ChangeLog:

	PR gdb/26693
	* dwarf2/read.c (load_full_comp_unit): Add existing_cu
	parameter.
	(load_cu): Pass existing CU.
	(process_imported_unit_die): Likewise.
	(follow_die_offset): Likewise.

gdb/testsuite/ChangeLog:

	PR gdb/26693
	* gdb.dwarf2/template-specification-full-name.exp: New test.

Change-Id: I57c8042f96c45f15797a3848e4d384181c56bb44
2020-10-22 10:47:07 -04:00
GDB Administrator
9a312e4904 Automatic date update in version.in 2020-10-22 00:00:26 +00:00
GDB Administrator
43b860e8c4 Automatic date update in version.in 2020-10-21 00:00:32 +00:00
GDB Administrator
974fee813c Automatic date update in version.in 2020-10-20 00:00:26 +00:00
Mihails Strasuns
a606acc8d2 gdb: get jiter objfile from a bound minsym
This fixes a regression introduced by the following commit:

fe053b9e85 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.
2020-10-19 16:46:44 +02:00
GDB Administrator
aa873d8315 Automatic date update in version.in 2020-10-19 00:00:32 +00:00
GDB Administrator
628b363a6a Automatic date update in version.in 2020-10-18 00:00:27 +00:00
GDB Administrator
c94703dc45 Automatic date update in version.in 2020-10-17 00:00:24 +00:00
GDB Administrator
b96b7cf31f Automatic date update in version.in 2020-10-16 00:00:29 +00:00
GDB Administrator
2acc8db7ed Automatic date update in version.in 2020-10-15 00:00:28 +00:00
GDB Administrator
2e052fd569 Automatic date update in version.in 2020-10-14 00:00:28 +00:00
Simon Marchi
f9052d5c0e 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 5b6d1e4fa4 ("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 5b6d1e4fa4 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
2020-10-13 14:28:13 -04:00
GDB Administrator
0241ddc77d Automatic date update in version.in 2020-10-13 00:00:31 +00:00
GDB Administrator
5d09cf9879 Automatic date update in version.in 2020-10-12 00:00:23 +00:00
GDB Administrator
e610101040 Automatic date update in version.in 2020-10-11 00:00:26 +00:00
GDB Administrator
f7a8799115 Automatic date update in version.in 2020-10-10 00:00:23 +00:00
Joel Brobecker
dc37fea759 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.
2020-10-09 12:50:50 -07:00
GDB Administrator
114f9fd9e9 Automatic date update in version.in 2020-10-09 00:00:29 +00:00
Shahab Vahedi
223de168bb Update GDB NEWS with ARC support in GDBserver
gdb/ChangeLog:

	* NEWS: Mention ARC support in GDBserver.
2020-10-08 13:53:28 +02:00
GDB Administrator
f39391b6f0 Automatic date update in version.in 2020-10-08 00:00:25 +00:00
Anton Kolesov
460fd13b5b 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.
2020-10-07 18:29:35 +02:00
Shahab Vahedi
94265abc20 gdb/gdbserver: Add the missing ChangeLog entries
I forgot to add the ChangeLog entries for these 2 patches:

b13599da1a gdbserver: Add GNU/Linux support for ARC
e26d3e9b76 arc: Rename "arc_gdbarch_features" struct
2020-10-07 18:16:19 +02:00
Anton Kolesov
b13599da1a 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.
2020-10-07 18:00:36 +02:00
Shahab Vahedi
e26d3e9b76 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.
2020-10-07 18:00:26 +02:00
GDB Administrator
8f97e9b79d Automatic date update in version.in 2020-10-07 00:00:26 +00:00
GDB Administrator
e68941ba17 Automatic date update in version.in 2020-10-06 00:00:29 +00:00
GDB Administrator
7ba0e35baa Automatic date update in version.in 2020-10-05 00:00:29 +00:00
GDB Administrator
522605be60 Automatic date update in version.in 2020-10-04 00:00:30 +00:00
GDB Administrator
fdb72ad268 Automatic date update in version.in 2020-10-03 00:00:24 +00:00
GDB Administrator
ea9cc728dc Automatic date update in version.in 2020-10-02 00:00:28 +00:00
GDB Administrator
2378f62126 Automatic date update in version.in 2020-10-01 00:00:29 +00:00
GDB Administrator
7e7e2357fc Automatic date update in version.in 2020-09-30 00:00:31 +00:00
GDB Administrator
ccf7653413 Automatic date update in version.in 2020-09-29 00:00:29 +00:00
Gareth Rees
f6c03ee4ad 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 8f9929bb97)
2020-09-28 13:15:59 -07:00
GDB Administrator
5cb6abf208 Automatic date update in version.in 2020-09-28 00:00:32 +00:00
GDB Administrator
df69589808 Automatic date update in version.in 2020-09-27 00:00:29 +00:00
GDB Administrator
698ef0a3e7 Automatic date update in version.in 2020-09-26 00:00:28 +00:00
Tankut Baris Aktemur
13e87e2127 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.
2020-09-25 17:58:04 +02:00
GDB Administrator
f6defe2064 Automatic date update in version.in 2020-09-25 00:00:24 +00:00
Tom Tromey
8ccf2a20fb 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".
2020-09-24 13:03:18 -06:00
Hannes Domani
642ed0e9ec 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.
2020-09-24 19:47:26 +02:00
GDB Administrator
6006bb78cc Automatic date update in version.in 2020-09-24 00:00:30 +00:00
GDB Administrator
2051e5340c Automatic date update in version.in 2020-09-23 00:00:23 +00:00
GDB Administrator
1e4d9e71cc Automatic date update in version.in 2020-09-22 00:00:24 +00:00
GDB Administrator
d941eafc46 Automatic date update in version.in 2020-09-21 00:00:24 +00:00
GDB Administrator
a78d1a1c28 Automatic date update in version.in 2020-09-20 00:00:40 +00:00
Victor Collod
b892828bcb 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.
2020-09-19 19:53:05 -04:00
GDB Administrator
4567103763 Automatic date update in version.in 2020-09-19 00:00:46 +00:00
Pedro Alves
5573f8461b 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.
2020-09-18 13:40:55 +01:00
Pedro Alves
a77c0fd170 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.
2020-09-18 13:40:55 +01:00
GDB Administrator
0d789f59d1 Automatic date update in version.in 2020-09-18 00:00:42 +00:00
GDB Administrator
7ea31d3da0 Automatic date update in version.in 2020-09-17 00:00:38 +00:00
Tom Tromey
1f2950be0b Match demangled name in "skip"
PR gdb/26598 notes that, before commit bcfe6157ca ("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.
2020-09-16 13:55:37 -06:00
GDB Administrator
f0f01c9e23 Automatic date update in version.in 2020-09-16 00:00:39 +00:00
Tom Tromey
efb04be6ae 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.
2020-09-15 09:31:22 -06:00
Fredrik Hederstierna
ba8b04a8d8 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.
2020-09-15 14:57:49 +01:00
GDB Administrator
9c4a30eb45 Automatic date update in version.in 2020-09-15 00:00:51 +00:00
GDB Administrator
5ebb0da9a5 Automatic date update in version.in 2020-09-14 00:00:48 +00:00
Joel Brobecker
423e52cef3 Bump GDB version number to 10.0.90.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 10.0.90.DATE-git.
2020-09-12 20:06:27 -07:00
Joel Brobecker
46ecde124e Document the GDB 10.0.90 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 10.0.90 released.
2020-09-12 20:06:13 -07:00
Joel Brobecker
f1e420ce92 Set GDB version number to 10.0.90.
gdb/ChangeLog:

	* version.in: Set GDB version number to 10.0.90.
2020-09-12 19:57:18 -07:00
Joel Brobecker
c527795867 gdb/NEWS: Change "since GDB 9" to "in GDB 10"
gdb/ChangeLog:

	* NEWS: Change "Changes since GDB 9" to "Changes in GDB 10".
2020-09-12 19:49:53 -07:00
Joel Brobecker
713bde4c19 Set development mode to "off" by default.
bfd/ChangeLog:

	* development.sh (development): Set to false.
2020-09-12 19:34:37 -07:00
Joel Brobecker
31c6c31e02 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 (8087c3fa8b):
	* version.in: Bump version to 10.0.90.DATE-git.
2020-09-12 19:34:15 -07:00
6309 changed files with 12708 additions and 7380 deletions

View File

@@ -1,3 +1,7 @@
2020-09-13 Joel Brobecker <brobecker@adacore.com>
* development.sh (development): Set to false.
2020-09-12 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26391

View File

@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
development=true
development=false
# Indicate whether this is a release branch.
experimental=true

View File

@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
#define BFD_VERSION_DATE 20200912
#define BFD_VERSION_DATE 20210425
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

View File

@@ -1,5 +1,5 @@
;; Emacs settings.
;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by

View File

@@ -1,3 +1,393 @@
2021-04-25 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 10.2.
2021-04-22 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27757
* python/py-type.c (typy_range): Check that bounds are constant
before accessing them as such.
* guile/scm-type.c (gdbscm_type_range): Likewise.
2021-04-22 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27757
* python/py-type.c (typy_range): Check that bounds are constant
before accessing them as such.
* guile/scm-type.c (gdbscm_type_range): Likewise.
2021-03-30 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27541
* dwarf2/read.c (dwarf2_has_info): Don't share dwarf2_per_bfd
with objfiles using READNOW.
2021-03-12 Christian Biesinger <cbiesinger@google.com>
PR threads/27239
* cp-support.c: Use scoped_segv_handler_restore.
* event-top.c (thread_local_segv_handler): Made static.
(scoped_segv_handler_restore::scoped_segv_handler_restore):
New function.
(scoped_segv_handler_restore::~scoped_segv_handler_restore): New
function.
* event-top.h (class scoped_segv_handler_restore): New class.
(thread_local_segv_handler): Removed.
2021-03-07 Tom de Vries <tdevries@suse.de>
PR symtab/27341
* dwarf2/read.c (read_array_type): Return NULL when not being able to
construct an array type. Add assert to ensure that element_type is
not being modified.
2021-03-06 Kevin Buettner <kevinb@redhat.com>
PR build/27536
* nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
<sys/ptrace.h>.
2021-03-06 Kevin Buettner <kevinb@redhat.com>
PR build/27535
* nat/amd64-linux-siginfo.c: Include "gdbsupport/common-defs.h"
(which in turn includes <gnulib/config.h>) before include
of <signal.h>.
2021-03-06 Tom de Vries <tdevries@suse.de>
PR symtab/27333
* dwarf2/read.c (process_psymtab_comp_unit): Handle DW_TAG_type_unit.
2021-03-04 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27147
* sparc-nat.h (sparc_fetch_inferior_registers): Add
process_stratum_target parameter,
sparc_store_inferior_registers): update callers.
* sparc-nat.c (sparc_fetch_inferior_registers,
sparc_store_inferior_registers): Add process_stratum_target
parameter. Switch current thread before calling
sparc_supply_gregset / sparc_collect_rwindow.
(sparc_store_inferior_registers): Likewise.
* sparc-obsd-tdep.c (sparc32obsd_supply_uthread): Add assertion.
(sparc32obsd_collect_uthread): Likewise.
* sparc-tdep.c (sparc_supply_rwindow, sparc_collect_rwindow):
Add assertion.
* sparc64-obsd-tdep.c (sparc64obsd_collect_uthread,
sparc64obsd_supply_uthread): Add assertion.
2021-02-25 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/26861
* target.c (target_mourn_inferior): Only compare pids in
target_mourn_inferior.
2021-02-23 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/26828
* dwarf2/read.c (dwarf2_queue_guard) <dwarf2_queue_guard>:
Instantiate queue.
(~dwarf2_queue_guard): Clear queue.
(queue_comp_unit): Assert that queue is
instantiated.
(process_queue): Adjust.
* dwarf2/read.h (struct dwarf2_per_bfd) <queue>: Make optional.
2021-02-23 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/26828
* dwarf2/read.c (maybe_queue_comp_unit): Check if CU is expanded
to decide whether or not to enqueue it for expansion.
(follow_die_offset, follow_die_sig_1): Ensure we load the DIEs
after calling maybe_queue_comp_unit.
2021-02-22 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27435
* inf-ptrace.c (struct target_unpusher): Move to target.h.
(target_unpush_up): Likewise.
* procfs.c (procfs_target::attach): Push target early. Use
target_unpush_up to unpush target in case of error.
* target.h (struct target_unpusher): Move here.
(target_unpush_up): Likewise.
2021-02-09 Shahab Vahedi <shahab@synopsys.com>
PR build/27385
* arch/arc.c (arc_lookup_target_description): Use
target_desc_up() ctor explicitly.
2021-02-08 Shahab Vahedi <shahab@synopsys.com>
PR tdep/27369
* arc-linux-tdep.c (handle_atomic_sequence): New.
(arc_linux_software_single_step): Call handle_atomic_sequence().
2021-02-05 Tom de Vries <tdevries@suse.de>
PR breakpoints/27330
* breakpoint.c (create_exception_master_breakpoint): Handle case that
glibc object file has debug info.
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
PR gdb/26813
* dwarf2/read.c (read_loclists_rnglists_header): Add
header_offset parameter and use it.
(read_loclist_index): Read header of the current contribution,
not the one at the beginning of the section.
(read_rnglist_index): Likewise.
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
* dwarf2/read.c (read_loclist_index): Add bound check for the end
of the offset.
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
* dwarf2/read.c (read_rnglist_index): Fix bound check.
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
* dwarf2/read.c (read_loclist_index): Change complaints into
errors.
2021-01-08 Tom de Vries <tdevries@suse.de>
PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here. Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.
2021-01-07 Pedro Alves <pedro@palves.net>
Simon Marchi <simon.marchi@polymtl.ca>
Tom de Vries <tdevries@suse.de>
PR remote/26614
* remote.c (remote_async_inferior_event_handler): Hold a strong
reference to the remote target while handling an event.
2021-01-01 Joel Brobecker <brobecker@adacore.com>
* gdbarch.sh: Update copyright year range.
2021-01-01 Joel Brobecker <brobecker@adacore.com>
Update copyright year range in copyright header of all GDB files.
2021-01-01 Joel Brobecker <brobecker@adacore.com>
* copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
to the list of directories to update.
2021-01-01 Joel Brobecker <brobecker@adacore.com>
* top.c (print_gdb_version): Update copyright year.
2020-12-09 Simon Marchi <simon.marchi@polymtl.ca>
* gdbtypes.c (get_discrete_low_bound, get_discrete_high_bound):
Return {} instead of false.
(get_discrete_bounds): Compute high bound only if low bound is
valid.
2020-12-09 Simon Marchi <simon.marchi@efficios.com>
PR 26875, PR 26901
* gdbtypes.c (get_discrete_low_bound): Make non-static.
(get_discrete_high_bound): Make non-static.
* gdbtypes.h (get_discrete_low_bound): New declaration.
(get_discrete_high_bound): New declaration.
* valarith.c (value_subscript): Only fetch high bound if
necessary.
2020-12-09 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.c (get_discrete_bounds): Implement with
get_discrete_low_bound and get_discrete_high_bound.
(get_discrete_low_bound): New.
(get_discrete_high_bound): New.
2020-12-09 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (get_discrete_bounds): Return bool, adjust all
callers.
* gdbtypes.c (get_discrete_bounds): Return bool.
2020-12-09 Simon Marchi <simon.marchi@efficios.com>
* ada-lang.c (ada_value_slice_from_ptr): Adjust.
(ada_value_slice): Adjust.
(pos_atr): Adjust.
* gdbtypes.c (get_discrete_bounds): Adjust.
(discrete_position): Return optional.
* gdbtypes.h (discrete_position): Return optional.
2020-12-06 Giancarlo Frix <gfrix@rocketsoftware.com> (tiny change)
PR breakpoints/27009
* s390-tdep.h (op_bc): Correct BC opcode value.
2020-12-04 Shahab Vahedi <shahab@synopsys.com>
PR tdep/27015
* arc-linux-tdep.c (collect_register): Populate "eret" by
"pc" value from the regcache when asked for "pc" value.
2020-11-29 Hannes Domani <ssbssa@yahoo.de>
PR tui/26973
* tui/tui-layout.c (tui_apply_current_layout): Don't delete the
static locator win info.
2020-11-06 Romain Geissler <romain.geissler@amadeus.com>
PR python/26832
* configure: Regenerate.
* configure.ac: Check for python modules ctypes instead of
itertools.
2020-10-24 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 10.1.90.DATE-git.
2020-10-24 Joel Brobecker <brobecker@adacore.com>
GDB 10.1 released.
2020-10-24 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 10.1.
2020-10-22 Hannes Domani <ssbssa@yahoo.de>
* gdbtypes.c (init_complex_type): Check target type name.
2020-10-22 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/26693
* dwarf2/read.c (load_full_comp_unit): Add existing_cu
parameter.
(load_cu): Pass existing CU.
(process_imported_unit_die): Likewise.
(follow_die_offset): Likewise.
2020-10-14 Mihails Strasuns <mihails.strasuns@intel.com>
* breakpoint.c (handle_jit_event): Add an argument, change how
`jit_event_handler` is called.
2020-10-13 Simon Marchi <simon.marchi@polymtl.ca>
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.
2020-10-08 Shahab Vahedi <shahab@synopsys.com>
* NEWS: Mention ARC support in GDBserver.
2020-10-07 Anton Kolesov <anton.kolesov@synopsys.com>
* 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.
2020-10-07 Shahab Vahedi <shahab@synopsys.com>
* arch/arc.h: Rename "arc_gdbarch_features" to
"arc_arch_features".
* arc-tdep.h: Likewise.
* arc-tdep.c: Likewise.
2020-09-28 Gareth Rees <grees@undo.io> (tiny change)
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.
2020-09-25 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* breakpoint.c (commands_command_1): Make a copy of the 'arg'
argument.
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.
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.
2020-09-18 Victor Collod <vcollod@nvidia.com>
PR gdb/26635
* i386-tdep.c (i386_skip_endbr): Add a helper function to skip endbr.
(i386_analyze_prologue): Call i386_skip_endbr.
2020-09-18 Pedro Alves <pedro@palves.net>
PR gdb/26631
* thread.c (thread_find_command): Switch inferior before calling
target methods.
2020-09-16 Tom Tromey <tromey@adacore.com>
PR gdb/26598:
* infrun.c (fill_in_stop_func): Use find_pc_partial_function_sym.
2020-09-14 Fredrik Hederstierna <fredrik.hederstierna@verisure.com>
Adam Renquinha <arenquinha@cimeq.qc.ca>
* arm-tdep.c (arm_m_exception_cache): Try use correct stack
pointer and stack frame offset when unwinding.
2020-09-13 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 10.0.90.DATE-git.
2020-09-13 Joel Brobecker <brobecker@adacore.com>
GDB 10.0.90 released.
2020-09-13 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 10.0.90.
2020-09-13 Joel Brobecker <brobecker@adacore.com>
* NEWS: Change "Changes since GDB 9" to "Changes in GDB 10".
2020-09-13 Joel Brobecker <brobecker@adacore.com>
GDB 10 branch created (8087c3fa8b5d695e3e29e69d70d0b35ec902ac59):
* version.in: Bump version to 10.0.90.DATE-git.
2020-09-12 Joel Brobecker <brobecker@adacore.com>
* infrun.c (namespace selftests): Only define #if GDB_SELF_TEST.

View File

@@ -1,4 +1,4 @@
# Copyright (C) 1989-2020 Free Software Foundation, Inc.
# Copyright (C) 1989-2021 Free Software Foundation, Inc.
# This file is part of GDB.

View File

@@ -1,7 +1,7 @@
What has changed in GDB?
(Organized release by release)
*** Changes since GDB 9
*** Changes in GDB 10
* There are new feature names for ARC targets: "org.gnu.gdb.arc.core"
and "org.gnu.gdb.arc.aux". The old names are still supported but
@@ -47,6 +47,8 @@
* New features in the GDB remote stub, GDBserver
** GDBserver is now supported on ARC GNU/Linux.
** GDBserver is now supported on RISC-V GNU/Linux.
** GDBserver no longer supports these host triplets:

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
/* Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
/* Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/aarch64.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/aarch64.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* FreeBSD/aarch64 target support, prototypes.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux AArch64.
Copyright (C) 2011-2020 Free Software Foundation, Inc.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux AArch64.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* GNU/Linux on AArch64 target support, prototypes.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for Newlib AArch64.
Copyright (C) 2011-2020 Free Software Foundation, Inc.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Ravenscar Aarch64 target support.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Ravenscar Aarch64 target support.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on AArch64 systems.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on AArch64 systems.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -83,7 +83,7 @@ m4_include([../config/ax_pthread.m4])
## From Franc,ois Pinard ##
## ----------------------------------------- ##
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,4 +1,4 @@
# Copyright (C) 1992-2020 Free Software Foundation, Inc.
# Copyright (C) 1992-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without

View File

@@ -1,5 +1,5 @@
/* YACC parser for Ada expressions, for GDB.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Ada language support routines for GDB, the GNU debugger.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GDB.
@@ -2097,7 +2097,7 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE
&& is_dynamic_type (check_typedef (index_type)))
|| get_discrete_bounds (index_type, &low_bound, &high_bound) < 0)
|| !get_discrete_bounds (index_type, &low_bound, &high_bound))
low_bound = high_bound = 0;
if (high_bound < low_bound)
*elt_bits = TYPE_LENGTH (new_type) = 0;
@@ -2243,7 +2243,7 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
LONGEST lowerbound, upperbound;
LONGEST idx;
if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
{
lim_warning (_("don't know bounds of array"));
lowerbound = upperbound = 0;
@@ -2759,11 +2759,13 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type0, 0));
int base_low = ada_discrete_type_low_bound (type0->index_type ());
LONGEST base_low_pos, low_pos;
gdb::optional<LONGEST> base_low_pos, low_pos;
CORE_ADDR base;
if (!discrete_position (base_index_type, low, &low_pos)
|| !discrete_position (base_index_type, base_low, &base_low_pos))
low_pos = discrete_position (base_index_type, low);
base_low_pos = discrete_position (base_index_type, base_low);
if (!low_pos.has_value () || !base_low_pos.has_value ())
{
warning (_("unable to get positions in slice, use bounds instead"));
low_pos = low;
@@ -2771,7 +2773,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
}
base = value_as_address (array_ptr)
+ ((low_pos - base_low_pos)
+ ((*low_pos - *base_low_pos)
* TYPE_LENGTH (TYPE_TARGET_TYPE (type0)));
return value_at_lazy (slice_type, base);
}
@@ -2788,10 +2790,13 @@ ada_value_slice (struct value *array, int low, int high)
(NULL, TYPE_TARGET_TYPE (type), index_type,
type->dyn_prop (DYN_PROP_BYTE_STRIDE),
TYPE_FIELD_BITSIZE (type, 0));
LONGEST low_pos, high_pos;
gdb::optional<LONGEST> low_pos, high_pos;
if (!discrete_position (base_index_type, low, &low_pos)
|| !discrete_position (base_index_type, high, &high_pos))
low_pos = discrete_position (base_index_type, low);
high_pos = discrete_position (base_index_type, high);
if (!low_pos.has_value () || !high_pos.has_value ())
{
warning (_("unable to get positions in slice, use bounds instead"));
low_pos = low;
@@ -2799,7 +2804,7 @@ ada_value_slice (struct value *array, int low, int high)
}
return value_cast (slice_type,
value_slice (array, low, high_pos - low_pos + 1));
value_slice (array, low, *high_pos - *low_pos + 1));
}
/* If type is a record type in the form of a standard GNAT array
@@ -8861,15 +8866,15 @@ pos_atr (struct value *arg)
{
struct value *val = coerce_ref (arg);
struct type *type = value_type (val);
LONGEST result;
if (!discrete_type_p (type))
error (_("'POS only defined on discrete types"));
if (!discrete_position (type, value_as_long (val), &result))
gdb::optional<LONGEST> result = discrete_position (type, value_as_long (val));
if (!result.has_value ())
error (_("enumeration value is invalid: can't find 'POS"));
return result;
return *result;
}
static struct value *

View File

@@ -1,6 +1,6 @@
/* Ada language support definitions for GDB, the GNU debugger.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* FLEX lexer for Ada expressions, for GDB.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Ada language operator definitions for GDB, the GNU debugger.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Support for printing Ada types for GDB, the GNU debugger.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Support for printing Ada values for GDB, the GNU debugger.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.
@@ -136,7 +136,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
{
LONGEST high;
if (get_discrete_bounds (index_type, &low, &high) < 0)
if (!get_discrete_bounds (index_type, &low, &high))
len = 1;
else if (low > high)
{

View File

@@ -1,6 +1,6 @@
/* varobj support for Ada.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* addrmap.c --- implementation of address map data structure.
Copyright (C) 2007-2020 Free Software Foundation, Inc.
Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* addrmap.h --- interface to address map data structure.
Copyright (C) 2007-2020 Free Software Foundation, Inc.
Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
/* Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Low level interface for debugging AIX 4.3+ pthreads.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2021 Free Software Foundation, Inc.
Written by Nick Duffek <nsd@redhat.com>.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Shared allocation functions for GDB, the GNU debugger.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for Alpha BSD's.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code Alpha BSD's.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for Alpha BSD's.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Low level Alpha GNU/Linux interface, for GDB when running native.
Copyright (C) 2005-2020 Free Software Foundation, Inc.
Copyright (C) 2005-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Target-dependent code for GNU/Linux on Alpha.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Target-dependent mdebug code for the ALPHA architecture.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/alpha.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/alpha.
Copyright (C) 2006-2020 Free Software Foundation, Inc.
Copyright (C) 2006-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Common target dependent code for GDB on Alpha systems.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64 BSD's.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for modern AMD64 BSD's.
Copyright (C) 2018-2020 Free Software Foundation, Inc.
Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Darwin support for GDB, the GNU debugger.
Copyright (C) 1997-2020 Free Software Foundation, Inc.
Copyright (C) 1997-2021 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for Darwin x86-64.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for DICOS running on x86-64's, for GDB.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for FreeBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for FreeBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86-64.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux x86-64.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux AMD64.
Copyright (C) 2006-2020 Free Software Foundation, Inc.
Copyright (C) 2006-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for AMD64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for NetBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for NetBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Native-dependent code for OpenBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for OpenBSD/amd64.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for AMD64 Solaris.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Joseph Myers, CodeSourcery, LLC.

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for AMD64.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.

View File

@@ -1,6 +1,6 @@
/* Target-dependent definitions for AMD64.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2008-2020 Free Software Foundation, Inc.
/* Copyright (C) 2008-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
/* Copyright (C) 2009-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Annotation routines for GDB.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Annotation routines for GDB.
Copyright (C) 1986-2020 Free Software Foundation, Inc.
Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target dependent code for GNU/Linux ARC.
Copyright 2020 Free Software Foundation, Inc.
Copyright 2020-2021 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,7 +27,65 @@
/* ARC header files. */
#include "opcodes/arc-dis.h"
#include "arc-linux-tdep.h"
#include "arc-tdep.h"
#include "arch/arc.h"
#define REGOFF(offset) (offset * ARC_REGISTER_SIZE)
/* arc_linux_core_reg_offsets[i] is the offset in the .reg section of GDB
regnum i. Array index is an internal GDB register number, as defined in
arc-tdep.h:arc_regnum.
From include/uapi/asm/ptrace.h in the ARC Linux sources. */
/* The layout of this struct is tightly bound to "arc_regnum" enum
in arc-tdep.h. Any change of order in there, must be reflected
here as well. */
static const int arc_linux_core_reg_offsets[] = {
/* R0 - R12. */
REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19),
REGOFF (18), REGOFF (17), REGOFF (16), REGOFF (15),
REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
REGOFF (10),
/* R13 - R25. */
REGOFF (37), REGOFF (36), REGOFF (35), REGOFF (34),
REGOFF (33), REGOFF (32), REGOFF (31), REGOFF (30),
REGOFF (29), REGOFF (28), REGOFF (27), REGOFF (26),
REGOFF (25),
REGOFF (9), /* R26 (GP) */
REGOFF (8), /* FP */
REGOFF (23), /* SP */
ARC_OFFSET_NO_REGISTER, /* ILINK */
ARC_OFFSET_NO_REGISTER, /* R30 */
REGOFF (7), /* BLINK */
/* R32 - R59. */
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER,
REGOFF (4), /* LP_COUNT */
ARC_OFFSET_NO_REGISTER, /* RESERVED */
ARC_OFFSET_NO_REGISTER, /* LIMM */
ARC_OFFSET_NO_REGISTER, /* PCL */
REGOFF (39), /* PC */
REGOFF (5), /* STATUS32 */
REGOFF (2), /* LP_START */
REGOFF (3), /* LP_END */
REGOFF (1), /* BTA */
REGOFF (6) /* ERET */
};
/* Implement the "cannot_fetch_register" gdbarch method. */
@@ -97,6 +155,78 @@ arc_linux_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
: arc_linux_trap_s_le);
}
/* Check for an atomic sequence of instructions beginning with an
LLOCK instruction and ending with a SCOND instruction.
These patterns are hand coded in libc's (glibc and uclibc). Take
a look at [1] for instance:
main+14: llock r2,[r0]
main+18: brne.nt r2,0,main+30
main+22: scond r3,[r0]
main+26: bne main+14
main+30: mov_s r0,0
If such a sequence is found, attempt to step over it.
A breakpoint is placed at the end of the sequence.
This function expects the INSN to be a "llock(d)" instruction.
[1]
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/ \
sysdeps/linux/arc/bits/atomic.h#n46
*/
static std::vector<CORE_ADDR>
handle_atomic_sequence (arc_instruction insn, disassemble_info &di)
{
const int atomic_seq_len = 24; /* Instruction sequence length. */
std::vector<CORE_ADDR> next_pcs;
/* Sanity check. */
gdb_assert (insn.insn_class == LLOCK);
/* Data size we are dealing with: LLOCK vs. LLOCKD */
arc_ldst_data_size llock_data_size_mode = insn.data_size_mode;
/* Indicator if any conditional branch is found in the sequence. */
bool found_bc = false;
/* Becomes true if "LLOCK(D) .. SCOND(D)" sequence is found. */
bool is_pattern_valid = false;
for (int insn_count = 0; insn_count < atomic_seq_len; ++insn_count)
{
arc_insn_decode (arc_insn_get_linear_next_pc (insn),
&di, arc_delayed_print_insn, &insn);
if (insn.insn_class == BRCC)
{
/* If more than one conditional branch is found, this is not
the pattern we are interested in. */
if (found_bc)
break;
found_bc = true;
continue;
}
/* This is almost a happy ending. */
if (insn.insn_class == SCOND)
{
/* SCOND should match the LLOCK's data size. */
if (insn.data_size_mode == llock_data_size_mode)
is_pattern_valid = true;
break;
}
}
if (is_pattern_valid)
{
/* Get next instruction after scond(d). There is no limm. */
next_pcs.push_back (insn.address + insn.length);
}
return next_pcs;
}
/* Implement the "software_single_step" gdbarch method. */
static std::vector<CORE_ADDR>
@@ -110,8 +240,11 @@ arc_linux_software_single_step (struct regcache *regcache)
struct arc_instruction curr_insn;
arc_insn_decode (regcache_read_pc (regcache), &di, arc_delayed_print_insn,
&curr_insn);
CORE_ADDR next_pc = arc_insn_get_linear_next_pc (curr_insn);
if (curr_insn.insn_class == LLOCK)
return handle_atomic_sequence (curr_insn, di);
CORE_ADDR next_pc = arc_insn_get_linear_next_pc (curr_insn);
std::vector<CORE_ADDR> next_pcs;
/* For instructions with delay slots, the fall thru is not the
@@ -227,6 +360,140 @@ arc_linux_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
}
}
void
arc_linux_supply_gregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *gregs, size_t size)
{
gdb_static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
const bfd_byte *buf = (const bfd_byte *) gregs;
for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++)
if (arc_linux_core_reg_offsets[reg] != ARC_OFFSET_NO_REGISTER)
regcache->raw_supply (reg, buf + arc_linux_core_reg_offsets[reg]);
}
void
arc_linux_supply_v2_regset (const struct regset *regset,
struct regcache *regcache, int regnum,
const void *v2_regs, size_t size)
{
const bfd_byte *buf = (const bfd_byte *) v2_regs;
/* user_regs_arcv2 is defined in linux arch/arc/include/uapi/asm/ptrace.h. */
regcache->raw_supply (ARC_R30_REGNUM, buf);
regcache->raw_supply (ARC_R58_REGNUM, buf + REGOFF (1));
regcache->raw_supply (ARC_R59_REGNUM, buf + REGOFF (2));
}
/* Populate BUF with register REGNUM from the REGCACHE. */
static void
collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
int regnum, gdb_byte *buf)
{
int offset;
/* Skip non-existing registers. */
if (arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER)
return;
/* The address where the execution has stopped is in pseudo-register
STOP_PC. However, when kernel code is returning from the exception,
it uses the value from ERET register. Since, TRAP_S (the breakpoint
instruction) commits, the ERET points to the next instruction. In
other words: ERET != STOP_PC. To jump back from the kernel code to
the correct address, ERET must be overwritten by GDB's STOP_PC. Else,
the program will continue at the address after the current instruction.
*/
if (regnum == gdbarch_pc_regnum (gdbarch))
offset = arc_linux_core_reg_offsets[ARC_ERET_REGNUM];
else
offset = arc_linux_core_reg_offsets[regnum];
regcache->raw_collect (regnum, buf + offset);
}
void
arc_linux_collect_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t size)
{
gdb_static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
gdb_byte *buf = (gdb_byte *) gregs;
struct gdbarch *gdbarch = regcache->arch ();
/* regnum == -1 means writing all the registers. */
if (regnum == -1)
for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++)
collect_register (regcache, gdbarch, reg, buf);
else if (regnum <= ARC_LAST_REGNUM)
collect_register (regcache, gdbarch, regnum, buf);
else
gdb_assert_not_reached ("Invalid regnum in arc_linux_collect_gregset.");
}
void
arc_linux_collect_v2_regset (const struct regset *regset,
const struct regcache *regcache, int regnum,
void *v2_regs, size_t size)
{
bfd_byte *buf = (bfd_byte *) v2_regs;
regcache->raw_collect (ARC_R30_REGNUM, buf);
regcache->raw_collect (ARC_R58_REGNUM, buf + REGOFF (1));
regcache->raw_collect (ARC_R59_REGNUM, buf + REGOFF (2));
}
/* Linux regset definitions. */
static const struct regset arc_linux_gregset = {
arc_linux_core_reg_offsets,
arc_linux_supply_gregset,
arc_linux_collect_gregset,
};
static const struct regset arc_linux_v2_regset = {
NULL,
arc_linux_supply_v2_regset,
arc_linux_collect_v2_regset,
};
/* Implement the `iterate_over_regset_sections` gdbarch method. */
static void
arc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
iterate_over_regset_sections_cb *cb,
void *cb_data,
const struct regcache *regcache)
{
/* There are 40 registers in Linux user_regs_struct, although some of
them are now just a mere paddings, kept to maintain binary
compatibility with older tools. */
const int sizeof_gregset = 40 * ARC_REGISTER_SIZE;
cb (".reg", sizeof_gregset, sizeof_gregset, &arc_linux_gregset, NULL,
cb_data);
cb (".reg-arc-v2", ARC_LINUX_SIZEOF_V2_REGSET, ARC_LINUX_SIZEOF_V2_REGSET,
&arc_linux_v2_regset, NULL, cb_data);
}
/* Implement the `core_read_description` gdbarch method. */
static const struct target_desc *
arc_linux_core_read_description (struct gdbarch *gdbarch,
struct target_ops *target,
bfd *abfd)
{
arc_arch_features features
= arc_arch_features_create (abfd,
gdbarch_bfd_arch_info (gdbarch)->mach);
return arc_lookup_target_description (features);
}
/* Initialization specific to Linux environment. */
static void
@@ -260,6 +527,9 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_software_single_step (gdbarch, arc_linux_software_single_step);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, arc_linux_skip_solib_resolver);
set_gdbarch_iterate_over_regset_sections
(gdbarch, arc_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch, arc_linux_core_read_description);
/* GNU/Linux uses SVR4-style shared libraries, with 32-bit ints, longs
and pointers (ILP32). */

52
gdb/arc-linux-tdep.h Normal file
View File

@@ -0,0 +1,52 @@
/* Target dependent code for GNU/Linux ARC.
Copyright 2020-2021 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef ARC_LINUX_TDEP_H
#define ARC_LINUX_TDEP_H
#include "gdbarch.h"
#include "regset.h"
#define ARC_LINUX_SIZEOF_V2_REGSET (3 * ARC_REGISTER_SIZE)
/* Reads registers from the NT_PRSTATUS data array into the regcache. */
void arc_linux_supply_gregset (const struct regset *regset,
struct regcache *regcache, int regnum,
const void *gregs, size_t size);
/* Reads regsiters from the NT_ARC_V2 data array into the regcache. */
void arc_linux_supply_v2_regset (const struct regset *regset,
struct regcache *regcache, int regnum,
const void *v2_regs, size_t size);
/* Writes registers from the regcache into the NT_PRSTATUS data array. */
void arc_linux_collect_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t size);
/* Writes registers from the regcache into the NT_ARC_V2 data array. */
void arc_linux_collect_v2_regset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *v2_regs, size_t size);
#endif /* ARC_LINUX_TDEP_H */

View File

@@ -1,6 +1,6 @@
/* Target-dependent code for Newlib ARC.
Copyright (C) 2016-2020 Free Software Foundation, Inc.
Copyright (C) 2016-2021 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target dependent code for ARC architecture, for GDB.
Copyright 2005-2020 Free Software Foundation, Inc.
Copyright 2005-2021 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
@@ -1883,11 +1883,10 @@ mach_type_to_arc_isa (const unsigned long mach)
}
}
/* Common construction code for ARC_GDBARCH_FEATURES struct. If there
is no ABFD, then a FEATURE with default values is returned. */
/* See arc-tdep.h. */
static arc_gdbarch_features
arc_gdbarch_features_create (const bfd *abfd, const unsigned long mach)
arc_arch_features
arc_arch_features_create (const bfd *abfd, const unsigned long mach)
{
/* Use 4 as a fallback value. */
int reg_size = 4;
@@ -1915,7 +1914,7 @@ arc_gdbarch_features_create (const bfd *abfd, const unsigned long mach)
case). */
arc_isa isa = mach_type_to_arc_isa (mach);
return arc_gdbarch_features (reg_size, isa);
return arc_arch_features (reg_size, isa);
}
/* Look for obsolete core feature names in TDESC. */
@@ -2085,9 +2084,9 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
/* If target doesn't provide a description, use the default ones. */
if (!tdesc_has_registers (tdesc_loc))
{
arc_gdbarch_features features
= arc_gdbarch_features_create (info.abfd,
info.bfd_arch_info->mach);
arc_arch_features features
= arc_arch_features_create (info.abfd,
info.bfd_arch_info->mach);
tdesc_loc = arc_lookup_target_description (features);
}
gdb_assert (tdesc_loc != nullptr);

View File

@@ -1,6 +1,6 @@
/* Target dependent code for ARC architecture, for GDB.
Copyright 2005-2020 Free Software Foundation, Inc.
Copyright 2005-2021 Free Software Foundation, Inc.
Contributed by Synopsys Inc.
This file is part of GDB.
@@ -85,7 +85,9 @@ enum arc_regnum
ARC_LP_END_REGNUM,
/* Branch target address. */
ARC_BTA_REGNUM,
ARC_LAST_AUX_REGNUM = ARC_BTA_REGNUM,
/* Exception return address. */
ARC_ERET_REGNUM,
ARC_LAST_AUX_REGNUM = ARC_ERET_REGNUM,
ARC_LAST_REGNUM = ARC_LAST_AUX_REGNUM,
/* Additional ABI constants. */
@@ -105,6 +107,9 @@ enum arc_regnum
/* STATUS32 register: current instruction is a delay slot. */
#define ARC_STATUS32_DE_MASK (1 << 6)
/* Special value for register offset arrays. */
#define ARC_OFFSET_NO_REGISTER (-1)
#define arc_print(fmt, args...) fprintf_unfiltered (gdb_stdlog, fmt, ##args)
extern int arc_debug;
@@ -182,4 +187,9 @@ CORE_ADDR arc_insn_get_branch_target (const struct arc_instruction &insn);
CORE_ADDR arc_insn_get_linear_next_pc (const struct arc_instruction &insn);
/* Create an arc_arch_features instance from the provided data. */
arc_arch_features arc_arch_features_create (const bfd *abfd,
const unsigned long mach);
#endif /* ARC_TDEP_H */

View File

@@ -1,6 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Copyright (C) 1998-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Copyright (C) 1998-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
/* Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
/* Copyright (C) 2019-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
/* Copyright (C) 2009-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
/* Copyright (C) 2009-2021 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target-dependent functionality for AArch64.
Copyright (C) 2017-2020 Free Software Foundation, Inc.
Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,7 +35,7 @@
#endif
STATIC_IN_GDB target_desc *
arc_create_target_description (const struct arc_gdbarch_features &features)
arc_create_target_description (const struct arc_arch_features &features)
{
/* Create a new target description. */
target_desc *tdesc = allocate_target_description ();
@@ -84,10 +84,10 @@ arc_create_target_description (const struct arc_gdbarch_features &features)
#ifndef GDBSERVER
/* Wrapper used by std::unordered_map to generate hash for features set. */
struct arc_gdbarch_features_hasher
struct arc_arch_features_hasher
{
std::size_t
operator() (const arc_gdbarch_features &features) const noexcept
operator() (const arc_arch_features &features) const noexcept
{
return features.hash ();
}
@@ -95,14 +95,14 @@ struct arc_gdbarch_features_hasher
/* Cache of previously created target descriptions, indexed by the hash
of the features set used to create them. */
static std::unordered_map<arc_gdbarch_features,
static std::unordered_map<arc_arch_features,
const target_desc_up,
arc_gdbarch_features_hasher> arc_tdesc_cache;
arc_arch_features_hasher> arc_tdesc_cache;
/* See arch/arc.h. */
const target_desc *
arc_lookup_target_description (const struct arc_gdbarch_features &features)
arc_lookup_target_description (const struct arc_arch_features &features)
{
/* Lookup in the cache first. If found, return the pointer from the
"target_desc_up" type which is a "unique_ptr". This should be fine
@@ -113,8 +113,9 @@ arc_lookup_target_description (const struct arc_gdbarch_features &features)
target_desc *tdesc = arc_create_target_description (features);
/* Add the newly created target description to the repertoire. */
arc_tdesc_cache.emplace (features, tdesc);
/* Add the newly created target description to the repertoire.
PR build/27385: Use "target_desc_up ()" ctor explicitly. */
arc_tdesc_cache.emplace (features, target_desc_up (tdesc));
return tdesc;
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,9 +27,9 @@ enum arc_isa
ARC_ISA_ARCV2 /* such as ARC EM and ARC HS */
};
struct arc_gdbarch_features
struct arc_arch_features
{
arc_gdbarch_features (int reg_size, arc_isa isa)
arc_arch_features (int reg_size, arc_isa isa)
: reg_size (reg_size), isa (isa)
{}
@@ -41,13 +41,13 @@ struct arc_gdbarch_features
const arc_isa isa;
/* Equality operator. */
bool operator== (const struct arc_gdbarch_features &rhs) const
bool operator== (const struct arc_arch_features &rhs) const
{
return (reg_size == rhs.reg_size && isa == rhs.isa);
}
/* Inequality operator. */
bool operator!= (const struct arc_gdbarch_features &rhs) const
bool operator!= (const struct arc_arch_features &rhs) const
{
return !(*this == rhs);
}
@@ -71,7 +71,7 @@ struct arc_gdbarch_features
the returned data. */
target_desc *arc_create_target_description
(const struct arc_gdbarch_features &features);
(const struct arc_arch_features &features);
#else
@@ -79,7 +79,7 @@ target_desc *arc_create_target_description
If nothing is found, then create one and return it. */
const target_desc *arc_lookup_target_description
(const struct arc_gdbarch_features &features);
(const struct arc_arch_features &features);
#endif /* GDBSERVER */

View File

@@ -1,6 +1,6 @@
/* Common code for ARM software single stepping support.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common code for ARM software single stepping support.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on ARM systems.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on ARM systems.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GDB on ARM systems.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,5 +1,5 @@
/* Common target dependent code for GDB on ARM systems.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
/* Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on PPC systems.
Copyright (C) 2018-2020 Free Software Foundation, Inc.
Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Common target dependent code for GNU/Linux on PPC systems.
Copyright (C) 2018-2020 Free Software Foundation, Inc.
Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,6 +1,6 @@
/* Target description declarations shared between gdb, gdbserver and IPA.
Copyright (C) 2018-2020 Free Software Foundation, Inc.
Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GDB.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2018-2020 Free Software Foundation, Inc.
/* Copyright (C) 2018-2021 Free Software Foundation, Inc.
This file is part of GDB.

Some files were not shown because too many files have changed in this diff Show More