debugger: add regions command.

To dump the list of memory regions.
This commit is contained in:
joevt
2024-03-09 02:27:40 -08:00
committed by dingusdev
parent 8aede43f91
commit cf0d78fe98
3 changed files with 17 additions and 0 deletions
+5
View File
@@ -89,6 +89,7 @@ static void show_help() {
cout << " setmem X=V.T -- set memory at address X to value V of size T" << endl;
cout << " T can be b(byte), w(word), d(double)," << endl;
cout << " q(quad) or c(character)." << endl;
cout << " regions -- dump memory regions" << endl;
cout << " profile C N -- run subcommand C on profile N" << endl;
cout << " supported subcommands:" << endl;
cout << " 'show' - show profile report" << endl;
@@ -881,6 +882,10 @@ void DppcDebugger::enter_debugger() {
cout << "Unknown debugging context: " << expr_str << endl;
}
#endif
} else if (cmd == "regions") {
cmd = "";
if (mem_ctrl_instance)
mem_ctrl_instance->dump_regions();
} else if (cmd == "printenv") {
cmd = "";
if (ofnvram->init())
+10
View File
@@ -372,3 +372,13 @@ uint8_t *MemCtrlBase::get_region_hostmem_ptr(const uint32_t addr) {
else
return (addr - reg_desc->start) + reg_desc->mem_ptr;
}
void MemCtrlBase::dump_regions()
{
int i = 0;
for (auto& entry : address_map) {
printf("%2d: %s\n", i, get_entry_str(entry).c_str());
i++;
}
}
+2
View File
@@ -88,6 +88,8 @@ public:
uint8_t *get_region_hostmem_ptr(const uint32_t addr);
void dump_regions();
protected:
bool add_mem_region(
uint32_t start_addr, uint32_t size, uint32_t dest_addr, uint32_t type,