Debugger fixes for PDM.

This commit is contained in:
Maxim Poliakovski 2021-09-26 14:21:31 +02:00
parent f104a634ea
commit e9fcc51b93
2 changed files with 16 additions and 11 deletions

View File

@ -23,14 +23,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <loguru.hpp>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <loguru.hpp>
#include "../cpu/ppc/ppcdisasm.h" #include "../cpu/ppc/ppcdisasm.h"
#include "../cpu/ppc/ppcemu.h" #include "../cpu/ppc/ppcemu.h"
#include "../cpu/ppc/ppcmmu.h" #include "../cpu/ppc/ppcmmu.h"
#include "memaccess.h"
#include "utils/profiler.h" #include "utils/profiler.h"
#ifdef ENABLE_68K_DEBUGGER // optionally defined in CMakeLists.txt #ifdef ENABLE_68K_DEBUGGER // optionally defined in CMakeLists.txt
@ -330,7 +331,7 @@ static void disasm(uint32_t count, uint32_t address) {
ctx.simplified = true; ctx.simplified = true;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
ctx.instr_code = mem_read_dbg(ctx.instr_addr, 4); ctx.instr_code = READ_DWORD_BE_A(mmu_translate_imem(ctx.instr_addr));
cout << uppercase << hex << ctx.instr_addr; cout << uppercase << hex << ctx.instr_addr;
cout << " " << disassemble_single(&ctx) << endl; cout << " " << disassemble_single(&ctx) << endl;
} }
@ -541,16 +542,20 @@ void enter_debugger() {
} }
} else { } else {
/* disas without arguments defaults to disas 1,pc */ /* disas without arguments defaults to disas 1,pc */
if (context == 2) { try {
if (context == 2) {
#ifdef ENABLE_68K_DEBUGGER #ifdef ENABLE_68K_DEBUGGER
addr_str = "R24"; addr_str = "R24";
addr = get_reg(addr_str); addr = get_reg(addr_str);
disasm_68k(1, addr - 2); disasm_68k(1, addr - 2);
#endif #endif
} else { } else {
addr_str = "PC"; addr_str = "PC";
addr = get_reg(addr_str); addr = get_reg(addr_str);
disasm(1, addr); disasm(1, addr);
}
} catch (invalid_argument& exc) {
cout << exc.what() << endl;
} }
} }
} else if (cmd == "dump") { } else if (cmd == "dump") {

View File

@ -99,7 +99,7 @@ bool MemCtrlBase::add_mem_mirror(uint32_t start_addr, uint32_t dest_addr) {
entry = new AddressMapEntry; entry = new AddressMapEntry;
entry->start = start_addr; entry->start = start_addr;
entry->end = start_addr + (ref_entry->end - ref_entry->start) + 1; entry->end = start_addr + (ref_entry->end - ref_entry->start);
entry->mirror = dest_addr; entry->mirror = dest_addr;
entry->type = ref_entry->type | RT_MIRROR; entry->type = ref_entry->type | RT_MIRROR;
entry->devobj = 0; entry->devobj = 0;