Skip to content

fix: detecting windows root paths with unix-style separators#342

Merged
philipc merged 2 commits intogimli-rs:masterfrom
quanterion:fix-paths-from-clang
May 21, 2025
Merged

fix: detecting windows root paths with unix-style separators#342
philipc merged 2 commits intogimli-rs:masterfrom
quanterion:fix-paths-from-clang

Conversation

@quanterion
Copy link
Contributor

@quanterion quanterion commented Feb 25, 2025

On Windows Clang can produce DWARF debug information containing paths to DW_AT_name and DW_AT_comp_dir with unix-stlye slashes. for example C:/myproject/main.cpp. In that case case addr2line mistakenly concatenating absolute path to file with compilation directory

@quanterion
Copy link
Contributor Author

@philipc can have a look at PR please?

@philipc
Copy link
Contributor

philipc commented Mar 3, 2025

Seems fine but I would like to do some testing and don't currently have time.

@quanterion
Copy link
Contributor Author

ok, feel free to ping me if I can help you

Copy link
Contributor

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is used for two purposes: to determine if a path is a root path, and to determine which separator to use. If the root path is using :/, then I think we also be using / for the separator, but that won't happen with this change. Perhaps this change should be in has_unix_root instead. After doing that, better names for these functions would be has_forward_slash_root and has_backward_slash_root.

@philipc
Copy link
Contributor

philipc commented Mar 11, 2025

It would help with testing this if you can add a test file to https://github.com/gimli-rs/object-testfiles/tree/master/dwarf (ideally it would be the base.cpp in that directory compiled with clang on Windows).

@quanterion
Copy link
Contributor Author

@philipc refactored the code and here is the branch with clang binary from windows gimli-rs/object-testfiles#22

@philipc philipc merged commit 93d767b into gimli-rs:master May 21, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants