Commit 4fbe46db by Ben Clayton

Vulkan/Debug: Don't accumulate function breakpoints

A `SetFunctionBreakpointsRequest` contains the full list of breakpoints. Clear the list in the context before adding the new list. Also add a `getFunctionBreakpoints()` accessor so you can enumerate the list of function breakpoints. Bug: b/145351270 Change-Id: Ia7fad403eace7a95a15671e2ce90b8e083da3ce7 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48694Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent ce1584d1
...@@ -399,6 +399,11 @@ std::shared_ptr<Variables> Context::Lock::get(Variables::ID id) ...@@ -399,6 +399,11 @@ std::shared_ptr<Variables> Context::Lock::get(Variables::ID id)
return ctx->variables.get(id); return ctx->variables.get(id);
} }
void Context::Lock::clearFunctionBreakpoints()
{
ctx->functionBreakpoints.clear();
}
void Context::Lock::addFunctionBreakpoint(const std::string &name) void Context::Lock::addFunctionBreakpoint(const std::string &name)
{ {
ctx->functionBreakpoints.emplace(name); ctx->functionBreakpoints.emplace(name);
...@@ -414,5 +419,10 @@ bool Context::Lock::isFunctionBreakpoint(const std::string &name) ...@@ -414,5 +419,10 @@ bool Context::Lock::isFunctionBreakpoint(const std::string &name)
return ctx->functionBreakpoints.count(name) > 0; return ctx->functionBreakpoints.count(name) > 0;
} }
std::unordered_set<std::string> Context::Lock::getFunctionBreakpoints()
{
return ctx->functionBreakpoints;
}
} // namespace dbg } // namespace dbg
} // namespace vk } // namespace vk
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_set>
#include <vector> #include <vector>
namespace vk { namespace vk {
...@@ -118,6 +119,9 @@ public: ...@@ -118,6 +119,9 @@ public:
// references. // references.
std::shared_ptr<Variables> get(ID<Variables>); std::shared_ptr<Variables> get(ID<Variables>);
// clearFunctionBreakpoints() removes all function breakpoints.
void clearFunctionBreakpoints();
// addFunctionBreakpoint() adds a breakpoint to the start of the // addFunctionBreakpoint() adds a breakpoint to the start of the
// function with the given name. // function with the given name.
void addFunctionBreakpoint(const std::string &name); void addFunctionBreakpoint(const std::string &name);
...@@ -131,6 +135,9 @@ public: ...@@ -131,6 +135,9 @@ public:
// name has a function breakpoint set. // name has a function breakpoint set.
bool isFunctionBreakpoint(const std::string &name); bool isFunctionBreakpoint(const std::string &name);
// getFunctionBreakpoints() returns all the set function breakpoints.
std::unordered_set<std::string> getFunctionBreakpoints();
private: private:
Lock(const Lock &) = delete; Lock(const Lock &) = delete;
Lock &operator=(const Lock &) = delete; Lock &operator=(const Lock &) = delete;
......
...@@ -115,6 +115,7 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port) ...@@ -115,6 +115,7 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port)
} }
{ {
auto lock = ctx->lock(); auto lock = ctx->lock();
lock.clearFunctionBreakpoints();
for(auto const &reqBP : req.breakpoints) for(auto const &reqBP : req.breakpoints)
{ {
lock.addFunctionBreakpoint(reqBP.name.c_str()); lock.addFunctionBreakpoint(reqBP.name.c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment