Skip to content

Instantly share code, notes, and snippets.

@croepha
Created March 29, 2018 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save croepha/7ada96a51782ffc04dab9a906b708e8a to your computer and use it in GitHub Desktop.
Save croepha/7ada96a51782ffc04dab9a906b708e8a to your computer and use it in GitHub Desktop.
int main() {
SBDebugger::Initialize();
SBDebugger debugger(SBDebugger::Create());
assert(debugger.IsValid());
debugger.SetAsync(false);
SBStream out_stream;
out_stream.RedirectToFileHandle(stdout, false);
debugger.GetDescription(out_stream);
out_stream.Printf("\n");
SBTarget target = debugger.CreateTarget("./build/stb_sb_test.exec");
assert(target.IsValid());
auto bp = target.BreakpointCreateByRegex("push_string");
cro_log(bp.GetNumLocations());
bp.GetDescription(out_stream);
out_stream.Printf("\n");
auto process = target.LaunchSimple(0,0,0);
assert(process.IsValid());
process.GetDescription(out_stream);
out_stream.Printf("\n");
auto state = process.GetState();
cro_log(SBDebugger::StateAsCString(state)); // "launching", expecting it to block and stop at the breakpoint...
process.GetDescription(out_stream);
out_stream.Printf("\n");
SBDebugger::Terminate();
cro_log("fin");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment