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

Method DisassemblyStringFromAddress

pcsx2-qt/Debugger/DisassemblyView.cpp:874–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872}
873
874inline QString DisassemblyView::DisassemblyStringFromAddress(u32 address, QFont font, u32 pc, bool selected)
875{
876 DisassemblyLineInfo line;
877
878 if (!cpu().isValidAddress(address))
879 return tr("%1 NOT VALID ADDRESS").arg(address, 8, 16, QChar('0')).toUpper();
880 // Todo? support non symbol view?
881 m_disassemblyManager.getLine(address, true, line);
882
883 const bool isConditional = line.info.isConditional && cpu().getPC() == address;
884 const bool isConditionalMet = line.info.conditionMet;
885 const bool isCurrentPC = cpu().getPC() == address;
886
887 FunctionInfo function = cpu().GetSymbolGuardian().FunctionStartingAtAddress(address);
888 SymbolInfo symbol = cpu().GetSymbolGuardian().SymbolStartingAtAddress(address);
889 const bool showOpcode = m_showInstructionBytes && cpu().isAlive();
890
891 QString lineString;
892 if (showOpcode)
893 {
894 lineString = QString(" %1 %2 %3 %4 %5 %6 %7");
895 }
896 else
897 {
898 lineString = QString(" %1 %2 %3 %4 %5 %6");
899 }
900
901 if (function.is_no_return)
902 {
903 lineString = lineString.arg("NR");
904 }
905 else
906 {
907 lineString = lineString.arg(" ");
908 }
909
910 if (symbol.name.empty())
911 lineString = lineString.arg(address, 8, 16, QChar('0')).toUpper();
912 else
913 {
914 QFontMetrics metric(font);
915 QString symbolString = QString::fromStdString(symbol.name);
916
917 lineString = lineString.arg(metric.elidedText(symbolString, Qt::ElideRight, (selected ? 32 : 7) * font.pointSize()));
918 }
919
920 if (showOpcode)
921 {
922 const u32 opcode = cpu().Read32(address);
923 lineString = lineString.arg(QtUtils::FilledQStringFromValue(opcode, 16));
924 }
925
926 lineString = lineString.leftJustified(4, ' ') // Address / symbol
927 .arg(line.name.c_str())
928 .arg(line.params.c_str()) // opcode + arguments
929 .arg(isConditional ? (isConditionalMet ? "# true" : "# false") : "")
930 .arg(isCurrentPC ? "<--" : "");
931

Callers

nothing calls this directly

Calls 11

FilledQStringFromValueFunction · 0.85
isValidAddressMethod · 0.80
argMethod · 0.80
getLineMethod · 0.80
getPCMethod · 0.80
isAliveMethod · 0.80
emptyMethod · 0.45
Read32Method · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected