Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes needed for newer GDB versions #4389

Open
JohanEngelen opened this issue May 2, 2023 · 8 comments
Open

Fixes needed for newer GDB versions #4389

JohanEngelen opened this issue May 2, 2023 · 8 comments

Comments

@JohanEngelen
Copy link
Member

Tests debuginfo/{classtypes,print}_gdb.d fail with newer GDB versions, and are now disabled for FreeBSD. See e.g. #4373

@the-horo
Copy link
Contributor

I'm hitting this on Gentoo as well:

LLD 17.0.6
Lit version:  17.0.6dev
-- Testing: 2 tests, 2 workers --
FAIL: LDC :: debuginfo/print_gdb.d (1 of 2)
******************** TEST 'LDC :: debuginfo/print_gdb.d' FAILED ********************
Script:
--
: 'RUN: at line 6';   /home/happy/git/ldc/build-ldc/bin/ldc2  -I/home/happy/git/ldc/tests/debuginfo -g -of=/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp /home/happy/git/ldc/tests/debuginfo/print_gdb.d /home/happy/git/ldc/tests/debuginfo/inputs/import_a.d /home/happy/git/ldc/tests/debuginfo/inputs/import_b.d
: 'RUN: at line 7';   sed -e "/^\\/\\/ GDB:/!d" -e "s,// GDB:,," /home/happy/git/ldc/tests/debuginfo/print_gdb.d >/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.gdb
: 'RUN: at line 8';   env LANG=C gdb /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp --batch -x /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.gdb >/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.out 2>&1
: 'RUN: at line 9';   FileCheck /home/happy/git/ldc/tests/debuginfo/print_gdb.d -check-prefix=CHECK < /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.out
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 6"
$ "/home/happy/git/ldc/build-ldc/bin/ldc2" "-I/home/happy/git/ldc/tests/debuginfo" "-g" "-of=/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp" "/home/happy/git/ldc/tests/debuginfo/print_gdb.d" "/home/happy/git/ldc/tests/debuginfo/inputs/import_a.d" "/home/happy/git/ldc/tests/debuginfo/inputs/import_b.d"
$ ":" "RUN: at line 7"
$ "sed" "-e" "/^\/\/ GDB:/!d" "-e" "s,// GDB:,," "/home/happy/git/ldc/tests/debuginfo/print_gdb.d"
$ ":" "RUN: at line 8"
$ "env" "LANG=C" "gdb" "/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp" "--batch" "-x" "/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.gdb"
# redirected output from '/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.out':
gdb: warning: Couldn't determine a path for the index cache directory.
Breakpoint 1 at 0x198d8: file home/happy/git/ldc/tests/debuginfo/print_gdb.d, line 58.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".

Breakpoint 1, _Dmain () at home/happy/git/ldc/tests/debuginfo/print_gdb.d:58
58	    uint n = 5;
Breakpoint 2 at 0x55555556d92a: file home/happy/git/ldc/tests/debuginfo/print_gdb.d, line 78.

Breakpoint 2, _Dmain () at home/happy/git/ldc/tests/debuginfo/print_gdb.d:78
78	    sB strB;
/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/print_gdb.d.tmp.gdb:5: Error in sourced command file:
No symbol "globVal" in current context.

note: command had no output on stdout or stderr
error: command failed with exit status: 1

--

********************
FAIL: LDC :: debuginfo/classtypes_gdb.d (2 of 2)
******************** TEST 'LDC :: debuginfo/classtypes_gdb.d' FAILED ********************
Script:
--
: 'RUN: at line 6';   /home/happy/git/ldc/build-ldc/bin/ldc2  -g -of=/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp /home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d
: 'RUN: at line 7';   sed -e "/^\\/\\/ GDB:/!d" -e "s,// GDB:,," /home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d >/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.gdb
: 'RUN: at line 8';   gdb /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp --batch -x /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.gdb >/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.out 2>&1
: 'RUN: at line 9';   FileCheck /home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d -check-prefix=CHECK < /home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.out
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 6"
$ "/home/happy/git/ldc/build-ldc/bin/ldc2" "-g" "-of=/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp" "/home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d"
$ ":" "RUN: at line 7"
$ "sed" "-e" "/^\/\/ GDB:/!d" "-e" "s,// GDB:,," "/home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d"
$ ":" "RUN: at line 8"
$ "gdb" "/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp" "--batch" "-x" "/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.gdb"
# redirected output from '/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.out':
gdb: warning: Couldn't determine a path for the index cache directory.
Breakpoint 1 at 0x199ae: file home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d, line 41.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".

Breakpoint 1, _Dmain () at home/happy/git/ldc/tests/debuginfo/classtypes_gdb.d:41
41	    return 0;
$1 = (classtypes_gdb.xyz *) 0x7ffff7bdc020
$2 = {<classtypes_gdb.uv> = {<object.Object> = {<No data fields>}, i = 99}, f = 88.7699966, d = 624.351}
$3 = (classtypes_gdb.xyz *) 0x7ffff7bdc020
$4 = {<classtypes_gdb.uv> = {<object.Object> = {<No data fields>}, i = 99}, f = 88.7699966, d = 624.351}
$5 = {0x0, 0x0, 0x7ffff7bdc040, 0x0}
$6 = {<classtypes_gdb.uv> = {<object.Object> = {<No data fields>}, i = 2}, f = 2, d = 0.98699999999999999}
/home/happy/git/ldc/build-ldc/tests/debuginfo/Output/classtypes_gdb.d.tmp.gdb:9: Error in sourced command file:
'classtypes_gdb.gvar' has unknown type; cast it to its declared type

note: command had no output on stdout or stderr
error: command failed with exit status: 1

--

********************
********************
Failed Tests (2):
  LDC :: debuginfo/classtypes_gdb.d
  LDC :: debuginfo/print_gdb.d


Testing Time: 0.19s
  Failed: 2

With gdb:

GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 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.

Should the test be marked XFAIL on all platforms?

@kinke
Copy link
Member

kinke commented Feb 16, 2024

This issue includes runnable/gdb{4181,14313}.d from dmd-testsuite (the GDB dmd-testsuite tests are skipped on non-Linux, incl. FreeBSD). They fail e.g. on my Ubuntu 22 box with default gdb v12.1.

@kinke
Copy link
Member

kinke commented Feb 16, 2024

Should the test be marked XFAIL on all platforms?

Nope, because it works just fine with gdb < 10 IIRC.

Not sure if it's worth it, but we could extend

ldc/tests/lit.site.cfg.in

Lines 212 to 216 in 6ede9a4

gdb_version = m.group(1)
if LooseVersion(gdb_version) < LooseVersion('7.8'):
gdb_dflags = '-dwarf-version=2'
elif LooseVersion(gdb_version) >= LooseVersion('8.0'):
config.available_features.add('atleast_gdb80')
and disable the 2 lit-tests with gdb 10+; see
// REQUIRES: atleast_gdb80

@the-horo
Copy link
Contributor

Not sure if it's worth it, but we could extend

For me it's good enough to know that they are expected to fail on certain versions of gdb and that people are aware of the issue. It would be great if this was reported to gdb I suppose.

@liushuyu
Copy link
Contributor

Hi there, just a heads up: I have opened a bug report on the GDB upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=31580.

@kinke
Copy link
Member

kinke commented Mar 30, 2024

Thx for digging! Indeed, I didn't expect gdc to fail too, but it does on my system as well - Ubuntu 22, with distro-default gdc v11.4 and gdb v12.1.

@PetarKirov
Copy link
Contributor

We've had similar issues when packaging historical DMD versions with Nix. Here's the list of tests we had to disable on Linux and macOS:
https://github.com/PetarKirov/dlang.nix/blob/main/pkgs/dmd/build-status.nix

@liushuyu
Copy link
Contributor

Hi, there: another heads up: GDB upstream swiftly proposed a fix: https://sourceware.org/pipermail/gdb-patches/2024-March/207686.html. I have verified locally and determined the patch is sufficient to fix the problem described in this issue.

I encourage everyone in this thread to verify if the patch can fix those tests independently. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants