MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / stringFromPointer

Method stringFromPointer

pcsx2/DebugTools/DebugInterface.cpp:66–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66char* DebugInterface::stringFromPointer(u32 p)
67{
68 const int BUFFER_LEN = 64;
69 static char buf[BUFFER_LEN] = {0};
70
71 if (!isValidAddress(p))
72 return NULL;
73
74 // This is going to blow up if it hits a TLB miss..
75 // Hopefully the checks in isValidAddress() are sufficient.
76 for (u32 i = 0; i < BUFFER_LEN; i++)
77 {
78 char c = Read8(p + i);
79 buf[i] = c;
80
81 if (c == 0)
82 {
83 return i > 0 ? buf : NULL;
84 }
85 else if (c < 0x20 || c >= 0x7f)
86 {
87 // non printable character
88 return NULL;
89 }
90 }
91
92 buf[BUFFER_LEN - 1] = 0;
93 buf[BUFFER_LEN - 2] = '~';
94 return buf;
95}
96
97std::optional<u32> DebugInterface::getCallerStackPointer(const ccc::Function& currentFunction)
98{

Callers 1

generateDisplayStringMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected