Skip to content

Commit ae60515

Browse files
joevtdingusdev
authored andcommitted
debugger: Add fregs command.
1 parent a9e0cd5 commit ae60515

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

cpu/ppc/ppcemu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ extern PPCOpcode* ppc_opcode_grabber;
652652
extern void ppc_msr_did_change(uint32_t old_msr_val, uint32_t new_msr_val, bool set_next_instruction_address = true);
653653

654654
/* debugging support API */
655-
void print_fprs(void); /* print content of the floating-point registers */
656655
uint64_t get_reg(std::string reg_name); /* get content of the register reg_name */
657656
void set_reg(std::string reg_name, uint64_t val); /* set reg_name to val */
658657

cpu/ppc/ppcexec.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,6 @@ void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool do_include_6
871871
#endif
872872
}
873873

874-
void print_fprs() {
875-
for (int i = 0; i < 32; i++)
876-
cout << "FPR " << dec << i << " : " << ppc_state.fpr[i].dbl64_r << endl;
877-
}
878-
879874
static map<string, int> SPRName2Num = {
880875
{"XER", SPR::XER}, {"LR", SPR::LR}, {"CTR", SPR::CTR},
881876
{"DEC", SPR::DEC_S}, {"PVR", SPR::PVR}, {"SPRG0", SPR::SPRG0},

debugger/debugger.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static void show_help() {
7878
cout << " until X -- execute until address X is reached" << endl;
7979
cout << " go -- exit debugger and continue emulator execution" << endl;
8080
cout << " regs -- dump content of the GRPs" << endl;
81+
cout << " fregs -- dump content of the FPRs" << endl;
8182
cout << " mregs -- dump content of the MMU registers" << endl;
8283
cout << " set R=X -- assign value X to register R" << endl;
8384
cout << " if R=loglevel, set the internal" << endl;
@@ -381,6 +382,18 @@ static void print_gprs() {
381382
}
382383
}
383384

385+
static void print_fprs() {
386+
string reg_name;
387+
for (int i = 0; i < 32; i++) {
388+
reg_name = "f" + to_string(i);
389+
cout << right << std::setw(6) << setfill(' ') << reg_name << " : " <<
390+
setw(16) << setfill('0') << right << uppercase << hex << ppc_state.fpr[i].int64_r <<
391+
" = " << left << setfill(' ') << ppc_state.fpr[i].dbl64_r << endl;
392+
}
393+
cout << right << std::setw(6) << setfill(' ') << "fpscr" << " : " <<
394+
setw(8) << setfill('0') << uppercase << hex << ppc_state.fpscr << setfill(' ') << endl;
395+
}
396+
384397
extern bool is_601;
385398

386399
static void print_mmu_regs()
@@ -590,6 +603,9 @@ void DppcDebugger::enter_debugger() {
590603
} else {
591604
print_gprs();
592605
}
606+
} else if (cmd == "fregs") {
607+
cmd = "";
608+
print_fprs();
593609
} else if (cmd == "mregs") {
594610
cmd = "";
595611
print_mmu_regs();

0 commit comments

Comments
 (0)