Skip to content

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

Merged
philipc merged 2 commits into
gimli-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 into
gimli-rs:masterfrom
quanterion:fix-paths-from-clang

Conversation

@quanterion

@quanterion quanterion commented Feb 25, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

@philipc can have a look at PR please?

@philipc

philipc commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

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

@quanterion

Copy link
Copy Markdown
Contributor Author

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

@philipc philipc left a comment

Copy link
Copy Markdown
Contributor

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

philipc commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
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