version 0.5.2
[fw/sdcc] / sim / ucsim / cmd.src / bp.cc
index 19c3e767525fce837a58af706f1440c49d0bd8de..617f43e5d3f75f48f4d4057302b0228c72e80010 100644 (file)
@@ -51,7 +51,7 @@ COMMAND_DO_WORK_UC(cl_break_cmd)
   t_addr addr= 0;
   int hit= 1;
   char op;
-  class cl_mem *mem;
+  class cl_address_space *mem;
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
                                 cmdline->param(2),
@@ -68,14 +68,14 @@ COMMAND_DO_WORK_UC(cl_break_cmd)
     do_fetch(uc, addr, hit, con);
   }
   else if (cmdline->syntax_match(uc, MEMORY STRING ADDRESS)) {
-    mem= params[0]->value.memory;
+    mem= params[0]->value.memory.address_space;
     op= *(params[1]->get_svalue());
     addr= params[2]->value.address;
     hit= 1;
     do_event(uc, mem, op, addr, hit, con);
   }
   else if (cmdline->syntax_match(uc, MEMORY STRING ADDRESS NUMBER)) {
-    mem= params[0]->value.memory;
+    mem= params[0]->value.memory.address_space;
     op= *(params[1]->get_svalue());
     addr= params[2]->value.address;
     hit= params[3]->value.number;
@@ -83,7 +83,7 @@ COMMAND_DO_WORK_UC(cl_break_cmd)
   }
   else
     {
-      con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+      con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
       return(DD_FALSE);
     }
   return(DD_FALSE);
@@ -95,26 +95,28 @@ cl_break_cmd::do_fetch(class cl_uc *uc,
 {
   if (hit > 99999)
     {
-      con->printf("Hit value %d is too big.\n", hit);
+      con->dd_printf("Hit value %d is too big.\n", hit);
       return;
     }
   if (uc->fbrk->bp_at(addr))
-    con->printf("Breakpoint at 0x%06x is already set.\n", addr);
+    con->dd_printf("Breakpoint at 0x%06x is already set.\n", addr);
   else
     {
-      class cl_brk *b= new cl_fetch_brk(uc->make_new_brknr(),
+      class cl_brk *b= new cl_fetch_brk(uc->address_space(MEM_ROM_ID),
+                                       uc->make_new_brknr(),
                                        addr, perm, hit);
       b->init();
       uc->fbrk->add_bp(b);
       char *s= uc->disass(addr, NULL);
-      con->printf("Breakpoint %d at 0x%06x: %s\n", b->nr, addr, s);
+      con->dd_printf("Breakpoint %d at 0x%06x: %s\n", b->nr, addr, s);
       free(s);
     }
 }
 
 void
 cl_break_cmd::do_event(class cl_uc *uc,
-                      class cl_mem *mem, char op, t_addr addr, int hit,
+                      class cl_address_space *mem,
+                      char op, t_addr addr, int hit,
                       class cl_console *con)
 {
   class cl_ev_brk *b= NULL;
@@ -123,7 +125,7 @@ cl_break_cmd::do_event(class cl_uc *uc,
   if (b)
     uc->ebrk->add_bp(b);
   else
-    con->printf("Couldn't make event breakpoint\n");
+    con->dd_printf("Couldn't make event breakpoint\n");
 }
 
 
@@ -143,7 +145,7 @@ COMMAND_DO_WORK_UC(cl_clear_cmd)
     {
       if (!brk)
        {
-         con->printf("No breakpoint at this address.\n");
+         con->dd_printf("No breakpoint at this address.\n");
          return(0);
        }
       uc->fbrk->del_bp(uc->PC);
@@ -159,7 +161,7 @@ COMMAND_DO_WORK_UC(cl_clear_cmd)
        return(DD_FALSE);
       addr= param->value.address;
       if (uc->fbrk->bp_at(addr) == 0)
-       con->printf("No breakpoint at 0x%06x\n", addr);
+       con->dd_printf("No breakpoint at 0x%06x\n", addr);
       else
        uc->fbrk->del_bp(addr);
     }
@@ -190,7 +192,10 @@ COMMAND_DO_WORK_UC(cl_delete_cmd)
        {
          long num;
          if (param->get_ivalue(&num))
-           uc->rm_brk(num);
+           {
+             if (!uc->rm_brk(num))
+               con->dd_printf("Error\n");
+           }
        }
     }
   return(DD_FALSE);