aprantl updated this revision to Diff 193975.
aprantl added a comment.
Tweaked the name of the option after some off-line discussion with Jim.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60340/new/
https://reviews.llvm.org/D60340
Files:
lldb/include/lldb/Target/Process.h
lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
lldb/source/Target/Process.cpp
Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -144,7 +144,11 @@
"stepping and variable availability may not behave as expected."},
{"stop-on-exec", OptionValue::eTypeBoolean, true, true,
nullptr, {},
- "If true, stop when a shared library is loaded or unloaded."}};
+ "If true, stop when a shared library is loaded or unloaded."},
+ {"utility-expression-timeout", OptionValue::eTypeUInt64, false, 15,
+ nullptr, {},
+ "The time in seconds to wait for LLDB-internal utility expressions."}
+};
enum {
ePropertyDisableMemCache,
@@ -156,7 +160,8 @@
ePropertyDetachKeepsStopped,
ePropertyMemCacheLineSize,
ePropertyWarningOptimization,
- ePropertyStopOnExec
+ ePropertyStopOnExec,
+ ePropertyUtilityExpressionTimeout,
};
ProcessProperties::ProcessProperties(lldb_private::Process *process)
@@ -279,6 +284,13 @@
nullptr, idx, g_properties[idx].default_uint_value != 0);
}
+std::chrono::seconds ProcessProperties::GetUtilityExpressionTimeout() const {
+ const uint32_t idx = ePropertyUtilityExpressionTimeout;
+ uint64_t value = m_collection_sp->GetPropertyAtIndexAsUInt64(
+ nullptr, idx, g_properties[idx].default_uint_value);
+ return std::chrono::seconds(value);
+}
+
Status ProcessLaunchCommandOptions::SetOptionValue(
uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
@@ -3606,10 +3618,10 @@
bool receipt_received = false;
if (PrivateStateThreadIsValid()) {
while (!receipt_received) {
- // Check for a receipt for 2 seconds and then check if the private
+ // Check for a receipt for n seconds and then check if the private
// state thread is still around.
receipt_received =
- event_receipt_sp->WaitForEventReceived(std::chrono::seconds(2));
+ event_receipt_sp->WaitForEventReceived(GetUtilityExpressionTimeout());
if (!receipt_received) {
// Check if the private state thread is still around. If it isn't
// then we are done waiting
@@ -4902,7 +4914,7 @@
}
got_event =
- listener_sp->GetEvent(event_sp, std::chrono::milliseconds(500));
+ listener_sp->GetEvent(event_sp, GetUtilityExpressionTimeout());
if (!got_event) {
if (log)
log->Printf("Process::RunThreadPlan(): didn't get any event after "
@@ -5133,7 +5145,7 @@
log->PutCString("Process::RunThreadPlan(): Halt succeeded.");
got_event =
- listener_sp->GetEvent(event_sp, std::chrono::milliseconds(500));
+ listener_sp->GetEvent(event_sp, GetUtilityExpressionTimeout());
if (got_event) {
stop_state =
Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
===================================================================
--- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
+++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
@@ -344,7 +344,7 @@
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetStopOthers(true);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetTryAllThreads(false);
options.SetIsForUtilityExpr(true);
thread.CalculateExecutionContext(exe_ctx);
Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
===================================================================
--- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
+++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
@@ -347,7 +347,7 @@
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetStopOthers(true);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetTryAllThreads(false);
options.SetIsForUtilityExpr(true);
thread.CalculateExecutionContext(exe_ctx);
Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
===================================================================
--- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -342,7 +342,7 @@
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetStopOthers(true);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetTryAllThreads(false);
options.SetIsForUtilityExpr(true);
thread.CalculateExecutionContext(exe_ctx);
Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
===================================================================
--- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -333,7 +333,7 @@
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetStopOthers(true);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetTryAllThreads(false);
options.SetIsForUtilityExpr(true);
thread.CalculateExecutionContext(exe_ctx);
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -111,7 +111,13 @@
namespace {
static constexpr PropertyDefinition g_properties[] = {
- {"packet-timeout", OptionValue::eTypeUInt64, true, 1, NULL, {},
+ {"packet-timeout", OptionValue::eTypeUInt64, true, 1
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+ + 4
+#endif
+#endif
+ , NULL, {},
"Specify the default packet timeout in seconds."},
{"target-definition-file", OptionValue::eTypeFileSpec, true, 0, NULL, {},
"The file that provides the description for remote target registers."}};
Index: lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===================================================================
--- lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -60,7 +60,7 @@
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
options.SetDebug(false);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetTrapExceptions(false);
addr_t prot_arg;
@@ -148,7 +148,7 @@
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
options.SetDebug(false);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetTrapExceptions(false);
AddressRange munmap_range;
@@ -197,7 +197,7 @@
options.SetIgnoreBreakpoints(true);
options.SetTryAllThreads(true);
options.SetDebug(false);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetTrapExceptions(trap_exceptions);
ClangASTContext *clang_ast_context =
Index: lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
===================================================================
--- lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -621,7 +621,7 @@
expr_options.SetLanguage(eLanguageTypeC_plus_plus);
expr_options.SetTrapExceptions(false); // dlopen can't throw exceptions, so
// don't do the work to trap them.
- expr_options.SetTimeout(std::chrono::seconds(2));
+ expr_options.SetTimeout(process->GetUtilityExpressionTimeout());
Status expr_error;
ExpressionResults result =
@@ -946,7 +946,7 @@
options.SetUnwindOnError(true);
options.SetTrapExceptions(false); // dlopen can't throw exceptions, so
// don't do the work to trap them.
- options.SetTimeout(std::chrono::seconds(2));
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetIsForUtilityExpr(true);
Value return_value;
Index: lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
===================================================================
--- lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -148,8 +148,6 @@
result.push_back(new_thread_sp);
}
-static constexpr std::chrono::seconds g_get_stack_function_timeout(2);
-
HistoryThreads MemoryHistoryASan::GetHistoryThreads(lldb::addr_t address) {
HistoryThreads result;
@@ -177,7 +175,7 @@
options.SetTryAllThreads(true);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_get_stack_function_timeout);
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetPrefix(memory_history_asan_command_prefix);
options.SetAutoApplyFixIts(false);
options.SetLanguage(eLanguageTypeObjC_plus_plus);
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -70,9 +70,6 @@
using namespace lldb;
using namespace lldb_private;
-// 2 second timeout when running utility functions
-static constexpr std::chrono::seconds g_utility_function_timeout(2);
-
static const char *g_get_dynamic_class_info_name =
"__lldb_apple_objc_v2_get_dynamic_class_info";
// Testing using the new C++11 raw string literals. If this breaks GCC then we
@@ -1410,7 +1407,7 @@
options.SetTryAllThreads(false);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_utility_function_timeout);
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetIsForUtilityExpr(true);
Value return_value;
@@ -1661,7 +1658,7 @@
options.SetTryAllThreads(false);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_utility_function_timeout);
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetIsForUtilityExpr(true);
Value return_value;
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -45,8 +45,6 @@
using namespace lldb;
using namespace lldb_private;
-static constexpr std::chrono::seconds g_po_function_timeout(15);
-
AppleObjCRuntime::~AppleObjCRuntime() {}
AppleObjCRuntime::AppleObjCRuntime(Process *process)
@@ -171,7 +169,7 @@
options.SetTryAllThreads(true);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_po_function_timeout);
+ options.SetTimeout(process->GetUtilityExpressionTimeout());
options.SetIsForUtilityExpr(true);
ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -567,7 +567,7 @@
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
options.SetStopOthers(true);
- options.SetTimeout(std::chrono::milliseconds(500));
+ options.SetTimeout(m_process->GetUtilityExpressionTimeout());
options.SetTryAllThreads(false);
thread_sp->CalculateExecutionContext(exe_ctx);
Index: lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
===================================================================
--- lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
@@ -131,7 +131,7 @@
options.SetTryAllThreads(true);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(std::chrono::seconds(2));
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetPrefix(ub_sanitizer_retrieve_report_data_prefix);
options.SetAutoApplyFixIts(false);
options.SetLanguage(eLanguageTypeObjC_plus_plus);
Index: lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
===================================================================
--- lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
@@ -60,8 +60,6 @@
ThreadSanitizerRuntime::~ThreadSanitizerRuntime() { Deactivate(); }
-static constexpr std::chrono::seconds g_retrieve_data_function_timeout(2);
-
const char *thread_sanitizer_retrieve_report_data_prefix = R"(
extern "C"
{
@@ -318,7 +316,7 @@
options.SetTryAllThreads(true);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_retrieve_data_function_timeout);
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetPrefix(thread_sanitizer_retrieve_report_data_prefix);
options.SetAutoApplyFixIts(false);
options.SetLanguage(eLanguageTypeObjC_plus_plus);
Index: lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
===================================================================
--- lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
+++ lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
@@ -71,7 +71,6 @@
return symbol != nullptr;
}
-static constexpr std::chrono::seconds g_retrieve_report_data_function_timeout(2);
const char *address_sanitizer_retrieve_report_data_prefix = R"(
extern "C"
{
@@ -126,7 +125,7 @@
options.SetTryAllThreads(true);
options.SetStopOthers(true);
options.SetIgnoreBreakpoints(true);
- options.SetTimeout(g_retrieve_report_data_function_timeout);
+ options.SetTimeout(process_sp->GetUtilityExpressionTimeout());
options.SetPrefix(address_sanitizer_retrieve_report_data_prefix);
options.SetAutoApplyFixIts(false);
options.SetLanguage(eLanguageTypeObjC_plus_plus);
Index: lldb/include/lldb/Target/Process.h
===================================================================
--- lldb/include/lldb/Target/Process.h
+++ lldb/include/lldb/Target/Process.h
@@ -68,36 +68,22 @@
~ProcessProperties() override;
bool GetDisableMemoryCache() const;
-
uint64_t GetMemoryCacheLineSize() const;
-
Args GetExtraStartupCommands() const;
-
void SetExtraStartupCommands(const Args &args);
-
FileSpec GetPythonOSPluginPath() const;
-
void SetPythonOSPluginPath(const FileSpec &file);
-
bool GetIgnoreBreakpointsInExpressions() const;
-
void SetIgnoreBreakpointsInExpressions(bool ignore);
-
bool GetUnwindOnErrorInExpressions() const;
-
void SetUnwindOnErrorInExpressions(bool ignore);
-
bool GetStopOnSharedLibraryEvents() const;
-
void SetStopOnSharedLibraryEvents(bool stop);
-
bool GetDetachKeepsStopped() const;
-
void SetDetachKeepsStopped(bool keep_stopped);
-
bool GetWarningsOptimization() const;
-
bool GetStopOnExec() const;
+ std::chrono::seconds GetUtilityExpressionTimeout() const;
protected:
static void OptionValueChangedCallback(void *baton,
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits