/[gxemul]/trunk/src/debugger/debugger_cmds.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/debugger/debugger_cmds.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 43 by dpavlin, Mon Oct 8 16:22:32 2007 UTC revision 44 by dpavlin, Mon Oct 8 16:22:56 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: debugger_cmds.c,v 1.12 2007/06/15 17:02:39 debug Exp $   *  $Id: debugger_cmds.c,v 1.14 2007/06/28 14:58:38 debug Exp $
29   *   *
30   *  Debugger commands. Included from debugger.c.   *  Debugger commands. Included from debugger.c.
31   */   */
# Line 355  static void debugger_cmd_dump(struct mac Line 355  static void debugger_cmd_dump(struct mac
355    
356    
357  /*  /*
358   *  debugger_cmd_emuls():   *  debugger_cmd_emul():
359   *   *
360   *  Dump info about all current emuls.   *  Dump info about the current emulation.
361   */   */
362  static void debugger_cmd_emuls(struct machine *m, char *cmd_line)  static void debugger_cmd_emul(struct machine *m, char *cmd_line)
363  {  {
364          int i, iadd = DEBUG_INDENTATION;          int iadd = DEBUG_INDENTATION;
365    
366          if (*cmd_line) {          if (*cmd_line) {
367                  printf("syntax: emuls\n");                  printf("syntax: emul\n");
368                  return;                  return;
369          }          }
370    
371          for (i=0; i<debugger_n_emuls; i++) {          debug("emulation \"%s\":\n", debugger_emul->name == NULL?
372                  struct emul *e = debugger_emuls[i];              "(simple setup)" : debugger_emul->name);
   
                 if (e == NULL)  
                         continue;  
   
                 debug("emulation %i: \"%s\"\n", i,  
                     e->name == NULL? "(no name)" : e->name);  
                 debug_indentation(iadd);  
373    
374                  emul_dumpinfo(e);          debug_indentation(iadd);
375            emul_dumpinfo(debugger_emul);
376                  debug_indentation(-iadd);          debug_indentation(-iadd);
         }  
377  }  }
378    
379    
# Line 393  static void debugger_cmd_emuls(struct ma Line 385  static void debugger_cmd_emuls(struct ma
385   */   */
386  static void debugger_cmd_focus(struct machine *m, char *cmd_line)  static void debugger_cmd_focus(struct machine *m, char *cmd_line)
387  {  {
388          int x = -1, y = -1, z = -1;          int x = -1, y = -1;
389          char *p, *p2;          char *p, *p2;
390    
391          if (!cmd_line[0]) {          if (!cmd_line[0]) {
392                  printf("syntax: focus x[,y,[,z]]\n");                  printf("syntax: focus x[,y]\n");
393                  printf("where x (cpu id), y (machine number), and z (emul "                  printf("where x (cpu id) and y (machine number) "
394                      "number) are integers as\nreported by the 'emuls'"                      "are integers as\nreported by the 'emul'"
395                      " command.\n");                      " command.\n");
396                  goto print_current_focus_and_return;                  goto print_current_focus_and_return;
397          }          }
# Line 418  static void debugger_cmd_focus(struct ma Line 410  static void debugger_cmd_focus(struct ma
410                          printf("No machine number specified?\n");                          printf("No machine number specified?\n");
411                          return;                          return;
412                  }                  }
   
                 if (p2 != NULL)  
                         z = atoi(p2 + 1);  
         }  
   
         if (z != -1) {  
                 /*  Change emul:  */  
                 if (z < 0 || z >= debugger_n_emuls) {  
                         printf("Invalid emul number: %i\n", z);  
                         return;  
                 }  
   
                 debugger_cur_emul = z;  
                 debugger_emul = debugger_emuls[z];  
   
                 /*  This is just in case the machine change below fails...  */  
                 debugger_machine = debugger_emul->machines[0];  
413          }          }
414    
415          if (y != -1) {          if (y != -1) {
# Line 457  static void debugger_cmd_focus(struct ma Line 432  static void debugger_cmd_focus(struct ma
432          debugger_cur_cpu = x;          debugger_cur_cpu = x;
433    
434  print_current_focus_and_return:  print_current_focus_and_return:
         if (debugger_n_emuls > 1)  
                 printf("current emul (%i): \"%s\"\n",  
                     debugger_cur_emul, debugger_emul->name == NULL?  
                     "(no name)" : debugger_emul->name);  
   
435          if (debugger_emul->n_machines > 1)          if (debugger_emul->n_machines > 1)
436                  printf("current machine (%i): \"%s\"\n",                  printf("current machine (%i): \"%s\"\n",
437                      debugger_cur_machine, debugger_machine->name == NULL?                      debugger_cur_machine, debugger_machine->name == NULL?
# Line 549  static void debugger_cmd_lookup(struct m Line 519  static void debugger_cmd_lookup(struct m
519   */   */
520  static void debugger_cmd_machine(struct machine *m, char *cmd_line)  static void debugger_cmd_machine(struct machine *m, char *cmd_line)
521  {  {
522          int iadd = DEBUG_INDENTATION;          int iadd = 0;
523    
524          if (*cmd_line) {          if (*cmd_line) {
525                  printf("syntax: machine\n");                  printf("syntax: machine\n");
526                  return;                  return;
527          }          }
528    
529          debug("machine \"%s\":\n", m->name);          if (m->name != NULL) {
530                    debug("machine \"%s\":\n", m->name);
531                    iadd = DEBUG_INDENTATION;
532            }
533    
534          debug_indentation(iadd);          debug_indentation(iadd);
535          machine_dumpinfo(m);          machine_dumpinfo(m);
536          debug_indentation(-iadd);          debug_indentation(-iadd);
# Line 910  static void debugger_cmd_quiet(struct ma Line 884  static void debugger_cmd_quiet(struct ma
884   */   */
885  static void debugger_cmd_quit(struct machine *m, char *cmd_line)  static void debugger_cmd_quit(struct machine *m, char *cmd_line)
886  {  {
887          int i, j, k;          int j, k;
         struct emul *e;  
888    
889          if (*cmd_line) {          if (*cmd_line) {
890                  printf("syntax: quit\n");                  printf("syntax: quit\n");
891                  return;                  return;
892          }          }
893    
894          for (i=0; i<debugger_n_emuls; i++) {          single_step = NOT_SINGLE_STEPPING;
                 single_step = NOT_SINGLE_STEPPING;  
895    
896                  e = debugger_emuls[i];          force_debugger_at_exit = 0;
                 force_debugger_at_exit = 0;  
897    
898                  for (j=0; j<e->n_machines; j++) {          for (j=0; j<debugger_emul->n_machines; j++) {
899                          struct machine *m = e->machines[j];                  struct machine *m = debugger_emul->machines[j];
900    
901                          for (k=0; k<m->ncpus; k++)                  for (k=0; k<m->ncpus; k++)
902                                  m->cpus[k]->running = 0;                          m->cpus[k]->running = 0;
903    
904                          m->exit_without_entering_debugger = 1;                  m->exit_without_entering_debugger = 1;
                 }  
905          }          }
906    
907          exit_debugger = 1;          exit_debugger = 1;
# Line 1205  static void debugger_cmd_version(struct Line 1175  static void debugger_cmd_version(struct
1175                  return;                  return;
1176          }          }
1177    
 #ifdef VERSION  
1178          printf("%s, %s\n", VERSION, COMPILE_DATE);          printf("%s, %s\n", VERSION, COMPILE_DATE);
 #else  
         printf("(no version), %s\n", COMPILE_DATE);  
 #endif  
1179  }  }
1180    
1181    
# Line 1243  static struct cmd cmds[] = { Line 1209  static struct cmd cmds[] = {
1209          { "dump", "[addr [endaddr]]", 0, debugger_cmd_dump,          { "dump", "[addr [endaddr]]", 0, debugger_cmd_dump,
1210                  "dump memory contents in hex and ASCII" },                  "dump memory contents in hex and ASCII" },
1211    
1212          { "emuls", "", 0, debugger_cmd_emuls,          { "emul", "", 0, debugger_cmd_emul,
1213                  "print a summary of all current emuls" },                  "print a summary of the current emulation" },
1214    
1215          { "focus", "x[,y[,z]]", 0, debugger_cmd_focus,          { "focus", "x[,y[,z]]", 0, debugger_cmd_focus,
1216                  "changes focus to cpu x, machine x, emul z" },                  "changes focus to cpu x, machine x, emul z" },

Legend:
Removed from v.43  
changed lines
  Added in v.44

  ViewVC Help
Powered by ViewVC 1.1.26