From 06ba273492b9adc915d63be85d27303e298a1280 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 21 Feb 2016 14:26:16 -0800 Subject: [PATCH] Warn and be ok with symbol services failing. --- src/xenia/cpu/processor.cc | 9 +++++++-- src/xenia/cpu/stack_walker.h | 1 + src/xenia/cpu/stack_walker_win.cc | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/processor.cc b/src/xenia/cpu/processor.cc index eaa9165c8..19e9dfaeb 100644 --- a/src/xenia/cpu/processor.cc +++ b/src/xenia/cpu/processor.cc @@ -140,10 +140,15 @@ bool Processor::Setup() { frontend_ = std::move(frontend); // 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()); if (!stack_walker_) { - XELOGE("Unable to create stack walker"); - return false; + // TODO(benvanik): disable features. + if (FLAGS_debug) { + XELOGW("Disabling --debug due to lack of stack walker"); + FLAGS_debug = false; + } } // Open the trace data path, if requested. diff --git a/src/xenia/cpu/stack_walker.h b/src/xenia/cpu/stack_walker.h index 0d120d1e6..d9cabaf6a 100644 --- a/src/xenia/cpu/stack_walker.h +++ b/src/xenia/cpu/stack_walker.h @@ -58,6 +58,7 @@ struct StackFrame { class StackWalker { public: // 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 Create(backend::CodeCache* code_cache); // Dumps all thread stacks to the log. diff --git a/src/xenia/cpu/stack_walker_win.cc b/src/xenia/cpu/stack_walker_win.cc index 50ec5707f..9ff6b220c 100644 --- a/src/xenia/cpu/stack_walker_win.cc +++ b/src/xenia/cpu/stack_walker_win.cc @@ -106,7 +106,7 @@ bool InitializeStackWalker() { options |= SYMOPT_FAIL_CRITICAL_ERRORS; sym_set_options_(options); if (!sym_initialize_(GetCurrentProcess(), nullptr, TRUE)) { - XELOGE("Unable to initialize symbol services"); + XELOGE("Unable to initialize symbol services - already in use?"); return false; } @@ -311,7 +311,7 @@ std::unique_ptr StackWalker::Create( backend::CodeCache* code_cache) { auto stack_walker = std::make_unique(code_cache); if (!stack_walker->Initialize()) { - XELOGE("Unable to initialize stack walker"); + XELOGE("Unable to initialize stack walker: debug/save states disabled"); return nullptr; } return std::unique_ptr(stack_walker.release());