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

fix(debuginfo): Detect more hidden symbols in swift sources #316

Merged
merged 3 commits into from
Mar 1, 2021

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Jan 28, 2021

A regression in #127 broke detection of BCSymbolMaps. The RegEx __?hidden#\d+_ was replaced with a literal __?hidden# prefix and missed that ? is an operator rather than a literal question mark.

This RegEx was required due to another issue in the MachO symbol iterator, which unconditionally strips the first leading underscore to match names from DWARF debugging information. For hidden symbols, this does not make sense, however, and instead it should be retained.

@jan-auer jan-auer requested a review from a team January 28, 2021 12:13
Comment on lines 257 to 259
n.starts_with("__?hidden#")
|| n.starts_with("__hidden#")
|| n.starts_with("_hidden#")

Choose a reason for hiding this comment

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

wouldn't it be better to be future proof and regex it?
hidden# looks like the common pattern, or even taking into consideration 1 or N _ and having or not ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Regexes are a bit expensive at this part, but we could use aho corasick in place of this.

That said, MachO dictates that there can only be a single or two underscores, and I'm not even sure why the symbols I'm looking at don't have the question mark.

Choose a reason for hiding this comment

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

wfm then, thx for explaining

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

lgtm, @marandaneto has a valid feedback though. Not sure how likely it is that things are changing again

@jan-auer
Copy link
Member Author

jan-auer commented Mar 1, 2021

Verified this on a new build. Turns out that this was a regression in #127, where I replaced the RegEx __?hidden#\\d+_ with a literal __?hidden# prefix and missed that ? is an operator rather than a literal questionmark.

* master:
  test: add similar-asserts' assert_eq (#333)
  release: 8.0.4
  meta: Changelog for 8.0.4
  build: Drop support for python 2.7 (#328)
  meta(vscode): Fix include paths for C++ (#331)
  doc(debuginfo): Add descriptions of records to breakpad.pest (#329)
  build: Replace virtualenv with venv
  doc(symcache): Symcache documentation
  fix(debuginfo): Support debug_addr indexes in DWARF functions (#326)
  fix(symcache): Fixed bug that caused functions to have len 0 (#324)
  ref(symcache): FuncRecord::len must be nonzero (#323)
  fix: Clippy 1.50 lints (#322)
  fix(symcache): Support lookup for public syms larger than 65k (#320)
  fix(symcache): Compute correct line offsets (#319)
  release: 8.0.3
  meta: Changelog
  build: Update goblin to 0.3.1 (#318)
  fix(elf): Consider sections of type SHT_MIPS_DWARF (#317)
@jan-auer jan-auer merged commit e8d6ce3 into master Mar 1, 2021
@jan-auer jan-auer deleted the fix/symbolmap-detection branch March 1, 2021 19:35
jan-auer added a commit that referenced this pull request Mar 3, 2021
* master:
  build: Update pdb to 0.7.0 (#334)
  release: 8.0.5
  meta: Changelog
  fix(debuginfo): Detect more hidden symbols in swift sources (#316)
  test: add similar-asserts' assert_eq (#333)
  release: 8.0.4
  meta: Changelog for 8.0.4
  build: Drop support for python 2.7 (#328)
  meta(vscode): Fix include paths for C++ (#331)
  doc(debuginfo): Add descriptions of records to breakpad.pest (#329)
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.

4 participants