Skip to content

Commit

Permalink
Add calls to stop and wait for a debugger (#916)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Welton <[email protected]>
  • Loading branch information
bwelton and Benjamin Welton authored Jun 7, 2024
1 parent 680448c commit 45e165b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions source/lib/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,29 @@ read_command_line(pid_t _pid)
}
} // namespace common
} // namespace rocprofiler

namespace
{
std::atomic<bool>&
debugger_block()
{
static std::atomic<bool> block = {true};
return block;
}
} // namespace

extern "C" {
void
rocprofiler_debugger_block()
{
while(debugger_block().load() == true)
{};
// debugger_block().exchange(true);
}

void
rocprofiler_debugger_continue()
{
debugger_block().exchange(false);
}
}
7 changes: 7 additions & 0 deletions source/lib/common/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,10 @@ yield(PredicateT&& predicate,
}
} // namespace common
} // namespace rocprofiler

extern "C" {
void
rocprofiler_debugger_block();
void
rocprofiler_debugger_continue();
}

0 comments on commit 45e165b

Please sign in to comment.