This makes debugging impossible on riscv64. $ ./gdb gdb GNU gdb (GDB) 11.0.50.20210620-git Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "riscv64-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from gdb... Setting up the environment for debugging gdb. During symbol reading: unsupported tag: 'DW_TAG_unspecified_type' Breakpoint 1 at 0x36a594: file ../../gdb/gdbsupport/errors.cc, line 54. During symbol reading: .debug_line address at offset 0x11db3d is 0 [in module /daten/src/gdb/n-riscv64/gdb/gdb] During symbol reading: Member function "~_Sp_counted_base" (offset 0x890d98) is virtual but the vtable offset is not specified During symbol reading: cannot get low and high bounds for subprogram DIE at 0x8a3586 During symbol reading: DW_AT_call_target target DIE has invalid low pc, for referencing DIE 0x8bd872 [in module /daten/src/gdb/n-riscv64/gdb/gdb] During symbol reading: Child DIE 0x8bd843 and its abstract origin 0x8c306c have different parents During symbol reading: No DW_FORM_block* DW_AT_call_value for DW_TAG_call_site child DIE 0x8c2170 [in module /daten/src/gdb/n-riscv64/gdb/gdb] During symbol reading: Duplicate PC 0x9ba74 for DW_TAG_call_site DIE 0x8cc021 [in module /daten/src/gdb/n-riscv64/gdb/gdb] Breakpoint 2 at 0x9b968: file ../../gdb/gdb/cli/cli-cmds.c, line 208. (top-gdb) b decode_debug_loclists_addresses During symbol reading: Multiple children of DIE 0x1363926 refer to DIE 0x1361e63 as their abstract origin Breakpoint 3 at 0xfafa6: file ../../gdb/gdb/dwarf2/loc.c, line 165. (top-gdb) cd ~/src/test Working directory /home/andreas/src/test (canonically /daten/src/test). (top-gdb) r hello Starting program: /daten/src/gdb/n-riscv64/gdb/gdb hello During symbol reading: cannot get low and high bounds for subprogram DIE at 0x7ded During symbol reading: Child DIE 0x84f3 and its abstract origin 0xbd97 have different parents During symbol reading: DW_AT_call_target target DIE has invalid low pc, for referencing DIE 0x8c9a [in module /usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.riscv64.debug] During symbol reading: file index out of range [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/lp64d/libthread_db.so.1". [Detaching after vfork from child process 4730] [New Thread 0x3ff783a960 (LWP 4731)] [New Thread 0x3ff7039960 (LWP 4732)] [New Thread 0x3ff6838960 (LWP 4733)] [New Thread 0x3ff6037960 (LWP 4734)] GNU gdb (GDB) 11.0.50.20210620-git Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "riscv64-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from hello... (gdb) start Temporary breakpoint 1 at 0x105c4: file hello.c, line 6. Starting program: /daten/src/test/hello [Detaching after vfork from child process 4735] [Detaching after fork from child process 4736] During symbol reading: Child DIE 0xd4aa and its abstract origin 0xf8f3 have different parents During symbol reading: cannot get low and high bounds for subprogram DIE at 0xd6c8 During symbol reading: No DW_FORM_block* DW_AT_call_value for DW_TAG_call_site child DIE 0xf193 [in module /usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.riscv64.debug] During symbol reading: Multiple children of DIE 0x10422 refer to DIE 0xd6da as their abstract origin During symbol reading: No DW_FORM_block* DW_AT_call_value for DW_TAG_call_site child DIE 0x193ba [in module /usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.riscv64.debug] During symbol reading: Multiple children of DIE 0x19904 refer to DIE 0x19ee9 as their abstract origin During symbol reading: Child DIE 0x19995 and its abstract origin 0x1a0a5 have different parents During symbol reading: cannot get low and high bounds for subprogram DIE at 0x19ee0 Temporary breakpoint 1, main () at hello.c:6 6 printf ("Hello World!\n"); (gdb) s Thread 1 "gdb" hit Breakpoint 3, decode_debug_loclists_addresses (per_cu=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, per_objfile=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, loc_ptr=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, buf_end=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, new_ptr=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, low=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, high=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, byte_order=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, addr_size=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, signed_addr_p=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at ../../gdb/gdb/dwarf2/loc.c:165 165 decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, (top-gdb) s During symbol reading: incomplete CFI data; unspecified registers (e.g., zero) at 0xfafea 177 if (loc_ptr == buf_end) (top-gdb) 180 switch (*loc_ptr++) (top-gdb) disp/i $pc 1: x/i $pc => 0xfafc0 <decode_debug_loclists_addresses(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb_byte const*, gdb_byte const*, gdb_byte const**, CORE_ADDR*, CORE_ADDR*, bfd_endian, unsigned int, int)+26>: mv s0,a3 (top-gdb) si 0x00000000000fafc2 180 switch (*loc_ptr++) 1: x/i $pc => 0xfafc2 <decode_debug_loclists_addresses(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb_byte const*, gdb_byte const*, gdb_byte const**, CORE_ADDR*, CORE_ADDR*, bfd_endian, unsigned int, int)+28>: lbu a3,0(t1) (top-gdb) 0x00000000000fafc6 180 switch (*loc_ptr++) 1: x/i $pc => 0xfafc6 <decode_debug_loclists_addresses(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb_byte const*, gdb_byte const*, gdb_byte const**, CORE_ADDR*, CORE_ADDR*, bfd_endian, unsigned int, int)+32>: mv s4,a5 (top-gdb) i reg a3 a3 0x7 7 (top-gdb) x/8c $t1 0x3ff4f14c6e: 7 '\a' -16 '\360' -112 '\220' 5 '\005' 0 '\000' 0 '\000' 0 '\000' 0 '\000' (top-gdb) c Continuing. Thread 1 "gdb" hit Breakpoint 3, decode_debug_loclists_addresses (per_cu=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, per_objfile=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, loc_ptr=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, buf_end=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, new_ptr=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, low=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, high=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, byte_order=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, addr_size=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, signed_addr_p=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at ../../gdb/gdb/dwarf2/loc.c:165 165 decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, 1: x/i $pc => 0xfafa6 <decode_debug_loclists_addresses(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb_byte const*, gdb_byte const*, gdb_byte const**, CORE_ADDR*, CORE_ADDR*, bfd_endian, unsigned int, int)>: addi sp,sp,-64 (top-gdb)
The master branch has been updated by Andreas Schwab <schwab@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=80d1206d7fea6eb756183e2825abdfd0f00cd976 commit 80d1206d7fea6eb756183e2825abdfd0f00cd976 Author: Andreas Schwab <schwab@suse.de> Date: Mon Jun 21 11:38:23 2021 +0200 gdb: Support DW_LLE_start_end Without that it is impossible to debug on riscv64. gdb/ PR symtab/27999 * dwarf2/loc.c (decode_debug_loclists_addresses): Support DW_LLE_start_end. gdb/testsuite/ PR symtab/27999 * lib/dwarf.exp (start_end): New proc inside loclists. * gdb.dwarf2/loclists-start-end.exp: New file. * gdb.dwarf2/loclists-start-end.c: New file.
Fixed in gdb-11.