Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: src/s390/simulator-s390.cc

Issue 1944913002: S390: [sim] Add icount and si <mnemonic> commands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/simulator-s390.cc
diff --git a/src/s390/simulator-s390.cc b/src/s390/simulator-s390.cc
index 983d71d678448874a7a0aaef94eb3ece1649f908..01c96d65e1bcc98ef130ac3472276837dc891cdf 100644
--- a/src/s390/simulator-s390.cc
+++ b/src/s390/simulator-s390.cc
@@ -275,18 +275,40 @@ void S390Debugger::Debug() {
reinterpret_cast<Instruction*>(sim_->get_pc()));
}
- if (argc == 2 && last_pc != sim_->get_pc() && GetValue(arg1, &value)) {
- for (int i = 1; (!sim_->has_bad_pc()) && i < value; i++) {
- disasm::NameConverter converter;
- disasm::Disassembler dasm(converter);
- // use a reasonably large buffer
- v8::internal::EmbeddedVector<char, 256> buffer;
- dasm.InstructionDecode(buffer,
- reinterpret_cast<byte*>(sim_->get_pc()));
- PrintF(" 0x%08" V8PRIxPTR " %s\n", sim_->get_pc(),
- buffer.start());
- sim_->ExecuteInstruction(
- reinterpret_cast<Instruction*>(sim_->get_pc()));
+ if (argc == 2 && last_pc != sim_->get_pc()) {
+ disasm::NameConverter converter;
+ disasm::Disassembler dasm(converter);
+ // use a reasonably large buffer
+ v8::internal::EmbeddedVector<char, 256> buffer;
+
+ if (GetValue(arg1, &value)) {
+ // Interpret a numeric argument as the number of instructions to
+ // step past.
+ for (int i = 1; (!sim_->has_bad_pc()) && i < value; i++) {
+ dasm.InstructionDecode(buffer,
+ reinterpret_cast<byte*>(sim_->get_pc()));
+ PrintF(" 0x%08" V8PRIxPTR " %s\n", sim_->get_pc(),
+ buffer.start());
+ sim_->ExecuteInstruction(
+ reinterpret_cast<Instruction*>(sim_->get_pc()));
+ }
+ } else {
+ // Otherwise treat it as the mnemonic of the opcode to stop at.
+ char mnemonic[256];
+ while (!sim_->has_bad_pc()) {
+ dasm.InstructionDecode(buffer,
+ reinterpret_cast<byte*>(sim_->get_pc()));
+ char* mnemonicStart = buffer.start();
+ while (*mnemonicStart != 0 && *mnemonicStart != ' ')
+ mnemonicStart++;
+ SScanF(mnemonicStart, "%s", mnemonic);
+ if (!strcmp(arg1, mnemonic)) break;
+
+ PrintF(" 0x%08" V8PRIxPTR " %s\n", sim_->get_pc(),
+ buffer.start());
+ sim_->ExecuteInstruction(
+ reinterpret_cast<Instruction*>(sim_->get_pc()));
+ }
}
}
} else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
@@ -575,6 +597,8 @@ void S390Debugger::Debug() {
} else {
PrintF("Wrong usage. Use help command for more information.\n");
}
+ } else if (strcmp(cmd, "icount") == 0) {
+ PrintF("%05d\n", sim_->icount_);
} else if ((strcmp(cmd, "t") == 0) || strcmp(cmd, "trace") == 0) {
::v8::internal::FLAG_trace_sim = !::v8::internal::FLAG_trace_sim;
PrintF("Trace of executed instructions is %s\n",
@@ -5563,6 +5587,8 @@ int Simulator::DecodeInstruction(Instruction* instr) {
// Executes the current instruction.
void Simulator::ExecuteInstruction(Instruction* instr, bool auto_incr_pc) {
+ icount_++;
+
if (v8::internal::FLAG_check_icache) {
CheckICache(isolate_->simulator_i_cache(), instr);
}
@@ -5608,7 +5634,6 @@ void Simulator::Execute() {
// should be stopping at a particular executed instruction.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
- icount_++;
ExecuteInstruction(instr);
program_counter = get_pc();
}
@@ -5617,7 +5642,6 @@ void Simulator::Execute() {
// we reach the particular instuction count.
while (program_counter != end_sim_pc) {
Instruction* instr = reinterpret_cast<Instruction*>(program_counter);
- icount_++;
if (icount_ == ::v8::internal::FLAG_stop_sim_at) {
S390Debugger dbg(this);
dbg.Debug();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698