Skip to content

[lldb] Search main function with lldb::eFunctionNameTypeFull when getting default file and line. #113980

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

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

ZequanWu
Copy link
Contributor

This is to work around the fact that SymbolFileNativePDB::FindFunctions only support lldb::eFunctionNameTypeFull and lldb::eFunctionNameTypeMethod now. Since main's full name is the same as base name (main), it's okay to search with lldb::eFunctionNameTypeFull when trying to get the default file and line. With this, lldb/test/Shell/Driver/TestSingleQuote.test passes on Windows with NativePDB plugin.

@llvmbot
Copy link
Member

llvmbot commented Oct 28, 2024

@llvm/pr-subscribers-lldb

Author: Zequan Wu (ZequanWu)

Changes

This is to work around the fact that SymbolFileNativePDB::FindFunctions only support lldb::eFunctionNameTypeFull and lldb::eFunctionNameTypeMethod now. Since main's full name is the same as base name (main), it's okay to search with lldb::eFunctionNameTypeFull when trying to get the default file and line. With this, lldb/test/Shell/Driver/TestSingleQuote.test passes on Windows with NativePDB plugin.


Full diff: https://github.com/llvm/llvm-project/pull/113980.diff

1 Files Affected:

  • (modified) lldb/source/Core/SourceManager.cpp (+1-1)
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index fd5b49946c6a92..27a9edeef4249e 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -430,7 +430,7 @@ SourceManager::GetDefaultFileAndLine() {
             false; // Force it to be a debug symbol.
         function_options.include_inlines = true;
         executable_ptr->FindFunctions(main_name, CompilerDeclContext(),
-                                      lldb::eFunctionNameTypeBase,
+                                      lldb::eFunctionNameTypeFull,
                                       function_options, sc_list);
         for (const SymbolContext &sc : sc_list) {
           if (sc.function) {

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

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

🥳

@ZequanWu ZequanWu merged commit 8193832 into llvm:main Oct 29, 2024
9 checks passed
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…ting default file and line. (llvm#113980)

This is to work around the fact that
`SymbolFileNativePDB::FindFunctions` only support
`lldb::eFunctionNameTypeFull` and `lldb::eFunctionNameTypeMethod` now.
Since `main`'s full name is the same as base name (`main`), it's okay to
search with `lldb::eFunctionNameTypeFull` when trying to get the default
file and line. With this, `lldb/test/Shell/Driver/TestSingleQuote.test`
passes on Windows with NativePDB plugin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants