Warn and be ok with symbol services failing.

This commit is contained in:
Ben Vanik 2016-02-21 14:26:16 -08:00
parent 8bf5eba098
commit 06ba273492
3 changed files with 10 additions and 4 deletions

View File

@ -140,10 +140,15 @@ bool Processor::Setup() {
frontend_ = std::move(frontend); frontend_ = std::move(frontend);
// Stack walker is used when profiling, debugging, and dumping. // Stack walker is used when profiling, debugging, and dumping.
// Note that creation may fail, in which case we'll have to disable those
// features.
stack_walker_ = StackWalker::Create(backend_->code_cache()); stack_walker_ = StackWalker::Create(backend_->code_cache());
if (!stack_walker_) { if (!stack_walker_) {
XELOGE("Unable to create stack walker"); // TODO(benvanik): disable features.
return false; if (FLAGS_debug) {
XELOGW("Disabling --debug due to lack of stack walker");
FLAGS_debug = false;
}
} }
// Open the trace data path, if requested. // Open the trace data path, if requested.

View File

@ -58,6 +58,7 @@ struct StackFrame {
class StackWalker { class StackWalker {
public: public:
// Creates a stack walker. Only one should exist within a process. // Creates a stack walker. Only one should exist within a process.
// May fail if another process has mucked with ours (like RenderDoc).
static std::unique_ptr<StackWalker> Create(backend::CodeCache* code_cache); static std::unique_ptr<StackWalker> Create(backend::CodeCache* code_cache);
// Dumps all thread stacks to the log. // Dumps all thread stacks to the log.

View File

@ -106,7 +106,7 @@ bool InitializeStackWalker() {
options |= SYMOPT_FAIL_CRITICAL_ERRORS; options |= SYMOPT_FAIL_CRITICAL_ERRORS;
sym_set_options_(options); sym_set_options_(options);
if (!sym_initialize_(GetCurrentProcess(), nullptr, TRUE)) { if (!sym_initialize_(GetCurrentProcess(), nullptr, TRUE)) {
XELOGE("Unable to initialize symbol services"); XELOGE("Unable to initialize symbol services - already in use?");
return false; return false;
} }
@ -311,7 +311,7 @@ std::unique_ptr<StackWalker> StackWalker::Create(
backend::CodeCache* code_cache) { backend::CodeCache* code_cache) {
auto stack_walker = std::make_unique<Win32StackWalker>(code_cache); auto stack_walker = std::make_unique<Win32StackWalker>(code_cache);
if (!stack_walker->Initialize()) { if (!stack_walker->Initialize()) {
XELOGE("Unable to initialize stack walker"); XELOGE("Unable to initialize stack walker: debug/save states disabled");
return nullptr; return nullptr;
} }
return std::unique_ptr<StackWalker>(stack_walker.release()); return std::unique_ptr<StackWalker>(stack_walker.release());