Skip to content

Commit

Permalink
main - Add a hacky option to pause to allow attaching a debugger (e.g…
Browse files Browse the repository at this point in the history
…. WinDbg time-travel debug)
  • Loading branch information
thepowersgang committed Jan 2, 2024
1 parent fd059c1 commit 2268b0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ struct ProgramParams
::std::set< ::std::string> features;

struct {
/// Testing hack: Pause just after startup (to allow a debugger to attach)
bool pause = false;

bool disable_mir_optimisations = false;
bool full_validate = false;
bool full_validate_early = false;
Expand Down Expand Up @@ -239,6 +242,12 @@ int main(int argc, char *argv[])
init_debug_list();
ProgramParams params(argc, argv);

if(params.debug.pause) {
char c;
::std::cerr << "Pausing to attach a debugger\nType any text to continue" << std::endl;
::std::cin >> c;
}

// Set up cfg values
CompilePhaseV("Setup", [&]() {
Cfg_SetValue("rust_compiler", "mrustc");
Expand Down Expand Up @@ -1133,6 +1142,9 @@ ProgramParams::ProgramParams(int argc, char *argv[])
exit(1);
}
}
else if( optname == "pause-after-start" ) {
this->debug.pause = true;
}
else if( optname == "print-cfgs") {
no_optval();
this->print_cfgs = true;
Expand Down

0 comments on commit 2268b0a

Please sign in to comment.