MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / getFunctionName

Function getFunctionName

source/emulation/cpu/common/cpu.cpp:295–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295BString getFunctionName(BString name, U32 moduleEip) {
296 KProcessPtr process = KProcess::create();
297 std::vector<BString> args;
298 std::vector<BString> env;
299 KFileDescriptorPtr fd;
300
301 if (!name.length())
302 return B("Unknown");
303 args.push_back(B("/usr/local/bin/addr2line"));
304 args.push_back(B("-e"));
305 args.push_back(name);
306 args.push_back(B("-f"));
307 args.push_back(BString::valueOf(moduleEip, 16));
308 KThread* thread = process->startProcess(B("/usr/local/bin"), args, env, 0, 0, 0, 0);
309 if (!thread)
310 return B("");
311
312 KThread* tmpThread = new KThread(0, process);
313 {
314 ChangeThread c(tmpThread);
315 tty9Buffer = "";
316 std::shared_ptr<FsNode> parent = Fs::getNodeFromLocalPath(B(""), B("/dev"), true);
317 std::shared_ptr<FsNode> node = Fs::addVirtualFile(B("/dev/tty9"), openTTY9, K__S_IWRITE, (4 << 8) | 9, parent);
318 process = tmpThread->process;
319 process->openFile(B(""), B("/dev/tty9"), K_O_WRONLY, fd);
320 if (fd) {
321 tmpThread->log = false;
322 tmpThread->process->dup2(fd->handle, 1); // replace stdout with tty9
323 waitForProcessToFinish(tmpThread->process, tmpThread);
324 }
325 }
326 delete tmpThread;
327 KSystem::eraseProcess(process->id);
328 int pos = tty9Buffer.indexOf("\r\n");
329 if (pos>=0) {
330 return tty9Buffer.substr(0, pos-1);
331 }
332 return tty9Buffer;
333}
334
335void CPU::walkStack(U32 eip, U32 ebp, U32 indent) {
336 U32 moduleEip = this->thread->process->getModuleEip(this->seg[CS].address+eip);

Callers

nothing calls this directly

Calls 10

createFunction · 0.85
BFunction · 0.85
startProcessMethod · 0.80
openFileMethod · 0.80
dup2Method · 0.80
indexOfMethod · 0.80
substrMethod · 0.80
waitForProcessToFinishFunction · 0.50
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected