Rearranging --abort_before_entry.

This commit is contained in:
Ben Vanik 2013-02-03 00:34:45 -08:00
parent 4f9e6b0547
commit 63f0785ecf
3 changed files with 13 additions and 9 deletions

View File

@ -14,7 +14,7 @@ fi
--trace_kernel_calls=true \ --trace_kernel_calls=true \
--trace_user_calls=true \ --trace_user_calls=true \
--trace_instructions=false \ --trace_instructions=false \
\#--abort_before_entry=true \ --abort_before_entry=true \
1>build/run.txt 1>build/run.txt
#2>build/run.llvm.txt \ #2>build/run.llvm.txt \

View File

@ -9,6 +9,8 @@
#include "kernel/modules/xboxkrnl/module.h" #include "kernel/modules/xboxkrnl/module.h"
#include <gflags/gflags.h>
#include "kernel/modules/xboxkrnl/kernel_state.h" #include "kernel/modules/xboxkrnl/kernel_state.h"
#include "kernel/modules/xboxkrnl/objects/xmodule.h" #include "kernel/modules/xboxkrnl/objects/xmodule.h"
@ -26,6 +28,10 @@ using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl; using namespace xe::kernel::xboxkrnl;
DEFINE_bool(abort_before_entry, false,
"Abort execution right before launching the module.");
namespace { namespace {
} }
@ -117,6 +123,12 @@ int XboxkrnlModule::LaunchModule(const char* path) {
return 1; return 1;
} }
if (FLAGS_abort_before_entry) {
XELOGI(XT("--abort_before_entry causing an early exit"));
module->Release();
return 0;
}
// Launch the module. // Launch the module.
// NOTE: this won't return until the module exits. // NOTE: this won't return until the module exits.
result_code = module->Launch(0); result_code = module->Launch(0);

View File

@ -18,10 +18,6 @@ using namespace xe::dbg;
using namespace xe::kernel; using namespace xe::kernel;
DEFINE_bool(abort_before_entry, false,
"Abort execution right before launching the module.");
class Run { class Run {
public: public:
Run(); Run();
@ -70,10 +66,6 @@ XECLEANUP:
} }
int Run::Launch(const xechar_t* path) { int Run::Launch(const xechar_t* path) {
if (FLAGS_abort_before_entry) {
return 0;
}
// Normalize the path and make absolute. // Normalize the path and make absolute.
// TODO(benvanik): move this someplace common. // TODO(benvanik): move this someplace common.
xechar_t abs_path[XE_MAX_PATH]; xechar_t abs_path[XE_MAX_PATH];