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

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

Issue 191004: Fix the debugger in the ARM simulator (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/arm/simulator-arm.cc
===================================================================
--- src/arm/simulator-arm.cc (revision 2814)
+++ src/arm/simulator-arm.cc (working copy)
@@ -70,7 +70,7 @@
Simulator* sim_;
- bool GetValue(char* desc, int32_t* value);
+ bool GetValue(const char* desc, int32_t* value);
// Set or delete a breakpoint. Returns true if successful.
bool SetBreakpoint(Instr* breakpc);
@@ -132,6 +132,8 @@
#endif
+// The order of these are important, see the handling of the 'print all'
+// debugger command.
static const char* reg_names[] = { "r0", "r1", "r2", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
@@ -147,7 +149,7 @@
11, 10};
-static int RegNameToRegNum(char* name) {
+static int RegNameToRegNum(const char* name) {
int reg = 0;
while (*reg_names[reg] != 0) {
if (strcmp(reg_names[reg], name) == 0) {
@@ -159,7 +161,7 @@
}
-bool Debugger::GetValue(char* desc, int32_t* value) {
+bool Debugger::GetValue(const char* desc, int32_t* value) {
int regnum = RegNameToRegNum(desc);
if (regnum >= 0) {
if (regnum == 15) {
@@ -270,13 +272,25 @@
} else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
if (args == 2) {
int32_t value;
- if (GetValue(arg1, &value)) {
- PrintF("%s: %d 0x%x\n", arg1, value, value);
+ if (strcmp(arg1, "all") == 0) {
+ for (int i = 0; i <= 15; i++) {
iposva 2009/09/04 05:30:24 Please use named constants here.
+ if (GetValue(reg_names[i], &value)) {
+ if (i <= 10) {
iposva 2009/09/04 05:30:24 and here.
+ PrintF("%s: 08x%x %d\n", reg_names[i], value, value);
+ } else {
+ PrintF("%s: 08x%x %d\n", reg_names[15 + 16 - i], value, value);
iposva 2009/09/04 05:30:24 and here. Better yet, abstract the register to na
+ }
+ }
+ }
} else {
- PrintF("%s unrecognized\n", arg1);
+ if (GetValue(arg1, &value)) {
+ PrintF("%s: 08x%x %d \n", arg1, value, value);
+ } else {
+ PrintF("%s unrecognized\n", arg1);
+ }
}
} else {
- PrintF("print value\n");
+ PrintF("print <register>\n");
}
} else if ((strcmp(cmd, "po") == 0)
|| (strcmp(cmd, "printobject") == 0)) {
@@ -286,14 +300,17 @@
Object* obj = reinterpret_cast<Object*>(value);
USE(obj);
iposva 2009/09/04 05:30:24 This USE can be dropped now, that obj is used in D
PrintF("%s: \n", arg1);
-#if defined(DEBUG)
+#ifdef DEBUG
obj->PrintLn();
-#endif // defined(DEBUG)
+#else
+ obj->ShortPrint();
+ PrintF("\n");
+#endif
} else {
PrintF("%s unrecognized\n", arg1);
}
} else {
- PrintF("printobject value\n");
+ PrintF("printobject <value>\n");
}
} else if (strcmp(cmd, "disasm") == 0) {
disasm::NameConverter converter;
@@ -343,7 +360,7 @@
PrintF("%s unrecognized\n", arg1);
}
} else {
- PrintF("break addr\n");
+ PrintF("break <address>\n");
}
} else if (strcmp(cmd, "del") == 0) {
if (!DeleteBreakpoint(NULL)) {
@@ -362,6 +379,15 @@
} else {
PrintF("Not at debugger stop.");
}
+ } else if ((strcmp(cmd, "h") == 0) || (strcmp(cmd, "help") == 0)) {
+ PrintF("print <register>\n");
Erik Corry 2009/09/02 14:22:44 It would be nice to include si/stepi and c/cont as
Søren Thygesen Gjesse 2009/09/02 14:47:19 Added missing commands and description and alias a
+ PrintF("printobject <register>\n");
+ PrintF("flags\n");
+ PrintF("disasm <value>\n");
+ PrintF("gdb\n");
+ PrintF("break <address>\n");
+ PrintF("del\n");
+ PrintF("unstop\n");
} else {
PrintF("Unknown command: %s\n", cmd);
}
@@ -1726,7 +1752,8 @@
uint16_t halfword = ReadH(addr, instr);
set_register(rd, halfword);
} else {
- UNIMPLEMENTED();
+ Debugger dbg(this);
+ dbg.Stop(instr);
}
}
« 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