When running with gcc-11 (with -gdwarf-5 default), I run into: ... FAIL: gdb.base/langs.exp: up to foo in langs.exp FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp FAIL: gdb.base/langs.exp: up to fsub in langs.exp ... In more detail: ... (gdb) up^M #1 0x0000000000400520 in foo__Fi (x=10000) at /home/vries/gdb_versions/devel/build/gdb/testsuite/langs2.cxx:5^M 5 return csub (x / 2);^M (gdb) FAIL: gdb.base/langs.exp: up to foo in langs.exp ... while with say -gdwarf-4 we have: ... (gdb) up^M #1 0x0000000000400520 in foo__Fi (x=10000) at langs2.cxx:5^M 5 return csub (x / 2);^M (gdb) PASS: gdb.base/langs.exp: up to foo in langs.exp ... The difference is "/home/vries/gdb_versions/devel/build/gdb/testsuite/langs2.cxx" vs "langs2.cxx".
With -gdwarf-4, we have: ... <0><243>: Abbrev Number: 1 (DW_TAG_compile_unit) <244> DW_AT_producer : (indirect string, offset: 0x208): GNU C17 11.1.1 20210625 [revision 62bbb113ae68a7e724255e17143520735bcb9ec9] -mtune=generic -march=x86-64 -gdwarf-4 -fno-stack-protector <248> DW_AT_language : 12 (ANSI C99) <249> DW_AT_name : (indirect string, offset: 0x34d): /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/langs2.c <24d> DW_AT_comp_dir : (indirect string, offset: 0x1d0): /home/vries/gdb_versions/devel/build/gdb/testsuite <251> DW_AT_low_pc : 0x400502 <259> DW_AT_high_pc : 0x3b <261> DW_AT_stmt_list : 0x20f ... and at 0x20f: ... The Directory Table is empty. The File Name Table (offset 0x22c): Entry Dir Time Size Name 1 0 0 0 langs2.cxx ... With -gdwarf-5, we have: ... <0><242>: Abbrev Number: 2 (DW_TAG_compile_unit) <243> DW_AT_producer : (indirect string, offset: 0x1d0): GNU C17 11.1.1 20210625 [revision 62bbb113ae68a7e724255e17143520735bcb9ec9] -mtune=generic -march=x86-64 -gdwarf-5 -fno-stack-protector <247> DW_AT_language : 29 (C11) <248> DW_AT_name : (indirect line string, offset: 0xfc): /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/langs2.c <24c> DW_AT_comp_dir : (indirect line string, offset: 0x0): /home/vries/gdb_versions/devel/build/gdb/testsuite <250> DW_AT_low_pc : 0x400502 <258> DW_AT_high_pc : 0x3b <260> DW_AT_stmt_list : 0x1b4 ... and at 0x1b4: ... The Directory Table (offset 0x1d6, lines 1, columns 1): Entry Name 0 (indirect line string, offset: 0x0): /home/vries/gdb_versions/devel/build/gdb/testsuite The File Name Table (offset 0x1e0, lines 2, columns 2): Entry Dir Name 0 0 (indirect line string, offset: 0xfc): /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/langs2.c 1 0 (indirect line string, offset: 0x13f): langs2.cxx ... So the difference seems to be that the directory and file entries 0 are implicit in dwarf-4, and explicit in dwarf-5.
Posted RFC: https://sourceware.org/pipermail/gdb-patches/2021-July/181031.html
Fixed by commit d8504344d47 ("Fix some failures in langs.exp").