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

Support global lookup of symbols within scopes (namespaces, outer classes, etc.) on Windows #205

Merged
merged 2 commits into from
Jun 18, 2020

Conversation

sanketj
Copy link
Member

@sanketj sanketj commented Jun 18, 2020

The DbgObject.global API takes a scope parameter; however, it is currently ignored on Windows. With the latest compiler changes affecting Chromium symbols like g_frame_map, the scope now needs to be considered when querying for symbols on Windows. To that end, this change adjusts the symbol name to include the scope prefix before querying the debugger/symbol files on Windows.

There is an additional complication that needs to be addressed to handle anonymous namespaces correctly. On Linux, an anonymous namespace is annotated as (anonymous namespace), whereas on Windows, it is annotated as `anonymous namespace'. To handle this discrepancy, the DbgObject.global API now takes an array of scope strings (ordered [outermost scope, ..., innermost scope]), and within this array, an anonymous namespace is simply written as "anonymous namespace". Then, this scopes array will be transformed into a scope prefix string, with the Linux/Windows specific code resolving anonymous namespaces in platform-specific ways.

@sanketj sanketj requested a review from cbiesinger June 18, 2020 17:47
Copy link
Collaborator

@cbiesinger cbiesinger left a comment

Choose a reason for hiding this comment

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

Ah I didn't know the DIA API lets you query with scopes like this!

Do you know why the old way stopped working?

Wasn't able to find the exact change, but almost certainly a Windows compiler update. The g_frame_map symbol on newer builds is prefixed with the scope, but wasn't previously.

Also, do we still need the typeName as well, now that scopes work on Windows?

IIRC, the scenario for typeName was that if multiple symbols of the same name are found, then the typeName allows us to know which one to pick. So, I think it is still needed alongside scope.

extensions/dbgobject/core/dbgobject.js Outdated Show resolved Hide resolved
@sanketj sanketj merged commit d18e9db into master Jun 18, 2020
@sanketj sanketj deleted the windows-g_frame_map-break branch January 14, 2021 00:22
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.

2 participants