MCPcopy Create free account
hub / github.com/Vector35/debugger / updateContent

Method updateContent

ui/stackwidget.cpp:430–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428
429
430void DebugStackWidget::updateContent()
431{
432 if (!m_controller->IsConnected())
433 return;
434
435 if (!m_controller->GetLiveView())
436 return;
437
438 std::vector<DebugStackItem> stackItems;
439 BinaryReader* reader = new BinaryReader(m_controller->GetLiveView());
440 uint64_t stackPointer = m_controller->StackPointer();
441 size_t addressSize = m_controller->GetRemoteArchitecture()->GetAddressSize();
442 for (ptrdiff_t i = -8; i < 60 + 1; i++)
443 {
444 ptrdiff_t offset = i * addressSize;
445 if ((offset < 0) && (stackPointer < (uint64_t)-offset))
446 continue;
447
448 uint64_t address = stackPointer + offset;
449
450 reader->Seek(address);
451
452 uint64_t value = -1ULL;
453
454 try
455 {
456 switch (addressSize)
457 {
458 case 1:
459 value = reader->Read8();
460 break;
461 case 2:
462 value = reader->Read16();
463 break;
464 case 4:
465 value = reader->Read32();
466 break;
467 case 8:
468 value = reader->Read64();
469 break;
470 default:
471 break;
472 }
473 }
474 catch (const std::exception&)
475 {
476 /* TODO: just ignoring this is probably not a great idea... */
477 }
478
479 std::string hint {};
480 if (m_controller)
481 {
482 const DataBuffer memory = m_controller->ReadMemory(value, 128);
483 std::string reg_string;
484 if (memory.GetLength() > 0)
485 reg_string = std::string((const char*)memory.GetData(), memory.GetLength());
486 else
487 reg_string = "x";

Callers

nothing calls this directly

Calls 7

sizeMethod · 0.80
IsConnectedMethod · 0.45
GetLiveViewMethod · 0.45
StackPointerMethod · 0.45
GetRemoteArchitectureMethod · 0.45
ReadMemoryMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected