116422 Commits

Author SHA1 Message Date
e69f44938c gdb: fix macos >= 14.4 issue with encoding convertion
Seems iconv library in macos >= 14.4 has some changes that appeared to
be breaking in case converting from "wchar_t" encoding.
As macos libiconv supports "UTF-32LE", GDB will use this encoding
instead.
esp-gdb-v14.2_20240403
2024-04-02 12:31:37 +04:00
02a220d713 Revert "Set section index when setting a symbol's block"
This reverts commit 5abbfa982215a5bcd2bf2c0b92cbb005464dc927.
2024-04-02 12:31:37 +04:00
9884a78493 RISC-V: add support XEspPIE extension 2024-04-02 12:31:37 +04:00
8e8876bd5d xtensa: use dynconfig options 2024-04-02 12:31:37 +04:00
d8c840eb37 gdb/testsuite: adapt test for esp-emulation 2024-04-02 12:31:37 +04:00
01f46c867e gdb/testsuite: add simesp board 2024-04-02 12:31:36 +04:00
c32361e9c2 gdb/testsuite: add esp32/esp32s2/esp32s3 specific tests 2024-04-02 12:31:36 +04:00
38fdafc3e4 ci: initialize gitlab-ci 2024-04-02 12:31:36 +04:00
5a8e207ccc readline: fix windows control characters behavior 2024-04-02 12:31:36 +04:00
abe083c327 gdb: xtensa: fix truncated backtrace for nested noreturn functions
The problem appears when break in nested noreturn calls.
panic_abort() and esp_system_abort() are noreturn functions:

    #0  0x4008779f in panic_abort ()
    #1  0x40087a78 in esp_system_abort ()
    Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Assembly listing:

    40081ad4 <panic_abort>:
    40081ad4:	004136        	entry	a1, 32
    40081aeb:	ffff06        	j	40081aeb <panic_abort+0x17>
    	...

    40085614 <esp_system_abort>:
    40085614:	004136        	entry	a1, 32
    40085619:	fc4ba5        	call8	40081ad4 <panic_abort>

    4008561c <__ubsan_include>:
    4008561c:	004136        	entry	a1, 32

PC register for frame esp_system_abort points to the next instruction after
instruction with address 40085619.
It is ENTRY instruction for __ubsan_include. This caused wrong unwinding
because we are not in __ubsan_include at this frame. In general for
noreturn functions there should be RET instruction. This is why it works
in all other cases.

PC register can point to entry instruction only for the innermost frame.
It is not possible otherwise.

The fix is making it not possible to go with not innermost frame into
the code block which collects frame cache for frames when PC is on entry
instruction.
2024-04-02 12:31:36 +04:00
548fb34792 gdb: xtensa: support thread-local variables 2024-04-02 12:31:36 +04:00
b40b77320b gdb/python: initialize embedding without signals 2024-04-02 12:31:36 +04:00
8b1ed4d93d gdb: add python-config override options
https://sourceware.org/pipermail/gdb-patches/2021-October/182911.html
2024-04-02 12:31:36 +04:00
1eba16c2b1 gdb/xtensa: implement xtensa_dump_tdep
xtensa_dump_tdep is useful for debugging issues related to register
mapping.
2024-04-02 12:31:36 +04:00
8a397c1d6a 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.
2024-04-02 12:31:36 +04:00
0fa743847c 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.
2024-04-02 12:31:36 +04:00
d27f034b40 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
2024-04-02 12:31:36 +04:00
78821bbc25 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>
2024-04-02 12:31:36 +04:00
5875122d72 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>
2024-04-02 12:31:36 +04:00
02c10eaecb Set GDB version number to 14.2.
This commit changes gdb/version.in to 14.2.
gdb-14.2-release
2024-03-03 09:55:01 +04:00
04f4ce39c5 Automatic date update in version.in 2024-03-03 00:01:26 +00:00
2e9d13a8dd Automatic date update in version.in 2024-03-02 00:00:43 +00:00
c10bd3afc9 Automatic date update in version.in 2024-03-01 00:01:11 +00:00
0098e54378 Automatic date update in version.in 2024-02-29 00:01:36 +00:00
9b04edac22 Automatic date update in version.in 2024-02-28 00:00:46 +00:00
f52761fb8a Automatic date update in version.in 2024-02-27 00:00:50 +00:00
17d293e8aa Automatic date update in version.in 2024-02-26 00:01:02 +00:00
9f32a6dcbc Automatic date update in version.in 2024-02-25 00:01:34 +00:00
d58a3c04c1 Automatic date update in version.in 2024-02-24 00:00:58 +00:00
60d62513aa Automatic date update in version.in 2024-02-23 00:01:24 +00:00
b1aa46d3e6 Automatic date update in version.in 2024-02-22 00:01:25 +00:00
2e35763b64 Automatic date update in version.in 2024-02-21 00:00:44 +00:00
6002d5bc4f Automatic date update in version.in 2024-02-20 00:00:40 +00:00
ebbb386892 Automatic date update in version.in 2024-02-19 00:00:50 +00:00
03a163a411 Automatic date update in version.in 2024-02-18 00:00:27 +00:00
87c388d223 Automatic date update in version.in 2024-02-17 00:00:30 +00:00
d001d6873b Automatic date update in version.in 2024-02-16 00:00:32 +00:00
65064315e4 Automatic date update in version.in 2024-02-15 00:00:52 +00:00
d75d43a80e Automatic date update in version.in 2024-02-14 00:00:31 +00:00
847f090f42 Automatic date update in version.in 2024-02-13 00:00:56 +00:00
fc51918929 Automatic date update in version.in 2024-02-12 00:00:52 +00:00
39a61855d4 Fix crash when calling Frame.static_link
If you try to call Frame.static_link for a frame without debug info,
gdb crashes:
```
Temporary breakpoint 1, 0x000000013f821650 in main ()
(gdb) py print(gdb.selected_frame().static_link())

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
```

The problem was a missing check if get_frame_block returns nullptr
inside frame_follow_static_link.

With this, it works:
```
Temporary breakpoint 1, 0x000000013f941650 in main ()
(gdb) py print(gdb.selected_frame().static_link())
None
```

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31366
Approved-By: Tom Tromey <tom@tromey.com>
2024-02-11 17:46:33 +01:00
775204fc4b Automatic date update in version.in 2024-02-11 00:00:26 +00:00
4ebf4f5607 Automatic date update in version.in 2024-02-10 00:00:57 +00:00
6cb1a337b3 Automatic date update in version.in 2024-02-09 00:00:29 +00:00
4dde01ea00 Automatic date update in version.in 2024-02-08 00:01:44 +00:00
5c5907ece3 Automatic date update in version.in 2024-02-07 00:01:42 +00:00
7c709b26ba [gdb/tdep] Fix use-after-free in arm_exidx_fill_cache
On arm-linux the linaro CI occasionally reports:
...
 (gdb) up 10
 #4  0x0001b864 in pthread_join ()
 (gdb) FAIL: gdb.threads/staticthreads.exp: up 10
...
while this is expected:
...
 (gdb) up 10
 #3  0x00010568 in main (argc=1, argv=0xfffeede4) at staticthreads.c:76
 76          pthread_join (thread, NULL);
 (gdb) PASS: gdb.threads/staticthreads.exp: up 10
...

Thiago investigated the problem, and using valgrind found an invalid read in
arm_exidx_fill_cache.

The problem happens as follows:
- an objfile and corresponding per_bfd are allocated
- some memory is allocated in arm_exidx_new_objfile using
  objfile->objfile_obstack, for the "exception table entry cache".
- a symbol reread is triggered, and the objfile, including the
  objfile_obstack, is destroyed
- a new objfile is allocated, using the same per_bfd
- again arm_exidx_new_objfile is called, but since the same per_bfd is used,
  it doesn't allocate any new memory for the "exception table entry cache".
- the "exception table entry cache" is accessed by arm_exidx_fill_cache,
  and we have a use-after-free.

This is a regression since commit a2726d4ff80 ("[ARM] Store exception handling
information per-bfd instead of per-objfile"), which changed the "exception
table entry cache" from per-objfile to per-bfd, but failed to update the
obstack_alloc.

Fix this by using objfile->per_bfd->storage_obstack instead of
objfile->objfile_obstack.

I couldn't reproduce the FAIL myself, but Thiago confirmed that the patch
fixes it.

Tested on arm-linux.

Approved-By: Luis Machado <luis.machado@arm.com>

PR tdep/31254
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31254
2024-02-06 17:59:06 -03:00
9163aee2af Automatic date update in version.in 2024-02-06 00:01:45 +00:00
fb2afe5818 Automatic date update in version.in 2024-02-05 00:00:44 +00:00