Commit 4de60919 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>

	Hide the text section loaded in virtual machine's memory.

	* src/vm/mmu.hh (inst_has_label, inst_get_offset): Remove.
	* src/vm/virtual_machine.hh (has_label, get_offset): Remove.
	(add_breakpoint) Wait for an offset instead of a label.
	* src/vm/virtual_machine.cc: Update accordingly, move label
	translation into...
	* src/shell/shell.cc (do_break): ...this method.
parent c7f88dcb
2005-01-23 Benot Perrot <benoit@lrde.epita.fr>
Hide the text section loaded in virtual machine's memory.
* src/vm/mmu.hh (inst_has_label, inst_get_offset): Remove.
* src/vm/virtual_machine.hh (has_label, get_offset): Remove.
(add_breakpoint) Wait for an offset instead of a label.
* src/vm/virtual_machine.cc: Update accordingly, move label
translation into...
* src/shell/shell.cc (do_break): ...this method.
2005-01-23 Benot Perrot <benoit@lrde.epita.fr>
Introduce some (weak) reentrancy into lexer.
......
......@@ -376,14 +376,20 @@ namespace shell
Shell::do_break(const Cmd &cmd)
{
if (!program_)
{
std::cerr << "No program loaded." << std::endl;
return;
}
else
if (!program_->text_section().has_label(*cmd.get_args().begin()))
std::cerr << "Label " << *cmd.get_args().begin()
<< " not found." << std::endl;
else
{
int offset =
program_->text_section().get_offset(*cmd.get_args().begin());
//std::cerr <<"#DEBUG: label = " << *label << std::endl;
// sh_.vm_.add_break(*label);
vm_.add_breakpoint(*cmd.get_args().begin());
std::cout << "Breakpoint " << *cmd.get_args().begin()
<< " at " << offset << " (+4)." << std::endl;
vm_.add_breakpoint(offset + 4);
}
}
void
......
......@@ -143,15 +143,6 @@ namespace vm
return (*text_section_)[offset];
}
int inst_has_label(const std::string &label) const
{
return text_section_->has_label(inst::Label(label));
}
int inst_get_offset(const std::string &label) const
{
return text_section_->get_offset(inst::Label(label));
}
/** \} */
protected:
......
......@@ -95,19 +95,9 @@ namespace vm
}
void
VirtualMachine::add_breakpoint(const std::string& label)
VirtualMachine::add_breakpoint(int offset)
{
int offset;
if (!has_label(label))
{
std::cerr << "Label " << label << " not found" << std::endl;
return;
}
offset = get_offset(label);
std::cout << "Breakpoint " << label
<< " at " << offset << " (+4)" << std::endl;
assertion(0 < offset /* && (offset / 4) <= text_section.size() */);
breakpoints_.push_back(offset + 4);
}
......
......@@ -95,25 +95,12 @@ namespace vm
/** \name Shell entry point
\{ */
protected:
/// Check if a label exists
bool has_label(const std::string& label) const
{
return mmu_.inst_has_label(label);
}
/// Return the offset of a label
int get_offset(const std::string& label) const
{
return mmu_.inst_get_offset(label);
}
public:
/// Execute a program
void execute(bool trace_p);
/// Add a breakpoint
void add_breakpoint(const std::string& label);
void add_breakpoint(int offset);
/// Return CPU's call stack
const std::vector<register_type> & get_call_stack() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment