jrprice / Oclgrind

An OpenCL device simulator and debugger
Other
346 stars 61 forks source link

Print unsigned values (or better hex) #151

Open x8-999-github opened 6 years ago

x8-999-github commented 6 years ago

Hello,

It would bey very nice if it where possible to print value in hex and if possible also print unsigned values as unsigned. In gdb the print command accepts /x to print in hex. I currently made a small modification for myself that .. is not ready for prime time.

diff --git a/src/core/common.cpp b/src/core/common.cpp
index ea92196..7760605 100644
--- a/src/core/common.cpp
+++ b/src/core/common.cpp
@@ -723,7 +723,7 @@ namespace oclgrind
       switch (size)
       {
       case 1:
-        cout << (int)*(char*)data;
+        cout << hex << (unsigned int)(unsigned char)*(char*)data;
         break;
       case 2:
         cout << *(short*)data;