Reactor: Support printing pointers

Change-Id: Ibc630c1b37ecaad87f9c015d8fecc38a6d6b6392
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28396
Presubmit-Ready: Ben Clayton <bclayton@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Reactor/Reactor.hpp b/src/Reactor/Reactor.hpp
index a0064b9..0837703 100644
--- a/src/Reactor/Reactor.hpp
+++ b/src/Reactor/Reactor.hpp
@@ -2977,6 +2977,13 @@
 			return out + "]";
 		}
 
+		static std::string addr(const void* ptr)
+		{
+			char buf[32];
+			snprintf(buf, sizeof(buf), "%p", ptr);
+			return buf;
+		}
+
 	public:
 		const std::string format;
 		const std::vector<Value*> values;
@@ -2994,7 +3001,6 @@
 		template <typename T>
 		PrintValue(const T* arr, int len) : format(fmt(Ty<T>::fmt, len)), values(val(arr, len)) {}
 
-
 		// PrintValue constructors for plain-old-data values.
 		PrintValue(bool v) : format(v ? "true" : "false") {}
 		PrintValue(int8_t v) : format(std::to_string(v)) {}
@@ -3005,11 +3011,16 @@
 		PrintValue(uint32_t v) : format(std::to_string(v)) {}
 		PrintValue(int64_t v) : format(std::to_string(v)) {}
 		PrintValue(uint64_t v) : format(std::to_string(v)) {}
+		PrintValue(long v) : format(std::to_string(v)) {}
+		PrintValue(unsigned long v) : format(std::to_string(v)) {}
 		PrintValue(float v) : format(std::to_string(v)) {}
 		PrintValue(double v) : format(std::to_string(v)) {}
 		PrintValue(const char* v) : format(v) {}
 		PrintValue(const std::string& v) : format(v) {}
 
+		template <typename T>
+		PrintValue(const T* v) : format(addr(v)) {}
+
 		// vals is a helper to build composite value lists.
 		// vals returns the full, sequential list of printf argument values used
 		// to print all the provided variadic values.