107039 Commits

Author SHA1 Message Date
c1e5e7a4ad ci: add checksum file to release 2022-02-11 15:29:37 +03:00
cce30f0400 testsuite: fix simesp runto_main and symbols loading
add more tests to run
set esp-board timeout 300
2022-02-11 13:28:37 +03:00
9d96b7f59e testsuite: adapt tests for esp-emulation 2022-02-10 13:06:10 +03:00
507d541b83 Revert "gdb: xtensa: fix backtrace interrupted by a noreturn call"
This commit restores gdb functionality of stepping and backtrace commands.
From the machine code perspective, it could be additional data between
two functions, such as alignment or literal pool. But computing the position
of the previous function's last instruction is not achievable without
debugging information.
2022-02-10 13:06:04 +03:00
2155903bf7 ci: fix github release tag 2022-02-08 12:12:16 +03:00
7dfa47d1d5 ci: fix openocd testing job 2022-01-28 19:22:11 +03:00
4f08b550c8 gitmodule: xtensaconfig update
fix "bashism" in Makefile scripts
fix windows API call
2022-01-28 19:18:43 +03:00
b9923e6b05 ci: get gdb version from tag 2022-01-24 17:09:58 +03:00
7368a5dd26 ci: change release tags and archive names 2022-01-20 14:37:58 +03:00
4552dc67d2 ci: add riscv32 build 2022-01-17 13:53:18 +03:00
0e81f8525c ci: add publishing to github 2021-12-16 18:35:23 +03:00
4a6f15b7ea gitmodule: xtensaconfig update 2021-12-13 10:08:17 +03:00
4b0508710c ci: add tests for macos and windows 2021-12-13 10:08:12 +03:00
56a60ff199 ci/dejagnu: add esp32/esp32s2 specific tests 2021-12-11 00:06:19 +03:00
ce93d5dfe8 gdb: adapt python test to remote target 2021-12-09 18:37:40 +03:00
7524656b01 gdb: add simesp board for testing 2021-12-09 18:37:40 +03:00
933bd0df1d gdb: fix python initialization 2021-12-09 18:37:40 +03:00
fef548fb87 gdb: add python-config override options 2021-12-09 18:37:40 +03:00
a4221e10c2 ci: add targets for build/test/pack/private_deploy 2021-12-09 18:37:40 +03:00
caa4510b7d gdb: xtensa: make dynamically configurable with --mcpu option
Add xtensaconfig as a submodule
2021-12-09 18:37:32 +03:00
93782c784a gdb: xtensa: fix backtrace interrupted by a noreturn call
This commit fixes an issue that the backtrace will be interrupted on a
frame where a noreturn function is called. This issue doesn't occur
for every call to noreturn functions, but only for calls such that:
- the call is the last instruction of the caller function
- the next function starts immediately after this call instruction;
  in most cases this means that the caller function size is divisible
  by 4 bytes, so no padding is added between the last instruction and
  the next function.

For example, the following generated code will exhibit this issue:

    esp_system_abort:
        entry  a1, 32
        movi.n  a10, a2
        call8  panic_abort

    some_other_function:
        entry a1, 32
        ...

In this case, esp_system_abort function is 3 + 2 + 3 = 8 bytes long,
so no padding is required before "some_other_function". When the call
to panic_abort happens, the return address is set to the next
instruction, i.e. the "entry" instruction of "some_other_function".

The observed behavior is that the backtrace is interrupted:

    #0  panic_abort (details=0x3ffb5c3b "abort() was called at PC 0x400d485f on core 0")
        at $IDF_PATH/components/esp_system/panic.c:389
    #1  0x40084fb0 in esp_system_abort (
        details=0x3ffb5c3b "abort() was called at PC 0x400d485f on core 0")
        at $IDF_PATH/components/esp_system/esp_system.c:129
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

The reason is that when the unwinder inspects the instruction at the
return address in the caller frame, the instruction is an ENTRY,
which is part of the next function. Previously it was considered that
the only case when this can happen is if the frame is the outermost
frame and the entry instruction hasn't executed yet.

This commit fixes that assumption, by checking additionally if the
instruction preceding ENTRY is a call. If it is, the frame is handled
as usual.
2021-11-18 21:11:36 +03:00
284845f226 gdb/xtensa: implement xtensa_dump_tdep
xtensa_dump_tdep is useful for debugging issues related to register
mapping.
2021-11-18 21:11:36 +03:00
d669131239 gdb/xtensa: make a0-a15 pseudo registers in case of Window ABI
xtensa_pseudo_register_read/write implement access to a0-a15 registers
in the case of Window ABI. However the split between 'raw' and
'pseudo' registers was made based on the location of the first masked
register. To make access to a0-a15 go through the pseudo register
mechanism, the split should be set based on the location of a0,
instead.
2021-11-18 21:11:36 +03:00
f4c9756005 gdb/xtensa: don't supply loop registers if they are not present
When parsing a core file on hardware configurations without the
zero-overhead loop option (e.g. ESP32-S2 chip), GDB used to assert
while trying to call 'raw_supply' for lbeg, lend, lcount registers,
even though they were not set. This was because regnum == -1 was used
to indicate "supply all registers" and lbeg_regnum == -1 was used to
indicate "lbeg register not present", and regnum == lbeg_regnum check
was considered successful.
2021-11-18 21:11:36 +03:00
619caccade espcoredump: Add support to RISC-V core dump
Add support to core dump files generated by ESP32C3 boards.
GDB is now aware on how to parse the core dump regs structure.
Port from: esp-binutils-develop
2021-11-18 21:11:36 +03:00
ae1ebbd0b3 WIP: *end of prologue* detection hack
see
  http://www.esp8266.com/viewtopic.php?p=18461#p18461
  http://www.esp8266.com/viewtopic.php?p=19026#p19026
  http://www.esp8266.com/viewtopic.php?p=19683#p19683

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2021-11-17 11:35:10 +03:00
546fb7563d xtensa: make sure ar_base is initialized
ar_base is uninitialized for cores w/o windowed registers as their
regmap doesn't have register 0x0100.
Check that ar_base is initialized and if not initialize it with a0_base.

gdb/
	* xtensa-tdep.c (xtensa_derive_tdep): Make sure ar_base is
	initialized.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2021-11-17 11:34:56 +03:00
b3b53e402d ct-ng bundled patch: 0000-musl_fix.patch 2021-11-17 11:27:13 +03:00
c599303f92 Set GDB version number to 11.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 11.1.
gdb-11.1-release
2021-09-12 18:32:10 -07:00
73a2711e86 Automatic date update in version.in 2021-09-13 00:00:33 +00:00
23b81cc63e Automatic date update in version.in 2021-09-12 00:00:16 +00:00
0c177cbe0a Automatic date update in version.in 2021-09-11 00:00:19 +00:00
7883d1e157 [gdb/testsuite] Handle unrecognized command line option in gdb_compile_test
When running the gdb testsuite with gnatmake-4.8, I get many fails of the
following form:
...
gcc: error: unrecognized command line option '-fgnat-encodings=all'^M
gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error^M
compiler exited with status 1
compilation failed: gcc ... gdb.ada/O2_float_param/foo.adb
gcc: error: unrecognized command line option '-fgnat-encodings=all'
gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error
FAIL: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb
...

Fix this by marking the test unsupported instead, such that we have:
...
UNSUPPORTED: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb \
  (unsupported option '-fgnat-encodings=all')
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-09-10  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_compile_test): Handle unrecognized command line
	option.
2021-09-10 18:36:36 +02:00
55fc911ad6 Automatic date update in version.in 2021-09-10 00:00:19 +00:00
b06653b60a Add ChangeLog entry for previous patch
I forgot to 'git commit' the ChangeLog for the previous patch.

2021-09-08  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.h (dwarf2_per_objfile::resize_symtabs): Remove.
	* dwarf2/read.c (all_comp_units_iterator, all_comp_units_range):
	New classes.
	(dwarf2_per_objfile::symtab_set_p)
	(dwarf2_per_objfile::get_symtab, dwarf2_per_objfile::set_symtab):
	Adjust to resizeable vectors.
	(dwarf2_gdb_index::expand_symtabs_matching)
	(dwarf2_base_index_functions::map_symbol_filenames)
	(dwarf2_debug_names_index::expand_symtabs_matching): Use
	all_comp_units_range.
	(dwarf2_initialize_objfile, dwarf2_build_psymtabs)
	(add_type_unit): Don't call resize_symtabs.
2021-09-09 09:58:12 -06:00
5e6741a157 [gdb/testsuite] Fix gdb.base/coredump-filter-build-id.exp with older eu-unstrip
On openSUSE Leap 42.3 with eu-unstrip 0.158, we run into:
...
(gdb) PASS: gdb.base/coredump-filter-build-id.exp: save corefile
First line of eu-unstrip: \
  0x400000+0x202000 f4ae8502bd6a14770182382316bc595e9dc6f08b@0x400284 - - [exe]
FAIL: gdb.base/coredump-filter-build-id.exp: gcore dumped mapping with build-id
...

The test expects an actual file name instead of '[exe]', but that only got
introduced with eu-unstrip 0.161.  Before it printed '[exe]' or '[pie]'.

Fix this by updating the regexp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-09-09  Tom de Vries  <tdevries@suse.de>

	* gdb.base/coredump-filter-build-id.exp: Handle older eu-unstrip.
2021-09-09 13:55:02 +02:00
127e9f8549 [gdb/testsuite] Fix various issues in gdb.mi/mi-sym-info.exp
I noticed this failure in gdb.mi/mi-sym-info.exp with gcc-4.8:
...
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 1 \
  (unexpected output)
...
due to function f2 instead of f3 being listed.

AFAICT, this is caused by a difference in debug info:
...
$ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \
  | egrep "DW_AT_name.*: f[1-3]"
    <72>   DW_AT_name        : f1
    <a1>   DW_AT_name        : f2
    <d0>   DW_AT_name        : f3
...
vs:
...
$ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \
  | egrep "DW_AT_name.*: f[1-3]"
    <f4>   DW_AT_name        : f3
    <123>   DW_AT_name        : f2
    <152>   DW_AT_name        : f1
...
and the command documentation does not mention an imposed order, so fix this
by allowing f2 as well.

Doing this fix, it made sense to do a refactoring of adding f2_re and f3_re
variables, in order to write (?:$f2_re|$f3_re), and I applied the same pattern
overall.

Furthermore, I found a silent FAIL due to calling mi_gdb_proc with 2 args, fix
by updating the regexp.

Then I ran with clang and found another FAIL, fix by updating the regexp.

Tested on x86_64-linux with gcc-4.8.5, gcc-7.5.0, gcc-11.2.1, clang-7.0.1 and
clang-12.0.1.

gdb/testsuite/ChangeLog:

2021-09-09  Tom de Vries  <tdevries@suse.de>

	* gdb.mi/mi-sym-info.exp: Fix regexps.  Add missing message argument
	to mi_gdb_test.  Factor out regexps for functions and variables.
2021-09-09 13:55:02 +02:00
706ff47ce2 Automatic date update in version.in 2021-09-09 00:00:21 +00:00
de2143d60b Fix two regressions caused by CU / TU merging
PR symtab/28160 and PR symtab/27893 concern GDB crashes in the test
suite when using the "fission" target board.  They are both caused by
the patches that merge the list of CUs with the list of TUs (and to a
lesser degree by the patches to share DWARF data across objfiles), and
the underlying issue is the same: it turns out that reading a DWO can
cause new type units to be created.  This means that the list of
dwarf2_per_cu_data objects depends on precisely which CUs have been
expanded.  However, because the type units can be created while
expanding a CU means that the vector of CUs can expand while it is
being iterated over -- a classic mistake.  Also, because a TU can be
added later, it means the resize_symtabs approach is incorrect.

This patch fixes resize_symtabs by removing it, and having set_symtab
resize the vector on demand.  It fixes the iteration problem by
introducing a safe (index-based) iterator and changing the relevant
spots to use it.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28160
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27893

(cherry picked from commit d58e54bd277b90d847be09ae4b18bfdbc0dc2066)
2021-09-08 14:50:50 -06:00
cdf4e8ae55 Revert: [AArch64] MTE corefile support
bfd     * elf.c (elfcore_make_memtag_note_section): New function.
		(elfcore_grok_note): Handle NT_MEMTAG note types.

	binutils* readelf.c (get_note_type): Handle NT_MEMTAG note types.

	include * elf/common.h (NT_MEMTAG): New constant.
		(NT_MEMTAG_TYPE_AARCH_MTE): New constant.
2021-09-08 08:58:44 -03:00
dd0fea103f Automatic date update in version.in 2021-09-08 00:00:27 +00:00
aaa394b7df fbsd-nat: Don't use '%jd' and '%ju' with printf_filtered.
The handler for 'info proc status' for native processes on FreeBSD
uses the 'j' size modifier along with uintmax_t / intmax_t casts to
output integer values for types such as off_t that are not aliases of
a basic C type such as 'int' or 'long'.  printf_filtered does not
support the 'j' modifer, so this resulted in runtime errors in
practice:

(gdb) info proc stat
process 8674
Name: ls
State: T (stopped)
Parent process: 8673
Process group: 8674
Session id: 2779
Unrecognized format specifier 'j' in printf

Instead, use plongest and pulongest to generate the output strings of
these integer values.

gdb/ChangeLog:

	* fbsd-nat.c (fbsd_nat_target::info_proc): Use plongest and
	pulongest instead of %j.
2021-09-07 16:09:17 -07:00
1aa04a582c Automatic date update in version.in 2021-09-07 00:00:19 +00:00
244d1aadd7 Automatic date update in version.in 2021-09-06 00:00:26 +00:00
2b195da8a2 Automatic date update in version.in 2021-09-05 00:00:30 +00:00
a6e40b53ef [gdb/testsuite] Check avx support in gdb.arch/amd64-disp-step-avx.exp
On a machine on Open Build Service I'm running into a SIGILL for test-case
gdb.arch/amd64-disp-step-avx.exp:
...
Program received signal SIGILL, Illegal instruction.^M
test_rip_vex2 () at gdb.arch/amd64-disp-step-avx.S:40^M
40              vmovsd ro_var(%rip),%xmm0^M
(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: \
  continue to test_rip_vex2_end
...
The SIGILL happens when trying to execute the first avx instruction in the
executable.

I can't directly access the machine, but looking at the log for test-case
gdb.arch/i386-avx.exp, it seems that there's no avx support:
...
Breakpoint 1, main (argc=1, argv=0x7fffffffd6b8) at gdb.arch/i386-avx.c:68^M
68        if (have_avx ())^M
(gdb) print have_avx ()^M
$1 = 0^M
...

Fix this by:
- adding a gdb_caching_proc have_avx, similar to have_mpx, using the have_avx
  function from gdb.arch/i386-avx.c
- using proc have_avx in both gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
  and gdb/testsuite/gdb.arch/i386-avx.exp.

Tested on my x86_64-linux laptop with avx support, where both test-cases pass.

gdb/testsuite/ChangeLog:

2021-09-04  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26950
	* gdb/testsuite/gdb.arch/i386-avx.c (main): Remove call to have_avx.
	(have_avx): Move ...
	* gdb/testsuite/lib/gdb.exp (have_avx): ... here.  New proc.
	* gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp: Use have_avx.
	* gdb/testsuite/gdb.arch/i386-avx.exp: Same.
2021-09-04 12:11:35 +02:00
76c001c234 Automatic date update in version.in 2021-09-04 00:00:24 +00:00
e34a209edf [gdb/testsuite] Add untested case in gdb.gdb/complaints.exp
When building gdb with "-Wall -O2 -g -flto=auto", I run into:
...
(gdb) call clear_complaints()^M
No symbol "clear_complaints" in current context.^M
(gdb) FAIL: gdb.gdb/complaints.exp: clear complaints
...

The problem is that lto has optimized away clear_complaints, and consequently
the selftests cannot run.

Fix this by:
- using info function to detect presence of clear_complaints
- handling the absence of clear_complaints by calling untested
...
(gdb) UNTESTED: gdb.gdb/complaints.exp: \
  Cannot find clear_complaints, skipping test
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.gdb/complaints.exp: Use untested if clear_complaints cannot
	be found.
2021-09-03 17:40:10 +02:00
5c177fed07 [gdb/testsuite] Add untested case in selftest_setup
When building gdb with "-Wall -O2 -g -flto=auto", I run into:
...
FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
  (got interactive prompt)
FAIL: gdb.gdb/python-helper.exp: run until breakpoint at captured_main
WARNING: Couldn't test self
...
and similar in gdb.gdb/selftest.exp.

The first FAIL in more detail:
...
(gdb) break captured_main^M
Function "captured_main" not defined.^M
Make breakpoint pending on future shared library load? (y or [n]) n^M
(gdb) FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
  (got interactive prompt)
...

The problem is that lto has optimized away the captured_main function
and consequently the selftests dependent on that cannot run.

Fix this by:
- using gdb_breakpoint to detect failure to set the breakpoint
- handling the failure to set a breakpoint by calling untested
- not emitting the warning if we've already got untested
such that we have:
...
(gdb) UNTESTED: gdb.gdb/python-helper.exp: Cannot set breakpoint at \
  captured_main, skipping testcase.
...

gdb/testsuite/ChangeLog:

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

	* lib/selftest-support.exp: Emit untested when not being able to set
	breakpoint.
2021-09-03 15:13:14 +02:00
c6c2468fdf Automatic date update in version.in 2021-09-03 00:00:38 +00:00