Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SBListener listener = debugger.GetListener();
- SBProcess process = target.Launch(listener, args, env, nullptr, nullptr,
- nullptr, "/home/dev/helloWorld",
- 0, true, error);
- process.GetBroadcaster().AddListener(listener,
- SBProcess::eBroadcastBitStateChanged |
- SBProcess::eBroadcastBitSTDOUT);
- process.Continue();
- while(true) {
- SBEvent event;
- if(listener.WaitForEvent(6, event)) {
- if(!event.IsValid()) {
- break;
- }
- SBThread thread = process.GetThreadAtIndex(0);
- StateType state = process.GetStateFromEvent(event);
- SBStream stream;
- thread.GetStatus(stream);
- event.GetDescription(stream);
- std::cout << stream.GetData() << std::endl;
- auto threadStopReason = thread.GetStopReason();
- if(event.GetType() == 1 && state == eStateStopped) {
- if(threadStopReason == eStopReasonBreakpoint) {
- uint64_t bpId = thread.GetStopReasonDataAtIndex(0);
- if(bpId == static_cast<uint64_t>(bp1.GetID())) {
- std::cout << "Stopped at breakpoint" << std::endl;
- thread.StepOver();
- }
- } else if (threadStopReason == eStopReasonPlanComplete) {
- std::cout << "Stopped at step" << std::endl;
- }
- }
- } else {
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement