FreeBSD Bugzilla – Attachment 227244 Details for
Bug 253881
/usr/bin/lldb: Unable to backtrace a core dump
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix lldb 11 sometimes throwing a 'unhandled Error'
fix-lldb-11-unhandled-error-1.diff (text/plain), 8.87 KB, created by
Dimitry Andric
on 2021-08-16 13:31:23 UTC
(
hide
)
Description:
Fix lldb 11 sometimes throwing a 'unhandled Error'
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2021-08-16 13:31:23 UTC
Size:
8.87 KB
patch
obsolete
>diff --git a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp >index 5e57813c28bd..41b65d8ff9ac 100644 >--- a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp >+++ b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp >@@ -227,62 +227,32 @@ void TypeSystemMap::ForEach(std::function<bool(TypeSystem *)> const &callback) { > llvm::Expected<TypeSystem &> > TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, > Module *module, bool can_create) { >- llvm::Error error = llvm::Error::success(); >- assert(!error); // Check the success value when assertions are enabled > std::lock_guard<std::mutex> guard(m_mutex); >- if (m_clear_in_progress) { >- error = llvm::make_error<llvm::StringError>( >+ if (m_clear_in_progress) >+ return llvm::make_error<llvm::StringError>( > "Unable to get TypeSystem because TypeSystemMap is being cleared", > llvm::inconvertibleErrorCode()); >- } else { >- collection::iterator pos = m_map.find(language); >- if (pos != m_map.end()) { >- auto *type_system = pos->second.get(); >- if (type_system) { >- llvm::consumeError(std::move(error)); >- return *type_system; >- } >- error = llvm::make_error<llvm::StringError>( >- "TypeSystem for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)) + >- " doesn't exist", >- llvm::inconvertibleErrorCode()); >- return std::move(error); >- } > >- for (const auto &pair : m_map) { >- if (pair.second && pair.second->SupportsLanguage(language)) { >- // Add a new mapping for "language" to point to an already existing >- // TypeSystem that supports this language >- m_map[language] = pair.second; >- if (pair.second.get()) { >- llvm::consumeError(std::move(error)); >- return *pair.second.get(); >- } >- error = llvm::make_error<llvm::StringError>( >- "TypeSystem for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)) + >- " doesn't exist", >- llvm::inconvertibleErrorCode()); >- return std::move(error); >- } >- } >+ collection::iterator pos = m_map.find(language); >+ if (pos != m_map.end()) { >+ auto *type_system = pos->second.get(); >+ if (type_system) >+ return *type_system; >+ return llvm::make_error<llvm::StringError>( >+ "TypeSystem for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)) + >+ " doesn't exist", >+ llvm::inconvertibleErrorCode()); >+ } > >- if (!can_create) { >- error = llvm::make_error<llvm::StringError>( >- "Unable to find type system for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)), >- llvm::inconvertibleErrorCode()); >- } else { >- // Cache even if we get a shared pointer that contains a null type system >- // back >- auto type_system_sp = TypeSystem::CreateInstance(language, module); >- m_map[language] = type_system_sp; >- if (type_system_sp.get()) { >- llvm::consumeError(std::move(error)); >- return *type_system_sp.get(); >- } >- error = llvm::make_error<llvm::StringError>( >+ for (const auto &pair : m_map) { >+ if (pair.second && pair.second->SupportsLanguage(language)) { >+ // Add a new mapping for "language" to point to an already existing >+ // TypeSystem that supports this language >+ m_map[language] = pair.second; >+ if (pair.second.get()) >+ return *pair.second.get(); >+ return llvm::make_error<llvm::StringError>( > "TypeSystem for language " + > llvm::StringRef(Language::GetNameForLanguageType(language)) + > " doesn't exist", >@@ -290,68 +260,54 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, > } > } > >- return std::move(error); >+ if (!can_create) >+ return llvm::make_error<llvm::StringError>( >+ "Unable to find type system for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)), >+ llvm::inconvertibleErrorCode()); >+ >+ // Cache even if we get a shared pointer that contains a null type system >+ // back >+ auto type_system_sp = TypeSystem::CreateInstance(language, module); >+ m_map[language] = type_system_sp; >+ if (type_system_sp.get()) >+ return *type_system_sp.get(); >+ return llvm::make_error<llvm::StringError>( >+ "TypeSystem for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)) + >+ " doesn't exist", >+ llvm::inconvertibleErrorCode()); > } > > llvm::Expected<TypeSystem &> > TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, > Target *target, bool can_create) { >- llvm::Error error = llvm::Error::success(); >- assert(!error); // Check the success value when assertions are enabled > std::lock_guard<std::mutex> guard(m_mutex); >- if (m_clear_in_progress) { >- error = llvm::make_error<llvm::StringError>( >+ if (m_clear_in_progress) >+ return llvm::make_error<llvm::StringError>( > "Unable to get TypeSystem because TypeSystemMap is being cleared", > llvm::inconvertibleErrorCode()); >- } else { >- collection::iterator pos = m_map.find(language); >- if (pos != m_map.end()) { >- auto *type_system = pos->second.get(); >- if (type_system) { >- llvm::consumeError(std::move(error)); >- return *type_system; >- } >- error = llvm::make_error<llvm::StringError>( >- "TypeSystem for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)) + >- " doesn't exist", >- llvm::inconvertibleErrorCode()); >- return std::move(error); >- } > >- for (const auto &pair : m_map) { >- if (pair.second && pair.second->SupportsLanguage(language)) { >- // Add a new mapping for "language" to point to an already existing >- // TypeSystem that supports this language >- m_map[language] = pair.second; >- if (pair.second.get()) { >- llvm::consumeError(std::move(error)); >- return *pair.second.get(); >- } >- error = llvm::make_error<llvm::StringError>( >- "TypeSystem for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)) + >- " doesn't exist", >- llvm::inconvertibleErrorCode()); >- return std::move(error); >- } >- } >+ collection::iterator pos = m_map.find(language); >+ if (pos != m_map.end()) { >+ auto *type_system = pos->second.get(); >+ if (type_system) >+ return *type_system; >+ return llvm::make_error<llvm::StringError>( >+ "TypeSystem for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)) + >+ " doesn't exist", >+ llvm::inconvertibleErrorCode()); >+ } > >- if (!can_create) { >- error = llvm::make_error<llvm::StringError>( >- "Unable to find type system for language " + >- llvm::StringRef(Language::GetNameForLanguageType(language)), >- llvm::inconvertibleErrorCode()); >- } else { >- // Cache even if we get a shared pointer that contains a null type system >- // back >- auto type_system_sp = TypeSystem::CreateInstance(language, target); >- m_map[language] = type_system_sp; >- if (type_system_sp.get()) { >- llvm::consumeError(std::move(error)); >- return *type_system_sp.get(); >- } >- error = llvm::make_error<llvm::StringError>( >+ for (const auto &pair : m_map) { >+ if (pair.second && pair.second->SupportsLanguage(language)) { >+ // Add a new mapping for "language" to point to an already existing >+ // TypeSystem that supports this language >+ m_map[language] = pair.second; >+ if (pair.second.get()) >+ return *pair.second.get(); >+ return llvm::make_error<llvm::StringError>( > "TypeSystem for language " + > llvm::StringRef(Language::GetNameForLanguageType(language)) + > " doesn't exist", >@@ -359,5 +315,21 @@ TypeSystemMap::GetTypeSystemForLanguage(lldb::LanguageType language, > } > } > >- return std::move(error); >+ if (!can_create) >+ return llvm::make_error<llvm::StringError>( >+ "Unable to find type system for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)), >+ llvm::inconvertibleErrorCode()); >+ >+ // Cache even if we get a shared pointer that contains a null type system >+ // back >+ auto type_system_sp = TypeSystem::CreateInstance(language, target); >+ m_map[language] = type_system_sp; >+ if (type_system_sp.get()) >+ return *type_system_sp.get(); >+ return llvm::make_error<llvm::StringError>( >+ "TypeSystem for language " + >+ llvm::StringRef(Language::GetNameForLanguageType(language)) + >+ " doesn't exist", >+ llvm::inconvertibleErrorCode()); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 253881
:
227227
| 227244