debugger: fix ofnvram commands for Nubus machines.

This commit is contained in:
Maxim Poliakovski 2022-07-18 20:20:55 +02:00
parent c0078ce97d
commit b8915f11a2
3 changed files with 7 additions and 3 deletions

View File

@ -377,7 +377,6 @@ void enter_debugger() {
size_t separator_pos;
unique_ptr<OfNvramUtils> ofnvram = unique_ptr<OfNvramUtils>(new OfNvramUtils);
ofnvram->init();
context = 1; /* start with the PowerPC context */
@ -578,11 +577,15 @@ void enter_debugger() {
}
#endif
} else if (cmd == "printenv") {
if (ofnvram->init())
continue;
ofnvram->printenv();
} else if (cmd == "setenv") {
string var_name, value;
ss >> var_name;
ss >> value;
if (ofnvram->init())
continue;
ofnvram->setenv(var_name, value);
} else {
cout << "Unknown command: " << cmd << endl;

View File

@ -37,9 +37,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
using namespace std;
void OfNvramUtils::init()
int OfNvramUtils::init()
{
this->nvram_obj = dynamic_cast<NVram*>(gMachineObj->get_comp_by_name("NVRAM"));
return this->nvram_obj == nullptr;
}
bool OfNvramUtils::validate()

View File

@ -49,7 +49,7 @@ public:
OfNvramUtils() = default;
~OfNvramUtils() = default;
void init();
int init();
void printenv();
void setenv(std::string var_name, std::string value);