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

Can't debug Clang build on Windows anymore #100268

Closed
AeioMuch opened this issue Dec 11, 2024 · 6 comments · Fixed by #100270
Closed

Can't debug Clang build on Windows anymore #100268

AeioMuch opened this issue Dec 11, 2024 · 6 comments · Fixed by #100270

Comments

@AeioMuch
Copy link
Contributor

AeioMuch commented Dec 11, 2024

Tested versions

v4.4.dev.custom_build [cf038de]

System information

Godot v4.4.dev (cf038de) - Windows 10.0.19045 - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 32.0.15.6636) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 threads)

Issue description

Can't debug clang build on Windows compiled with scons use_mingw=yes use_llvm=yes dev_build=yes. Will not allow debug anymore with lldb-dap.
This is caused by #100207 cc @bruvzg

I guess if platform=windows but use_llvm=yes we should still use -gdwarf-4 or something like this ? Or am I missing a package ?

Steps to reproduce

N/A

Minimal reproduction project (MRP)

N/A

@bruvzg
Copy link
Member

bruvzg commented Dec 11, 2024

I guess if use_llvm=yes we should still use -gdwarf-4 or something like this ?

No, it was changed to dwarf-5 for libbacktrace, it does not matter which compiler was used.

clang should default to dwarf-5 since llvm-14, it's possible you are using old version of lldb.

@AeioMuch
Copy link
Contributor Author

AeioMuch commented Dec 11, 2024

I use https://packages.msys2.org/groups/mingw-w64-clang-x86_64-toolchain which provided lldb version 19.1.4-1
I tried with https://github.com/mstorsjo/llvm-mingw and that was the same.

Using dwarf-4 it make it work again, what should I do then ?

@AeioMuch
Copy link
Contributor Author

It may be because of lldb-dap mfussenegger/nvim-dap#186 (comment)

@bruvzg
Copy link
Member

bruvzg commented Dec 11, 2024

Tested various configs:


drawf-4 symbols produces by gcc:

  • Doesn't work with libbacktrace.

drawf-5 symbols produces by gcc:

  • Work in gdb:
    Image
  • Kinda work in lldb, but seems to have some issues, it's spamming a lot of Failed to extract range list table at offset error and does not show source lines (function names are shown).
  • Work with libbacktrace.

drawf-5 symbols produced by clang:

  • Doesn't work in gdb.
  • Work in the same half-broken way in lldb.
  • Doesn't work with libbacktrace.

drawf-4 symbols produced by clang:

  • Work in gdb.
  • Work in lldb, no error spam lines are show correctly:
    Image
  • Work with libbacktrace.

So we should switch clang builds back to drawf-4.

@AeioMuch
Copy link
Contributor Author

Thank you for your tests!

@akien-mga
Copy link
Member

Kinda work in lldb, but seems to have some issues, it's spamming a lot of Failed to extract range list table at offset error and does not show source lines (function names are shown).

Sounds like this from the GCC 11 release notes:

To take full advantage of DWARF version 5 GCC needs to be built against binutils version 2.35.2 or higher. When GCC is built against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given -gdwarf-5).

There must be a mismatch between the debuginfo data and the debug line tables versions.

Looking at libbacktrace's dwarf.c is seems to have code to support earlier dwarf versions than 5. Maybe we could revert back to dwarf-4 for all platforms and just find how to use libbacktrace to process dwarf-4 data explicitly?

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

Successfully merging a pull request may close this issue.

4 participants