| 165 | } |
| 166 | |
| 167 | std::vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter) |
| 168 | { |
| 169 | char temp[3072]; |
| 170 | std::vector<std::string> trace; |
| 171 | iter->Reset(); |
| 172 | |
| 173 | if (!iter->Done()) |
| 174 | { |
| 175 | trace.push_back("[SM] Call stack trace:"); |
| 176 | |
| 177 | for (int index = 0; !iter->Done(); iter->Next(), index++) |
| 178 | { |
| 179 | const char *fn = iter->FunctionName(); |
| 180 | if (!fn) |
| 181 | { |
| 182 | fn = "<unknown function>"; |
| 183 | } |
| 184 | if (iter->IsNativeFrame()) |
| 185 | { |
| 186 | g_pSM->Format(temp, sizeof(temp), "[SM] [%d] %s", index, fn); |
| 187 | trace.push_back(temp); |
| 188 | continue; |
| 189 | } |
| 190 | if (iter->IsScriptedFrame()) |
| 191 | { |
| 192 | const char *file = iter->FilePath(); |
| 193 | if (!file) |
| 194 | { |
| 195 | file = "<unknown>"; |
| 196 | } |
| 197 | g_pSM->Format(temp, sizeof(temp), "[SM] [%d] Line %d, %s::%s", |
| 198 | index, |
| 199 | iter->LineNumber(), |
| 200 | file, |
| 201 | fn); |
| 202 | |
| 203 | trace.push_back(temp); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | return trace; |
| 209 | } |
no test coverage detected