summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Thread.cpp
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-05-15 01:46:45 +0000
committerAlex Langford <apl@fb.com>2019-05-15 01:46:45 +0000
commitbd3adfe5e3bcb6f8f16166d1fd8a3f3c4fd70307 (patch)
tree39a5ab6ac8c26c2da5e8dc5048cc80a9639f7e53 /lldb/source/Target/Thread.cpp
parent658cad1287419dc90520a679cef9d7331f096fe1 (diff)
downloadbcm5719-llvm-bd3adfe5e3bcb6f8f16166d1fd8a3f3c4fd70307.tar.gz
bcm5719-llvm-bd3adfe5e3bcb6f8f16166d1fd8a3f3c4fd70307.zip
[Target] Generalize some behavior in Thread
Summary: I don't think there's a good reason for this behavior to be considered ObjC-specific. We can generalize this. Differential Revision: https://reviews.llvm.org/D61776 llvm-svn: 360741
Diffstat (limited to 'lldb/source/Target/Thread.cpp')
-rw-r--r--lldb/source/Target/Thread.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 78176412b3a..a8b57c86f59 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -2209,25 +2209,31 @@ ValueObjectSP Thread::GetCurrentException() {
if (auto e = recognized_frame->GetExceptionObject())
return e;
- // FIXME: For now, only ObjC exceptions are supported. This should really
- // iterate over all language runtimes and ask them all to give us the current
- // exception.
- if (auto runtime = GetProcess()->GetObjCLanguageRuntime())
- if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
- return e;
+ // NOTE: Even though this behavior is generalized, only ObjC is actually
+ // supported at the moment.
+ for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
+ if (auto runtime = GetProcess()->GetLanguageRuntime(
+ static_cast<lldb::LanguageType>(lang)))
+ if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+ return e;
+ }
return ValueObjectSP();
}
ThreadSP Thread::GetCurrentExceptionBacktrace() {
ValueObjectSP exception = GetCurrentException();
- if (!exception) return ThreadSP();
+ if (!exception)
+ return ThreadSP();
- // FIXME: For now, only ObjC exceptions are supported. This should really
- // iterate over all language runtimes and ask them all to give us the current
- // exception.
- auto runtime = GetProcess()->GetObjCLanguageRuntime();
- if (!runtime) return ThreadSP();
+ // NOTE: Even though this behavior is generalized, only ObjC is actually
+ // supported at the moment.
+ for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
+ if (auto runtime = GetProcess()->GetLanguageRuntime(
+ static_cast<lldb::LanguageType>(lang)))
+ if (auto bt = runtime->GetBacktraceThreadFromException(exception))
+ return bt;
+ }
- return runtime->GetBacktraceThreadFromException(exception);
+ return ThreadSP();
}
OpenPOWER on IntegriCloud