Vulkan/Debug: Add File::getBreakpoints()
Simple accessor for the breakpoint set.
Bug: b/145351270
Change-Id: Ifb534482009b5842d8bd2a796c082625b770e298
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48691
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Vulkan/Debug/File.cpp b/src/Vulkan/Debug/File.cpp
index b14c0e5..fb193bf 100644
--- a/src/Vulkan/Debug/File.cpp
+++ b/src/Vulkan/Debug/File.cpp
@@ -16,8 +16,6 @@
#include "marl/mutex.h"
-#include <unordered_set>
-
namespace {
////////////////////////////////////////////////////////////////////////////////
@@ -29,6 +27,7 @@
void clearBreakpoints() override;
void addBreakpoint(int line) override;
bool hasBreakpoint(int line) const override;
+ std::unordered_set<int> getBreakpoints() const override;
protected:
FileBase(ID id, std::string dir, std::string name, std::string source);
@@ -60,6 +59,12 @@
return breakpoints.count(line) > 0;
}
+std::unordered_set<int> FileBase::getBreakpoints() const
+{
+ marl::lock lock(breakpointMutex);
+ return breakpoints;
+}
+
////////////////////////////////////////////////////////////////////////////////
// VirtualFile
////////////////////////////////////////////////////////////////////////////////
@@ -129,4 +134,4 @@
}
} // namespace dbg
-} // namespace vk
\ No newline at end of file
+} // namespace vk
diff --git a/src/Vulkan/Debug/File.hpp b/src/Vulkan/Debug/File.hpp
index 342d512..60ce4bd 100644
--- a/src/Vulkan/Debug/File.hpp
+++ b/src/Vulkan/Debug/File.hpp
@@ -19,6 +19,7 @@
#include <memory>
#include <string>
+#include <unordered_set>
namespace vk {
namespace dbg {
@@ -51,6 +52,9 @@
// line with the given index.
virtual bool hasBreakpoint(int line) const = 0;
+ // getBreakpoints() returns all the breakpoints set in the file.
+ virtual std::unordered_set<int> getBreakpoints() const = 0;
+
// isVirtual() returns true iff the file is not backed by the filesystem.
virtual bool isVirtual() const = 0;