MCPcopy Create free account
hub / github.com/cemu-project/Cemu / DrawDisassemblyLine

Method DrawDisassemblyLine

src/gui/debugger/DisasmCtrl.cpp:120–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR virtualAddress, RPLModule* rplModule)
121{
122 wxPoint position = linePosition;
123
124 bool hasPatch = debugger_hasPatch(virtualAddress);
125
126 PPCDisassembledInstruction disasmInstr;
127
128 const DebuggerBreakpoint* bp = debugger_getFirstBP(virtualAddress);
129 while (bp)
130 {
131 if (bp->isExecuteBP() && bp->enabled)
132 break;
133 bp = bp->next;
134 }
135
136 uint32 opcode;
137
138 if (bp)
139 opcode = bp->originalOpcodeValue;
140 else
141 opcode = memory_readU32(virtualAddress);
142
143 ppcAssembler_disassemble(virtualAddress, opcode, &disasmInstr);
144
145 const bool is_active_bp = debuggerState.debugSession.isTrapped && debuggerState.debugSession.instructionPointer == virtualAddress;
146
147 // write virtual address
148 wxColour background_colour;
149 if (is_active_bp && bp != nullptr)
150 background_colour = wxColour(0xFFFFA0FF);
151 else if (is_active_bp)
152 background_colour = wxColour(0xFF80A0FF);
153 else if (bp != nullptr)
154 background_colour = wxColour(bp->bpType == DEBUGGER_BP_T_NORMAL ? 0xFF8080FF : 0x80FFFFFF);
155 else if(virtualAddress == m_lastGotoTarget)
156 background_colour = wxColour(0xFFE0E0E0);
157 else
158 background_colour = wxColour(COLOR_WHITE);
159
160 DrawLineBackground(dc, position, background_colour);
161
162 dc.SetTextForeground(COLOR_BLACK);
163 dc.DrawText(wxString::Format("%08x", virtualAddress), position);
164 position.x += OFFSET_ADDRESS;
165
166 dc.SetTextForeground(COLOR_GREY);
167 if (rplModule)
168 dc.DrawText(wxString::Format("+0x%-8x", virtualAddress - rplModule->regionMappingBase_text.GetMPTR()), position);
169 else
170 dc.DrawText("???", position);
171
172 position.x += OFFSET_ADDRESS_RELATIVE;
173
174 // draw arrow to clearly indicate instruction pointer
175 if(is_active_bp)
176 dc.DrawBitmap(*g_ipArrowBitmap, wxPoint(position.x - 24, position.y + 2), false);
177

Callers

nothing calls this directly

Calls 15

debugger_hasPatchFunction · 0.85
debugger_getFirstBPFunction · 0.85
memory_readU32Function · 0.85
ppcAssembler_disassembleFunction · 0.85
formatFunction · 0.85
memory_readFloatFunction · 0.85
wxStringClass · 0.85

Tested by

no test coverage detected