debugger_cmds.cc Source File

Back to the index.

debugger_cmds.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2018 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * Debugger commands. Included from debugger.c.
29  */
30 
31 
32 /*
33  * debugger_cmd_allsettings():
34  */
35 static void debugger_cmd_allsettings(struct machine *m, char *cmd_line)
36 {
38 }
39 
40 
41 /*
42  * debugger_cmd_breakpoint():
43  *
44  * TODO: automagic "expansion" for the subcommand names (s => show).
45  */
46 static void debugger_cmd_breakpoint(struct machine *m, char *cmd_line)
47 {
48  int i, res;
49 
50  while (cmd_line[0] != '\0' && cmd_line[0] == ' ')
51  cmd_line ++;
52 
53  if (cmd_line[0] == '\0') {
54  printf("syntax: breakpoint subcmd [args...]\n");
55  printf("Available subcmds (and args) are:\n");
56  printf(" add addr add a breakpoint for address addr\n");
57  printf(" delete x delete breakpoint nr x\n");
58  printf(" show show current breakpoints\n");
59  return;
60  }
61 
62  if (strcmp(cmd_line, "show") == 0) {
63  if (m->breakpoints.n == 0)
64  printf("No breakpoints set.\n");
65  for (i=0; i<m->breakpoints.n; i++)
66  show_breakpoint(m, i);
67  return;
68  }
69 
70  if (strncmp(cmd_line, "delete ", 7) == 0) {
71  int x = atoi(cmd_line + 7);
72 
73  if (m->breakpoints.n == 0) {
74  printf("No breakpoints set.\n");
75  return;
76  }
77  if (x < 0 || x > m->breakpoints.n) {
78  printf("Invalid breakpoint nr %i. Use 'breakpoint "
79  "show' to see the current breakpoints.\n", x);
80  return;
81  }
82 
83  free(m->breakpoints.string[x]);
84 
85  for (i=x; i<m->breakpoints.n-1; i++) {
86  m->breakpoints.addr[i] = m->breakpoints.addr[i+1];
87  m->breakpoints.string[i] = m->breakpoints.string[i+1];
88  }
89  m->breakpoints.n --;
90 
91  /* Clear translations: */
92  for (i=0; i<m->ncpus; i++)
93  if (m->cpus[i]->translation_cache != NULL)
95  return;
96  }
97 
98  if (strncmp(cmd_line, "add ", 4) == 0) {
99  uint64_t tmp;
100  size_t breakpoint_buf_len;
101 
102  i = m->breakpoints.n;
103 
104  res = debugger_parse_expression(m, cmd_line + 4, 0, &tmp);
105  if (!res) {
106  printf("Couldn't parse '%s'\n", cmd_line + 4);
107  return;
108  }
109 
110  CHECK_ALLOCATION(m->breakpoints.string = (char **) realloc(
111  m->breakpoints.string, sizeof(char *) *
112  (m->breakpoints.n + 1)));
113  CHECK_ALLOCATION(m->breakpoints.addr = (uint64_t *) realloc(
114  m->breakpoints.addr, sizeof(uint64_t) *
115  (m->breakpoints.n + 1)));
116 
117  breakpoint_buf_len = strlen(cmd_line+4) + 1;
118 
119  CHECK_ALLOCATION(m->breakpoints.string[i] = (char *)
120  malloc(breakpoint_buf_len));
121  strlcpy(m->breakpoints.string[i], cmd_line+4,
122  breakpoint_buf_len);
123  m->breakpoints.addr[i] = tmp;
124 
125  m->breakpoints.n ++;
126  show_breakpoint(m, i);
127 
128  /* Clear translations: */
129  for (i=0; i<m->ncpus; i++)
130  if (m->cpus[i]->translation_cache != NULL)
132  return;
133  }
134 
135  printf("Unknown breakpoint subcommand.\n");
136 }
137 
138 
139 /*
140  * debugger_cmd_continue():
141  */
142 static void debugger_cmd_continue(struct machine *m, char *cmd_line)
143 {
144  if (*cmd_line) {
145  printf("syntax: continue\n");
146  return;
147  }
148 
149  exit_debugger = 1;
150 }
151 
152 
153 /*
154  * debugger_cmd_device():
155  */
156 static void debugger_cmd_device(struct machine *m, char *cmd_line)
157 {
158  int i;
159  struct memory *mem;
160  struct cpu *c;
161 
162  if (cmd_line[0] == '\0')
163  goto return_help;
164 
165  if (m->cpus == NULL) {
166  printf("No cpus (?)\n");
167  return;
168  }
169  c = m->cpus[m->bootstrap_cpu];
170  if (c == NULL) {
171  printf("m->cpus[m->bootstrap_cpu] = NULL\n");
172  return;
173  }
174  mem = m->cpus[m->bootstrap_cpu]->mem;
175 
176  if (m->cpus == NULL) {
177  printf("No cpus (?)\n");
178  return;
179  }
180  c = m->cpus[m->bootstrap_cpu];
181  if (c == NULL) {
182  printf("m->cpus[m->bootstrap_cpu] = NULL\n");
183  return;
184  }
185  mem = m->cpus[m->bootstrap_cpu]->mem;
186 
187  if (strcmp(cmd_line, "all") == 0) {
188  device_dumplist();
189  } else if (strncmp(cmd_line, "add ", 4) == 0) {
190  device_add(m, cmd_line+4);
191  } else if (strcmp(cmd_line, "consoles") == 0) {
193  } else if (strncmp(cmd_line, "remove ", 7) == 0) {
194  i = atoi(cmd_line + 7);
195  if (i==0 && cmd_line[7]!='0') {
196  printf("Weird device number. Use 'device list'.\n");
197  } else
199  } else if (strcmp(cmd_line, "list") == 0) {
200  if (mem->n_mmapped_devices == 0)
201  printf("No memory-mapped devices in this machine.\n");
202 
203  for (i=0; i<mem->n_mmapped_devices; i++) {
204  printf("%2i: %25s @ 0x%011" PRIx64", len = 0x%" PRIx64,
205  i, mem->devices[i].name,
206  (uint64_t) mem->devices[i].baseaddr,
207  (uint64_t) mem->devices[i].length);
208 
209  if (mem->devices[i].flags) {
210  printf(" (");
211  if (mem->devices[i].flags & DM_DYNTRANS_OK)
212  printf("DYNTRANS R");
214  printf("+W");
215  printf(")");
216  }
217  printf("\n");
218  }
219  } else
220  goto return_help;
221 
222  return;
223 
224 return_help:
225  printf("syntax: devices cmd [...]\n");
226  printf("Available cmds are:\n");
227  printf(" add name_and_params add a device to the current "
228  "machine\n");
229  printf(" all list all registered devices\n");
230  printf(" consoles list all slave consoles\n");
231  printf(" list list memory-mapped devices in the"
232  " current machine\n");
233  printf(" remove x remove device nr x from the "
234  "current machine\n");
235 }
236 
237 
238 /*
239  * debugger_cmd_dump():
240  *
241  * Dump emulated memory in hex and ASCII.
242  *
243  * syntax: dump [addr [endaddr]]
244  */
245 static void debugger_cmd_dump(struct machine *m, char *cmd_line)
246 {
247  uint64_t addr, addr_start, addr_end;
248  struct cpu *c;
249  struct memory *mem;
250  char *p = NULL;
251  int x, r;
252 
253  if (cmd_line[0] != '\0') {
254  uint64_t tmp;
255  char *tmps;
256 
257  CHECK_ALLOCATION(tmps = strdup(cmd_line));
258 
259  /* addr: */
260  p = strchr(tmps, ' ');
261  if (p != NULL)
262  *p = '\0';
263  r = debugger_parse_expression(m, tmps, 0, &tmp);
264  free(tmps);
265 
266  if (r == PARSE_NOMATCH || r == PARSE_MULTIPLE) {
267  printf("Unparsable address: %s\n", cmd_line);
268  return;
269  } else {
270  last_dump_addr = tmp;
271  }
272 
273  p = strchr(cmd_line, ' ');
274  }
275 
276  if (m->cpus == NULL) {
277  printf("No cpus (?)\n");
278  return;
279  }
280  c = m->cpus[m->bootstrap_cpu];
281  if (c == NULL) {
282  printf("m->cpus[m->bootstrap_cpu] = NULL\n");
283  return;
284  }
285  mem = m->cpus[m->bootstrap_cpu]->mem;
286 
287  addr_start = last_dump_addr;
288 
289  if (addr_start == MAGIC_UNTOUCHED)
290  addr_start = c->pc;
291 
292  addr_end = addr_start + 16 * 16;
293 
294  /* endaddr: */
295  if (p != NULL) {
296  while (*p == ' ' && *p)
297  p++;
298  r = debugger_parse_expression(m, p, 0, &addr_end);
299  if (r == PARSE_NOMATCH || r == PARSE_MULTIPLE) {
300  printf("Unparsable address: %s\n", cmd_line);
301  return;
302  }
303  }
304 
305  addr = addr_start & ~0xf;
306 
307  ctrl_c = 0;
308 
309  while (addr < addr_end) {
310  unsigned char buf[16];
311  memset(buf, 0, sizeof(buf));
312  r = c->memory_rw(c, mem, addr, &buf[0], sizeof(buf),
314 
315  if (c->is_32bit)
316  printf("0x%08" PRIx32" ", (uint32_t) addr);
317  else
318  printf("0x%016" PRIx64" ", (uint64_t) addr);
319 
320  if (r == MEMORY_ACCESS_FAILED)
321  printf("(memory access failed)\n");
322  else {
323  for (x=0; x<16; x++) {
324  if (addr + x >= addr_start &&
325  addr + x < addr_end)
326  printf("%02x%s", buf[x],
327  (x&3)==3? " " : "");
328  else
329  printf(" %s", (x&3)==3? " " : "");
330  }
331  printf(" ");
332  for (x=0; x<16; x++) {
333  if (addr + x >= addr_start &&
334  addr + x < addr_end)
335  printf("%c", (buf[x]>=' ' &&
336  buf[x]<127)? buf[x] : '.');
337  else
338  printf(" ");
339  }
340  printf("\n");
341  }
342 
343  if (ctrl_c)
344  return;
345 
346  addr += sizeof(buf);
347  }
348 
349  last_dump_addr = addr_end;
350 
351  strlcpy(repeat_cmd, "dump", MAX_CMD_BUFLEN);
352 }
353 
354 
355 /*
356  * debugger_cmd_emul():
357  *
358  * Dump info about the current emulation.
359  */
360 static void debugger_cmd_emul(struct machine *m, char *cmd_line)
361 {
362  int iadd = DEBUG_INDENTATION;
363 
364  if (*cmd_line) {
365  printf("syntax: emul\n");
366  return;
367  }
368 
369  debug("emulation \"%s\":\n", debugger_emul->name == NULL?
370  "(simple setup)" : debugger_emul->name);
371 
372  debug_indentation(iadd);
373  emul_dumpinfo(debugger_emul);
374  debug_indentation(-iadd);
375 }
376 
377 
378 /*
379  * debugger_cmd_focus():
380  *
381  * Changes focus to specific cpu, in a specific machine (in a specific
382  * emulation).
383  */
384 static void debugger_cmd_focus(struct machine *m, char *cmd_line)
385 {
386  int x = -1, y = -1;
387  char *p, *p2;
388 
389  if (!cmd_line[0]) {
390  printf("syntax: focus x[,y]\n");
391  printf("where x (cpu id) and y (machine number) "
392  "are integers as\nreported by the 'emul'"
393  " command.\n");
394  goto print_current_focus_and_return;
395  }
396 
397  x = atoi(cmd_line);
398  p = strchr(cmd_line, ',');
399  if (p == cmd_line) {
400  printf("No cpu number specified?\n");
401  return;
402  }
403 
404  if (p != NULL) {
405  y = atoi(p+1);
406  p2 = strchr(p+1, ',');
407  if (p2 == p+1) {
408  printf("No machine number specified?\n");
409  return;
410  }
411  }
412 
413  if (y != -1) {
414  /* Change machine: */
415  if (y < 0 || y >= debugger_emul->n_machines) {
416  printf("Invalid machine number: %i\n", y);
417  return;
418  }
419 
421  debugger_machine = debugger_emul->machines[y];
422  }
423 
424  /* Change cpu: */
425  if (x < 0 || x >= debugger_machine->ncpus) {
426  printf("Invalid cpu number: %i\n", x);
427  return;
428  }
429 
430  debugger_cur_cpu = x;
431 
432 print_current_focus_and_return:
433  if (debugger_emul->n_machines > 1)
434  printf("current machine (%i): \"%s\"\n",
435  debugger_cur_machine, debugger_machine->name == NULL?
436  "(no name)" : debugger_machine->name);
437 
438  printf("current cpu (%i)\n", debugger_cur_cpu);
439 }
440 
441 
442 /* This is defined below. */
443 static void debugger_cmd_help(struct machine *m, char *cmd_line);
444 
445 
446 /*
447  * debugger_cmd_itrace():
448  */
449 static void debugger_cmd_itrace(struct machine *m, char *cmd_line)
450 {
451  if (*cmd_line) {
452  printf("syntax: itrace\n");
453  return;
454  }
455 
457  printf("instruction_trace = %s\n", old_instruction_trace? "ON":"OFF");
458  /* TODO: how to preserve quiet_mode? */
459  old_quiet_mode = 0;
460  printf("quiet_mode = %s\n", old_quiet_mode? "ON" : "OFF");
461 }
462 
463 
464 /*
465  * debugger_cmd_lookup():
466  */
467 static void debugger_cmd_lookup(struct machine *m, char *cmd_line)
468 {
469  uint64_t addr;
470  int res;
471  char *symbol;
472  uint64_t offset;
473 
474  if (cmd_line[0] == '\0') {
475  printf("syntax: lookup name|addr\n");
476  return;
477 
478  }
479 
480  /* Addresses never need to be given in decimal form anyway,
481  so assuming hex here will be ok. */
482  addr = strtoull(cmd_line, NULL, 16);
483 
484  if (addr == 0) {
485  uint64_t newaddr;
487  cmd_line, &newaddr);
488  if (!res) {
489  printf("lookup for '%s' failed\n", cmd_line);
490  return;
491  }
492  printf("%s = 0x", cmd_line);
493  if (m->cpus[0]->is_32bit)
494  printf("%08" PRIx32"\n", (uint32_t) newaddr);
495  else
496  printf("%016" PRIx64"\n", (uint64_t) newaddr);
497  return;
498  }
499 
500  symbol = get_symbol_name(&m->symbol_context, addr, &offset);
501 
502  if (symbol != NULL) {
503  if (m->cpus[0]->is_32bit)
504  printf("0x%08" PRIx32, (uint32_t) addr);
505  else
506  printf("0x%016" PRIx64, (uint64_t) addr);
507  printf(" = %s\n", symbol);
508  } else
509  printf("lookup for '%s' failed\n", cmd_line);
510 }
511 
512 
513 /*
514  * debugger_cmd_machine():
515  *
516  * Dump info about the currently focused machine.
517  */
518 static void debugger_cmd_machine(struct machine *m, char *cmd_line)
519 {
520  int iadd = 0;
521 
522  if (*cmd_line) {
523  printf("syntax: machine\n");
524  return;
525  }
526 
527  if (m->name != NULL) {
528  debug("machine \"%s\":\n", m->name);
529  iadd = DEBUG_INDENTATION;
530  }
531 
532  debug_indentation(iadd);
533  machine_dumpinfo(m);
534  debug_indentation(-iadd);
535 }
536 
537 
538 /*
539  * debugger_cmd_ninstrs():
540  */
541 static void debugger_cmd_ninstrs(struct machine *m, char *cmd_line)
542 {
543  int toggle = 1;
544  int previous_mode = m->show_nr_of_instructions;
545 
546  if (cmd_line[0] != '\0') {
547  while (cmd_line[0] != '\0' && cmd_line[0] == ' ')
548  cmd_line ++;
549  switch (cmd_line[0]) {
550  case '0':
551  toggle = 0;
553  break;
554  case '1':
555  toggle = 0;
557  break;
558  case 'o':
559  case 'O':
560  toggle = 0;
561  switch (cmd_line[1]) {
562  case 'n':
563  case 'N':
565  break;
566  default:
568  }
569  break;
570  default:
571  printf("syntax: trace [on|off]\n");
572  return;
573  }
574  }
575 
576  if (toggle)
578 
579  printf("show_nr_of_instructions = %s",
580  m->show_nr_of_instructions? "ON" : "OFF");
581  if (m->show_nr_of_instructions != previous_mode)
582  printf(" (was: %s)", previous_mode? "ON" : "OFF");
583  printf("\n");
584 }
585 
586 
587 /*
588  * debugger_cmd_pause():
589  */
590 static void debugger_cmd_pause(struct machine *m, char *cmd_line)
591 {
592  int cpuid = -1;
593 
594  if (cmd_line[0] != '\0')
595  cpuid = atoi(cmd_line);
596  else {
597  printf("syntax: pause cpuid\n");
598  return;
599  }
600 
601  if (cpuid < 0 || cpuid >= m->ncpus) {
602  printf("cpu%i doesn't exist.\n", cpuid);
603  return;
604  }
605 
606  m->cpus[cpuid]->running ^= 1;
607 
608  printf("cpu%i (%s) in machine \"%s\" is now %s\n", cpuid,
609  m->cpus[cpuid]->name, m->name,
610  m->cpus[cpuid]->running? "RUNNING" : "STOPPED");
611 }
612 
613 
614 /*
615  * debugger_cmd_print():
616  */
617 static void debugger_cmd_print(struct machine *m, char *cmd_line)
618 {
619  int res;
620  uint64_t tmp;
621 
622  while (cmd_line[0] != '\0' && cmd_line[0] == ' ')
623  cmd_line ++;
624 
625  if (cmd_line[0] == '\0') {
626  printf("syntax: print expr\n");
627  return;
628  }
629 
630  res = debugger_parse_expression(m, cmd_line, 0, &tmp);
631  switch (res) {
632  case PARSE_NOMATCH:
633  printf("No match.\n");
634  break;
635  case PARSE_MULTIPLE:
636  printf("Multiple matches. Try prefixing with %%, $, or @.\n");
637  break;
638  case PARSE_SETTINGS:
639  printf("%s = 0x%" PRIx64"\n", cmd_line, (uint64_t)tmp);
640  break;
641  case PARSE_SYMBOL:
642  if (m->cpus[0]->is_32bit)
643  printf("%s = 0x%08" PRIx32"\n", cmd_line, (uint32_t)tmp);
644  else
645  printf("%s = 0x%016" PRIx64"\n", cmd_line,(uint64_t)tmp);
646  break;
647  case PARSE_NUMBER:
648  printf("0x%" PRIx64"\n", (uint64_t) tmp);
649  break;
650  }
651 }
652 
653 
654 /*
655  * debugger_cmd_put():
656  */
657 static void debugger_cmd_put(struct machine *m, char *cmd_line)
658 {
659  static char put_type = ' '; /* Remembered across multiple calls. */
660  char copy[200];
661  int res, syntax_ok = 0;
662  char *p, *p2, *q = NULL;
663  uint64_t addr, data;
664  unsigned char a_byte;
665 
666  strncpy(copy, cmd_line, sizeof(copy));
667  copy[sizeof(copy)-1] = '\0';
668 
669  /* syntax: put [b|h|w|d|q] addr, data */
670 
671  p = strchr(copy, ',');
672  if (p != NULL) {
673  *p++ = '\0';
674  while (*p == ' ' && *p)
675  p++;
676  while (strlen(copy) >= 1 &&
677  copy[strlen(copy) - 1] == ' ')
678  copy[strlen(copy) - 1] = '\0';
679 
680  /* printf("L = '%s', R = '%s'\n", copy, p); */
681 
682  q = copy;
683  p2 = strchr(q, ' ');
684 
685  if (p2 != NULL) {
686  *p2 = '\0';
687  if (strlen(q) != 1) {
688  printf("Invalid type '%s'\n", q);
689  return;
690  }
691  put_type = *q;
692  q = p2 + 1;
693  }
694 
695  /* printf("type '%c', L '%s', R '%s'\n", put_type, q, p); */
696  syntax_ok = 1;
697  }
698 
699  if (!syntax_ok) {
700  printf("syntax: put [b|h|w|d|q] addr, data\n");
701  printf(" b byte (8 bits)\n");
702  printf(" h half-word (16 bits)\n");
703  printf(" w word (32 bits)\n");
704  printf(" d doubleword (64 bits)\n");
705  printf(" q quad-word (128 bits)\n");
706  return;
707  }
708 
709  if (put_type == ' ') {
710  printf("No type specified.\n");
711  return;
712  }
713 
714  /* here: q is the address, p is the data. */
715  res = debugger_parse_expression(m, q, 0, &addr);
716  switch (res) {
717  case PARSE_NOMATCH:
718  printf("Couldn't parse the address.\n");
719  return;
720  case PARSE_MULTIPLE:
721  printf("Multiple matches for the address."
722  " Try prefixing with %%, $, or @.\n");
723  return;
724  case PARSE_SETTINGS:
725  case PARSE_SYMBOL:
726  case PARSE_NUMBER:
727  break;
728  default:
729  printf("INTERNAL ERROR in debugger.c.\n");
730  return;
731  }
732 
733  res = debugger_parse_expression(m, p, 0, &data);
734  switch (res) {
735  case PARSE_NOMATCH:
736  printf("Couldn't parse the data.\n");
737  return;
738  case PARSE_MULTIPLE:
739  printf("Multiple matches for the data value."
740  " Try prefixing with %%, $, or @.\n");
741  return;
742  case PARSE_SETTINGS:
743  case PARSE_SYMBOL:
744  case PARSE_NUMBER:
745  break;
746  default:
747  printf("INTERNAL ERROR in debugger.c.\n");
748  return;
749  }
750 
751  /* TODO: haha, maybe this should be refactored */
752 
753  switch (put_type) {
754  case 'b':
755  a_byte = data;
756  if (m->cpus[0]->is_32bit)
757  printf("0x%08" PRIx32, (uint32_t) addr);
758  else
759  printf("0x%016" PRIx64, (uint64_t) addr);
760  printf(": %02x", a_byte);
761  if (data > 255)
762  printf(" (NOTE: truncating %0" PRIx64")",
763  (uint64_t) data);
764  res = m->cpus[0]->memory_rw(m->cpus[0], m->cpus[0]->mem, addr,
765  &a_byte, 1, MEM_WRITE, CACHE_NONE | NO_EXCEPTIONS);
766  if (!res)
767  printf(" FAILED!\n");
768  printf("\n");
769  return;
770  case 'h':
771  if ((addr & 1) != 0)
772  printf("WARNING: address isn't aligned\n");
773  if (m->cpus[0]->is_32bit)
774  printf("0x%08" PRIx32, (uint32_t) addr);
775  else
776  printf("0x%016" PRIx64, (uint64_t) addr);
777  printf(": %04x", (int)data);
778  if (data > 0xffff)
779  printf(" (NOTE: truncating %0" PRIx64")",
780  (uint64_t) data);
781  res = store_16bit_word(m->cpus[0], addr, data);
782  if (!res)
783  printf(" FAILED!\n");
784  printf("\n");
785  return;
786  case 'w':
787  if ((addr & 3) != 0)
788  printf("WARNING: address isn't aligned\n");
789  if (m->cpus[0]->is_32bit)
790  printf("0x%08" PRIx32, (uint32_t) addr);
791  else
792  printf("0x%016" PRIx64, (uint64_t) addr);
793 
794  printf(": %08x", (int)data);
795 
796  if (data > 0xffffffff && (data >> 32) != 0
797  && (data >> 32) != 0xffffffff)
798  printf(" (NOTE: truncating %0" PRIx64")",
799  (uint64_t) data);
800 
801  res = store_32bit_word(m->cpus[0], addr, data);
802  if (!res)
803  printf(" FAILED!\n");
804  printf("\n");
805  return;
806  case 'd':
807  if ((addr & 7) != 0)
808  printf("WARNING: address isn't aligned\n");
809  if (m->cpus[0]->is_32bit)
810  printf("0x%08" PRIx32, (uint32_t) addr);
811  else
812  printf("0x%016" PRIx64, (uint64_t) addr);
813 
814  printf(": %016" PRIx64, (uint64_t) data);
815 
816  res = store_64bit_word(m->cpus[0], addr, data);
817  if (!res)
818  printf(" FAILED!\n");
819  printf("\n");
820  return;
821  case 'q':
822  printf("quad-words: TODO\n");
823  /* TODO */
824  return;
825  default:
826  printf("Unimplemented type '%c'\n", put_type);
827  return;
828  }
829 }
830 
831 
832 /*
833  * debugger_cmd_quiet():
834  */
835 static void debugger_cmd_quiet(struct machine *m, char *cmd_line)
836 {
837  int toggle = 1;
838  int previous_mode = old_quiet_mode;
839 
840  if (cmd_line[0] != '\0') {
841  while (cmd_line[0] != '\0' && cmd_line[0] == ' ')
842  cmd_line ++;
843  switch (cmd_line[0]) {
844  case '0':
845  toggle = 0;
846  old_quiet_mode = 0;
847  break;
848  case '1':
849  toggle = 0;
850  old_quiet_mode = 1;
851  break;
852  case 'o':
853  case 'O':
854  toggle = 0;
855  switch (cmd_line[1]) {
856  case 'n':
857  case 'N':
858  old_quiet_mode = 1;
859  break;
860  default:
861  old_quiet_mode = 0;
862  }
863  break;
864  default:
865  printf("syntax: quiet [on|off]\n");
866  return;
867  }
868  }
869 
870  if (toggle)
872 
873  printf("quiet_mode = %s", old_quiet_mode? "ON" : "OFF");
874  if (old_quiet_mode != previous_mode)
875  printf(" (was: %s)", previous_mode? "ON" : "OFF");
876  printf("\n");
877 }
878 
879 
880 /*
881  * debugger_cmd_quit():
882  */
883 static void debugger_cmd_quit(struct machine *m, char *cmd_line)
884 {
885  int j, k;
886 
887  if (*cmd_line) {
888  printf("syntax: quit\n");
889  return;
890  }
891 
893 
895 
896  for (j=0; j<debugger_emul->n_machines; j++) {
897  struct machine *mp = debugger_emul->machines[j];
898 
899  for (k=0; k<mp->ncpus; k++)
900  mp->cpus[k]->running = 0;
901 
903  }
904 
905  exit_debugger = 1;
906 }
907 
908 
909 /*
910  * debugger_cmd_reg():
911  */
912 static void debugger_cmd_reg(struct machine *m, char *cmd_line)
913 {
914  int cpuid = debugger_cur_cpu, coprocnr = -1;
915  int gprs, coprocs;
916  char *p;
917 
918  /* [cpuid][,c] */
919  if (cmd_line[0] != '\0') {
920  if (cmd_line[0] != ',') {
921  cpuid = strtoull(cmd_line, NULL, 0);
922  if (cpuid < 0 || cpuid >= m->ncpus) {
923  printf("cpu%i doesn't exist.\n", cpuid);
924  return;
925  }
926  }
927  p = strchr(cmd_line, ',');
928  if (p != NULL) {
929  coprocnr = atoi(p + 1);
930  if (coprocnr < 0 || coprocnr >= 4) {
931  printf("Invalid coprocessor number.\n");
932  return;
933  }
934  }
935  }
936 
937  gprs = (coprocnr == -1)? 1 : 0;
938  coprocs = (coprocnr == -1)? 0x0 : (1 << coprocnr);
939 
940  cpu_register_dump(m, m->cpus[cpuid], gprs, coprocs);
941 }
942 
943 
944 /*
945  * debugger_cmd_step():
946  */
947 static void debugger_cmd_step(struct machine *m, char *cmd_line)
948 {
949  int n = 1;
950 
951  if (cmd_line[0] != '\0') {
952  n = strtoull(cmd_line, NULL, 0);
953  if (n < 1) {
954  printf("invalid nr of steps\n");
955  return;
956  }
957  }
958 
960 
961  /* Special hack, see debugger() for more info. */
962  exit_debugger = -1;
963 
964  strlcpy(repeat_cmd, "step", MAX_CMD_BUFLEN);
965 }
966 
967 
968 /*
969  * debugger_cmd_tlbdump():
970  *
971  * Dump each CPU's TLB contents.
972  */
973 static void debugger_cmd_tlbdump(struct machine *m, char *cmd_line)
974 {
975  int x = -1;
976  int rawflag = 0;
977 
978  if (cmd_line[0] != '\0') {
979  char *p;
980  if (cmd_line[0] != ',') {
981  x = strtoull(cmd_line, NULL, 0);
982  if (x < 0 || x >= m->ncpus) {
983  printf("cpu%i doesn't exist.\n", x);
984  return;
985  }
986  }
987  p = strchr(cmd_line, ',');
988  if (p != NULL) {
989  switch (p[1]) {
990  case 'r':
991  case 'R':
992  rawflag = 1;
993  break;
994  default:
995  printf("Unknown tlbdump flag.\n");
996  printf("syntax: tlbdump [cpuid][,r]\n");
997  return;
998  }
999  }
1000  }
1001 
1002  cpu_tlbdump(m, x, rawflag);
1003 }
1004 
1005 
1006 /*
1007  * debugger_cmd_trace():
1008  */
1009 static void debugger_cmd_trace(struct machine *m, char *cmd_line)
1010 {
1011  int toggle = 1;
1012  int previous_mode = old_show_trace_tree;
1013 
1014  if (cmd_line[0] != '\0') {
1015  while (cmd_line[0] != '\0' && cmd_line[0] == ' ')
1016  cmd_line ++;
1017  switch (cmd_line[0]) {
1018  case '0':
1019  toggle = 0;
1020  old_show_trace_tree = 0;
1021  break;
1022  case '1':
1023  toggle = 0;
1024  old_show_trace_tree = 1;
1025  break;
1026  case 'o':
1027  case 'O':
1028  toggle = 0;
1029  switch (cmd_line[1]) {
1030  case 'n':
1031  case 'N':
1032  old_show_trace_tree = 1;
1033  break;
1034  default:
1035  old_show_trace_tree = 0;
1036  }
1037  break;
1038  default:
1039  printf("syntax: trace [on|off]\n");
1040  return;
1041  }
1042  }
1043 
1044  if (toggle)
1046 
1047  printf("show_trace_tree = %s", old_show_trace_tree? "ON" : "OFF");
1048  if (old_show_trace_tree != previous_mode)
1049  printf(" (was: %s)", previous_mode? "ON" : "OFF");
1050  printf("\n");
1051 }
1052 
1053 
1054 /*
1055  * debugger_cmd_unassemble():
1056  *
1057  * Dump emulated memory as instructions.
1058  *
1059  * syntax: unassemble [addr [endaddr]]
1060  */
1061 static void debugger_cmd_unassemble(struct machine *m, char *cmd_line)
1062 {
1063  uint64_t addr, addr_start, addr_end;
1064  struct cpu *c;
1065  struct memory *mem;
1066  char *p = NULL;
1067  int r, lines_left = -1;
1068 
1069  if (cmd_line[0] != '\0') {
1070  uint64_t tmp;
1071  char *tmps;
1072 
1073  CHECK_ALLOCATION(tmps = strdup(cmd_line));
1074 
1075  /* addr: */
1076  p = strchr(tmps, ' ');
1077  if (p != NULL)
1078  *p = '\0';
1079  r = debugger_parse_expression(m, tmps, 0, &tmp);
1080  free(tmps);
1081 
1082  if (r == PARSE_NOMATCH || r == PARSE_MULTIPLE) {
1083  printf("Unparsable address: %s\n", cmd_line);
1084  return;
1085  } else {
1086  last_unasm_addr = tmp;
1087  }
1088 
1089  p = strchr(cmd_line, ' ');
1090  }
1091 
1092  if (m->cpus == NULL) {
1093  printf("No cpus (?)\n");
1094  return;
1095  }
1096  c = m->cpus[m->bootstrap_cpu];
1097  if (c == NULL) {
1098  printf("m->cpus[m->bootstrap_cpu] = NULL\n");
1099  return;
1100  }
1101  mem = m->cpus[m->bootstrap_cpu]->mem;
1102 
1103  addr_start = last_unasm_addr;
1104 
1105  if (addr_start == MAGIC_UNTOUCHED)
1106  addr_start = c->pc;
1107 
1108  addr_end = addr_start + 1000;
1109 
1110  /* endaddr: */
1111  if (p != NULL) {
1112  while (*p == ' ' && *p)
1113  p++;
1114  r = debugger_parse_expression(m, p, 0, &addr_end);
1115  if (r == PARSE_NOMATCH || r == PARSE_MULTIPLE) {
1116  printf("Unparsable address: %s\n", cmd_line);
1117  return;
1118  }
1119  } else
1120  lines_left = 20;
1121 
1122  addr = addr_start;
1123 
1124  ctrl_c = 0;
1125 
1126  while (addr < addr_end) {
1127  unsigned int i, len;
1128  int failed = 0;
1129  unsigned char buf[17]; /* TODO: How long can an
1130  instruction be, on weird archs? */
1131  memset(buf, 0, sizeof(buf));
1132 
1133  for (i=0; i<sizeof(buf); i++) {
1134  uint64_t actualaddr = addr;
1135 
1136  // Hack for ARM (THUMB): (Lowest bit = 1 means 16-bit encoding)
1137  if (m->arch == ARCH_ARM)
1138  actualaddr &= ~1;
1139 
1140  if (c->memory_rw(c, mem, actualaddr+i, buf+i, 1, MEM_READ,
1142  failed ++;
1143  }
1144 
1145  if (failed == sizeof(buf)) {
1146  printf("(memory access failed)\n");
1147  break;
1148  }
1149 
1150  len = cpu_disassemble_instr(m, c, buf, 0, addr);
1151 
1152  if (ctrl_c)
1153  return;
1154  if (len == 0)
1155  break;
1156 
1157  addr += len;
1158 
1159  if (lines_left != -1) {
1160  lines_left --;
1161  if (lines_left == 0)
1162  break;
1163  }
1164  }
1165 
1166  last_unasm_addr = addr;
1167 
1168  strlcpy(repeat_cmd, "unassemble", MAX_CMD_BUFLEN);
1169 }
1170 
1171 
1172 /*
1173  * debugger_cmd_version():
1174  */
1175 static void debugger_cmd_version(struct machine *m, char *cmd_line)
1176 {
1177  if (*cmd_line) {
1178  printf("syntax: version\n");
1179  return;
1180  }
1181 
1182  printf("%s, %s\n", VERSION, COMPILE_DATE);
1183 }
1184 
1185 
1186 /****************************************************************************/
1187 
1188 
1189 struct cmd {
1190  const char *name;
1191  const char *args;
1193  void (*f)(struct machine *, char *cmd_line);
1194  const char *description;
1195 };
1196 
1197 static struct cmd cmds[] = {
1198  { "allsettings", "", 0, debugger_cmd_allsettings,
1199  "show all settings" },
1200 
1201  { "breakpoint", "...", 0, debugger_cmd_breakpoint,
1202  "manipulate breakpoints" },
1203 
1204  /* NOTE: Try to keep 'c' down to only one command. Having 'continue'
1205  available as a one-letter command is very convenient. */
1206 
1207  { "continue", "", 0, debugger_cmd_continue,
1208  "continue execution" },
1209 
1210  { "device", "...", 0, debugger_cmd_device,
1211  "show info about (or manipulate) devices" },
1212 
1213  { "dump", "[addr [endaddr]]", 0, debugger_cmd_dump,
1214  "dump memory contents in hex and ASCII" },
1215 
1216  { "emul", "", 0, debugger_cmd_emul,
1217  "Print a summary of the current emulation" },
1218 
1219  { "focus", "x[,y[,z]]", 0, debugger_cmd_focus,
1220  "changes focus to cpu x, machine x, emul z" },
1221 
1222  { "help", "", 0, debugger_cmd_help,
1223  "Print this help message" },
1224 
1225  { "itrace", "", 0, debugger_cmd_itrace,
1226  "toggle instruction_trace on or off" },
1227 
1228  { "lookup", "name|addr", 0, debugger_cmd_lookup,
1229  "lookup a symbol by name or address" },
1230 
1231  { "machine", "", 0, debugger_cmd_machine,
1232  "Print a summary of the current machine" },
1233 
1234  { "ninstrs", "[on|off]", 0, debugger_cmd_ninstrs,
1235  "toggle (set or unset) show_nr_of_instructions" },
1236 
1237  { "pause", "cpuid", 0, debugger_cmd_pause,
1238  "pause (or unpause) a CPU" },
1239 
1240  { "print", "expr", 0, debugger_cmd_print,
1241  "evaluate an expression without side-effects" },
1242 
1243  { "put", "[b|h|w|d|q] addr, data", 0, debugger_cmd_put,
1244  "modify emulated memory contents" },
1245 
1246  { "quiet", "[on|off]", 0, debugger_cmd_quiet,
1247  "toggle quiet_mode on or off" },
1248 
1249  { "quit", "", 0, debugger_cmd_quit,
1250  "quit the emulator" },
1251 
1252  /* NOTE: Try to keep 'r' down to only one command. Having 'reg'
1253  available as a one-letter command is very convenient. */
1254 
1255  { "reg", "[cpuid][,c]", 0, debugger_cmd_reg,
1256  "show GPRs (or coprocessor c's registers)" },
1257 
1258  /* NOTE: Try to keep 's' down to only one command. Having 'step'
1259  available as a one-letter command is very convenient. */
1260 
1261  { "step", "[n]", 0, debugger_cmd_step,
1262  "single-step one (or n) instruction(s)" },
1263 
1264  { "tlbdump", "[cpuid][,r]", 0, debugger_cmd_tlbdump,
1265  "dump TLB contents (add ',r' for raw data)" },
1266 
1267  { "trace", "[on|off]", 0, debugger_cmd_trace,
1268  "toggle show_trace_tree on or off" },
1269 
1270  /* NOTE: Try to keep 'u' down to only one command. Having 'unassemble'
1271  available as a one-letter command is very convenient. */
1272 
1273  { "unassemble", "[addr [endaddr]]", 0, debugger_cmd_unassemble,
1274  "dump memory contents as instructions" },
1275 
1276  { "version", "", 0, debugger_cmd_version,
1277  "Print version information" },
1278 
1279  /* Note: NULL handler. */
1280  { "x = expr", "", 0, NULL, "generic assignment" },
1281 
1282  { NULL, NULL, 0, NULL, NULL }
1283 };
1284 
1285 
1286 /*
1287  * debugger_cmd_help():
1288  *
1289  * Print a list of available commands.
1290  *
1291  * NOTE: This is placed after the cmds[] array, because it needs to
1292  * access it.
1293  *
1294  * TODO: Command completion (ie just type "help s" for "help step").
1295  */
1296 static void debugger_cmd_help(struct machine *m, char *cmd_line)
1297 {
1298  int only_one = 0, only_one_match = 0;
1299  char *nlines_env = getenv("LINES");
1300  int nlines = atoi(nlines_env != NULL? nlines_env : "999999"), curlines;
1301  size_t i, j, max_name_len = 0;
1302 
1303  if (cmd_line[0] != '\0') {
1304  only_one = 1;
1305  }
1306 
1307  i = 0;
1308  while (cmds[i].name != NULL) {
1309  size_t a = strlen(cmds[i].name);
1310  if (cmds[i].args != NULL)
1311  a += 1 + strlen(cmds[i].args);
1312  if (a > max_name_len)
1313  max_name_len = a;
1314  i++;
1315  }
1316 
1317  curlines = 0;
1318  if (!only_one) {
1319  printf("Available commands:\n");
1320  curlines++;
1321  }
1322 
1323  i = 0;
1324  while (cmds[i].name != NULL) {
1325  char buf[100];
1326  snprintf(buf, sizeof(buf), "%s", cmds[i].name);
1327 
1328  if (only_one) {
1329  if (strcmp(cmds[i].name, cmd_line) != 0) {
1330  i++;
1331  continue;
1332  }
1333  only_one_match = 1;
1334  }
1335 
1336  if (cmds[i].args != NULL)
1337  snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1338  " %s", cmds[i].args);
1339 
1340  printf(" ");
1341  for (j=0; j<max_name_len; j++)
1342  if (j < strlen(buf))
1343  printf("%c", buf[j]);
1344  else
1345  printf(" ");
1346 
1347  printf(" %s\n", cmds[i].description);
1348  i++;
1349 
1350  curlines ++;
1351  if (curlines >= nlines - 1) {
1352  char ch;
1353  printf("-- more --"); fflush(stdout);
1354  ch = debugger_readchar();
1355  printf("\n");
1356  if (ch == 'q' || ch == 'Q')
1357  return;
1358  curlines = 0;
1359  }
1360  }
1361 
1362  if (only_one) {
1363  if (!only_one_match)
1364  printf("%s: no such command\n", cmd_line);
1365  return;
1366  }
1367 
1368  /* TODO: generalize/refactor */
1369  curlines += 8;
1370  if (curlines > nlines - 1) {
1371  char ch;
1372  printf("-- more --"); fflush(stdout);
1373  ch = debugger_readchar();
1374  printf("\n");
1375  if (ch == 'q' || ch == 'Q')
1376  return;
1377  curlines = 0;
1378  }
1379 
1380  printf("\nIn generic assignments, x must be a register or other "
1381  "writable settings\nvariable, and expr can contain registers/"
1382  "settings, numeric values, or symbol\nnames, in combination with"
1383  " parenthesis and + - * / & %% ^ | operators.\nIn case there are"
1384  " multiple matches (i.e. a symbol that has the same name as a\n"
1385  "register), you may add a prefix character as a hint: '#' for"
1386  " registers, '@'\nfor symbols, and '$' for numeric values. Use"
1387  " 0x for hexadecimal values.\n");
1388 }
1389 
memory::n_mmapped_devices
int n_mmapped_devices
Definition: memory.h:81
PARSE_NOMATCH
#define PARSE_NOMATCH
Definition: debugger.h:52
debugger_readchar
char debugger_readchar(void)
Definition: debugger.cc:108
data
u_short data
Definition: siireg.h:79
cpu_register_dump
void cpu_register_dump(struct machine *m, struct cpu *cpu, int gprs, int coprocs)
Definition: cpu.cc:212
memory_device::name
const char * name
Definition: memory.h:54
machine::bootstrap_cpu
int bootstrap_cpu
Definition: machine.h:136
machine::name
const char * name
Definition: machine.h:105
PARSE_MULTIPLE
#define PARSE_MULTIPLE
Definition: debugger.h:53
cpu::running
uint8_t running
Definition: cpu.h:353
cpu::translation_cache
unsigned char * translation_cache
Definition: cpu.h:431
machine::symbol_context
struct symbol_context symbol_context
Definition: machine.h:144
cmd::f
void(* f)(struct machine *, char *cmd_line)
Definition: debugger_cmds.cc:1193
machine::breakpoints
struct breakpoints breakpoints
Definition: machine.h:159
memory
Definition: memory.h:75
debug
#define debug
Definition: dev_adb.cc:57
old_instruction_trace
int old_instruction_trace
Definition: debugger.cc:75
cpu_disassemble_instr
int cpu_disassemble_instr(struct machine *m, struct cpu *cpu, unsigned char *instr, int running, uint64_t addr)
Definition: cpu.cc:192
machine::cpus
struct cpu ** cpus
Definition: machine.h:140
machine::show_nr_of_instructions
int show_nr_of_instructions
Definition: machine.h:163
settings_debugdump
void settings_debugdump(struct settings *settings, const char *prefix, int recurse)
Definition: settings.cc:264
get_symbol_name
char * get_symbol_name(struct symbol_context *, uint64_t addr, uint64_t *offset)
Definition: symbol.cc:188
breakpoints::string
char ** string
Definition: machine.h:59
store_64bit_word
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64)
Definition: memory.cc:752
PARSE_SETTINGS
#define PARSE_SETTINGS
Definition: debugger.h:54
MAX_CMD_BUFLEN
#define MAX_CMD_BUFLEN
Definition: debugger.cc:92
exit_debugger
volatile int exit_debugger
Definition: debugger.cc:69
MEM_READ
#define MEM_READ
Definition: memory.h:116
cmd::tmp_flag
int tmp_flag
Definition: debugger_cmds.cc:1192
addr
uint32_t addr
Definition: tmp_arm_multi.cc:52
force_debugger_at_exit
int force_debugger_at_exit
Definition: debugger.cc:70
memory_device::length
uint64_t length
Definition: memory.h:51
memory_device::baseaddr
uint64_t baseaddr
Definition: memory.h:49
single_step
volatile int single_step
Definition: debugger.cc:68
cmd
Definition: debugger_cmds.cc:1189
debugger_parse_expression
int debugger_parse_expression(struct machine *m, char *expr, int writeflag, uint64_t *valuep)
Definition: debugger_expr.cc:244
MEM_WRITE
#define MEM_WRITE
Definition: memory.h:117
memory::devices
struct memory_device * devices
Definition: memory.h:88
breakpoints::n
int n
Definition: machine.h:56
memory_device_remove
void memory_device_remove(struct memory *mem, int i)
Definition: memory.cc:463
DM_DYNTRANS_WRITE_OK
#define DM_DYNTRANS_WRITE_OK
Definition: memory.h:132
emul_dumpinfo
void emul_dumpinfo(struct emul *e)
Definition: emul.cc:704
PARSE_NUMBER
#define PARSE_NUMBER
Definition: debugger.h:55
cmd::description
const char * description
Definition: debugger_cmds.cc:1194
machine_dumpinfo
void machine_dumpinfo(struct machine *)
Definition: machine.cc:392
strlen
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
Definition: cpu_arm_instr.cc:2686
PARSE_SYMBOL
#define PARSE_SYMBOL
Definition: debugger.h:56
device_dumplist
void device_dumplist(void)
Definition: device.cc:408
cpu_tlbdump
void cpu_tlbdump(struct machine *m, int x, int rawflag)
Definition: cpu.cc:177
debugger_cur_machine
int debugger_cur_machine
Definition: debugger.cc:88
CACHE_NONE
#define CACHE_NONE
Definition: memory.h:123
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine
Definition: machine.h:97
cpu::name
char * name
Definition: cpu.h:334
breakpoints::addr
uint64_t * addr
Definition: machine.h:60
cmd::args
const char * args
Definition: debugger_cmds.cc:1191
cpu::is_32bit
uint8_t is_32bit
Definition: cpu.h:350
MEMORY_ACCESS_FAILED
#define MEMORY_ACCESS_FAILED
Definition: memory.h:140
machine::memory
struct memory * memory
Definition: machine.h:126
cpu::mem
struct memory * mem
Definition: cpu.h:362
debugger_n_steps_left_before_interaction
int debugger_n_steps_left_before_interaction
Definition: debugger.cc:73
global_settings
struct settings * global_settings
Definition: main.cc:59
get_symbol_addr
int get_symbol_addr(struct symbol_context *, const char *symbol, uint64_t *addr)
Definition: symbol.cc:63
NO_EXCEPTIONS
#define NO_EXCEPTIONS
Definition: memory.h:125
console_debug_dump
void console_debug_dump(struct machine *machine)
Definition: console.cc:842
symbol
Definition: symbol.h:37
store_32bit_word
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
NOT_SINGLE_STEPPING
#define NOT_SINGLE_STEPPING
Definition: debugger.h:47
cpu_create_or_reset_tc
void cpu_create_or_reset_tc(struct cpu *cpu)
Definition: cpu.cc:298
DEBUG_INDENTATION
#define DEBUG_INDENTATION
Definition: misc.h:212
ARCH_ARM
#define ARCH_ARM
Definition: machine.h:206
store_16bit_word
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16)
Definition: memory.cc:807
cmd::name
const char * name
Definition: debugger_cmds.cc:1190
cpu
Definition: cpu.h:326
machine::exit_without_entering_debugger
int exit_without_entering_debugger
Definition: machine.h:172
DM_DYNTRANS_OK
#define DM_DYNTRANS_OK
Definition: memory.h:131
GLOBAL_SETTINGS_NAME
#define GLOBAL_SETTINGS_NAME
Definition: settings.h:33
old_quiet_mode
int old_quiet_mode
Definition: debugger.cc:76
cpu::memory_rw
int(* memory_rw)(struct cpu *cpu, struct memory *mem, uint64_t vaddr, unsigned char *data, size_t len, int writeflag, int cache_flags)
Definition: cpu.h:368
old_show_trace_tree
int old_show_trace_tree
Definition: debugger.cc:77
MAGIC_UNTOUCHED
#define MAGIC_UNTOUCHED
Definition: debugger.cc:99
debugger_cur_cpu
int debugger_cur_cpu
Definition: debugger.cc:87
machine::arch
int arch
Definition: machine.h:110
cpu::pc
uint64_t pc
Definition: cpu.h:386
debug_indentation
void debug_indentation(int diff)
Definition: main.cc:120
machine::ncpus
int ncpus
Definition: machine.h:139
CHECK_ALLOCATION
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239
memory_device::flags
int flags
Definition: memory.h:52

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18