Commits

spencercw  committed 33ba8df

Implement displaying string values in the debugger.

  • Participants
  • Parent commits 5ae18f7

Comments (0)

Files changed (1)

File gb_debugger_msvs/properties/variable_property.cpp

 
 #include <fstream>
 #include <iomanip>
+#include <limits>
 #include <sstream>
 
 #include "expression_context.h"
 
 using boost::shared_ptr;
 using std::hex;
+using std::numeric_limits;
 using std::setfill;
 using std::setw;
 using std::string;
 			case CdbFile::TypeEntry::INTERNAL_RAM_POINTER:
 			case CdbFile::TypeEntry::PAGED_POINTER:
 			case CdbFile::TypeEntry::UPPER_128_BYTE_POINTER:
-				// Value is a pointer so always display it in hexadecimal notatian
+				// Value is a pointer so display it in hexadecimal notatian
 				oss << hex << setfill(L'0') << L"0x" << setw(4) << value_;
+				if (variable_->type->chain[1].type == CdbFile::TypeEntry::CHAR &&
+					value_ <= (numeric_limits<uint16_t>::max)())
+				{
+					// Value is a string so display its value as well
+					uint16_t ptr = static_cast<uint16_t>(value_);
+					oss << " \"";
+					uint8_t ch;
+					for (gbd->memRead(ptr++, 1, &ch); ch; gbd->memRead(ptr++, 1, &ch))
+					{
+						oss << static_cast<char>(ch);
+					}
+					oss << "\"";
+				}
 				break;
 
 			case CdbFile::TypeEntry::LONG: