| 333 | } |
| 334 | |
| 335 | void CPU::walkStack(U32 eip, U32 ebp, U32 indent) { |
| 336 | U32 moduleEip = this->thread->process->getModuleEip(this->seg[CS].address+eip); |
| 337 | BString name = this->thread->process->getModuleName(this->seg[CS].address+eip); |
| 338 | BString functionName; |
| 339 | |
| 340 | if (name != "Unknown") { |
| 341 | //functionName = getFunctionName(name, moduleEip); |
| 342 | } |
| 343 | name = Fs::getFileNameFromPath(name); |
| 344 | |
| 345 | std::vector<BString> parts; |
| 346 | functionName.split("\n", parts); |
| 347 | if (parts.size()) { |
| 348 | functionName = parts[0]; |
| 349 | } |
| 350 | klog_fmt("%*s %-20s %-40s %08x / %08x", indent, "", name.length()?name.c_str():"Unknown", functionName.c_str(), eip, moduleEip); |
| 351 | |
| 352 | ChangeThread c(this->thread); |
| 353 | if (this->memory->canRead(ebp, 8)) { |
| 354 | U32 prevEbp = memory->readd(ebp); |
| 355 | U32 returnEip = memory->readd(ebp+4); |
| 356 | if (prevEbp==0) |
| 357 | return; |
| 358 | walkStack(returnEip, prevEbp, indent); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | void CPU::cpuid() { |
| 363 | CPU* cpu = this; |
no test coverage detected