OLD | NEW |
1 /* Remote debugging interface to m32r and mon2000 ROM monitors for GDB, | 1 /* Remote debugging interface to m32r and mon2000 ROM monitors for GDB, |
2 the GNU debugger. | 2 the GNU debugger. |
3 | 3 |
4 Copyright (C) 1996-2001, 2004-2005, 2007-2012 Free Software | 4 Copyright (C) 1996-2001, 2004-2005, 2007-2012 Free Software |
5 Foundation, Inc. | 5 Foundation, Inc. |
6 | 6 |
7 Adapted by Michael Snyder of Cygnus Support. | 7 Adapted by Michael Snyder of Cygnus Support. |
8 | 8 |
9 This file is part of GDB. | 9 This file is part of GDB. |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 /* | 117 /* |
118 * Function: m32r_load (an alternate way to load) | 118 * Function: m32r_load (an alternate way to load) |
119 */ | 119 */ |
120 | 120 |
121 static void | 121 static void |
122 m32r_load (char *filename, int from_tty) | 122 m32r_load (char *filename, int from_tty) |
123 { | 123 { |
124 bfd *abfd; | 124 bfd *abfd; |
125 asection *s; | 125 unsigned int data_count = 0; |
126 unsigned int i, data_count = 0; | |
127 struct timeval start_time, end_time; | 126 struct timeval start_time, end_time; |
128 | 127 |
129 if (filename == NULL || filename[0] == 0) | 128 if (filename == NULL || filename[0] == 0) |
130 filename = get_exec_file (1); | 129 filename = get_exec_file (1); |
131 | 130 |
132 abfd = bfd_openr (filename, 0); | 131 abfd = bfd_openr (filename, 0); |
133 if (!abfd) | 132 if (!abfd) |
134 error (_("Unable to open file %s."), filename); | 133 error (_("Unable to open file %s."), filename); |
135 if (bfd_check_format (abfd, bfd_object) == 0) | 134 if (bfd_check_format (abfd, bfd_object) == 0) |
136 error (_("File is not an object file.")); | 135 error (_("File is not an object file.")); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 monitor_supply_register (regcache, ACCH_REGNUM, val); | 230 monitor_supply_register (regcache, ACCH_REGNUM, val); |
232 val = strchr (val, ':'); /* Skip past ':' to get 2nd word. */ | 231 val = strchr (val, ':'); /* Skip past ':' to get 2nd word. */ |
233 if (val != NULL) | 232 if (val != NULL) |
234 monitor_supply_register (regcache, ACCL_REGNUM, val + 1); | 233 monitor_supply_register (regcache, ACCL_REGNUM, val + 1); |
235 } | 234 } |
236 else | 235 else |
237 { | 236 { |
238 monitor_supply_register (regcache, regno, val); | 237 monitor_supply_register (regcache, regno, val); |
239 if (regno == PSW_REGNUM) | 238 if (regno == PSW_REGNUM) |
240 { | 239 { |
| 240 #if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \ |
| 241 || defined BIE_REGNUM || defined COND_REGNUM || defined CBR_REGNUM \ |
| 242 || defined BPC_REGNUM || defined BCARRY_REGNUM) |
241 unsigned long psw = strtoul (val, NULL, 16); | 243 unsigned long psw = strtoul (val, NULL, 16); |
242 char *zero = "00000000", *one = "00000001"; | 244 char *zero = "00000000", *one = "00000001"; |
| 245 #endif |
243 | 246 |
244 #ifdef SM_REGNUM | 247 #ifdef SM_REGNUM |
245 /* Stack mode bit */ | 248 /* Stack mode bit */ |
246 monitor_supply_register (regcache, SM_REGNUM, | 249 monitor_supply_register (regcache, SM_REGNUM, |
247 (psw & 0x80) ? one : zero); | 250 (psw & 0x80) ? one : zero); |
248 #endif | 251 #endif |
249 #ifdef BSM_REGNUM | 252 #ifdef BSM_REGNUM |
250 /* Backup stack mode bit */ | 253 /* Backup stack mode bit */ |
251 monitor_supply_register (regcache, BSM_REGNUM, | 254 monitor_supply_register (regcache, BSM_REGNUM, |
252 (psw & 0x8000) ? one : zero); | 255 (psw & 0x8000) ? one : zero); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 { /* Download is done -- print section statistics. */ | 529 { /* Download is done -- print section statistics. */ |
527 if (bfd_check_format (abfd, bfd_object) == 0) | 530 if (bfd_check_format (abfd, bfd_object) == 0) |
528 { | 531 { |
529 printf_filtered ("File is not an object file\n"); | 532 printf_filtered ("File is not an object file\n"); |
530 } | 533 } |
531 for (s = abfd->sections; s; s = s->next) | 534 for (s = abfd->sections; s; s = s->next) |
532 if (s->flags & SEC_LOAD) | 535 if (s->flags & SEC_LOAD) |
533 { | 536 { |
534 bfd_size_type section_size = bfd_section_size (abfd, s); | 537 bfd_size_type section_size = bfd_section_size (abfd, s); |
535 bfd_vma section_base = bfd_section_lma (abfd, s); | 538 bfd_vma section_base = bfd_section_lma (abfd, s); |
536 unsigned int buffer; | |
537 | 539 |
538 data_count += section_size; | 540 data_count += section_size; |
539 | 541 |
540 printf_filtered ("Loading section %s, size 0x%lx lma ", | 542 printf_filtered ("Loading section %s, size 0x%lx lma ", |
541 bfd_section_name (abfd, s), | 543 bfd_section_name (abfd, s), |
542 (unsigned long) section_size); | 544 (unsigned long) section_size); |
543 fputs_filtered (paddress (target_gdbarch, section_base), | 545 fputs_filtered (paddress (target_gdbarch, section_base), |
544 gdb_stdout); | 546 gdb_stdout); |
545 printf_filtered ("\n"); | 547 printf_filtered ("\n"); |
546 gdb_flush (gdb_stdout); | 548 gdb_flush (gdb_stdout); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 NULL, /* FIXME: i18n: IP address for | 625 NULL, /* FIXME: i18n: IP address for |
624 download server (GDB's host | 626 download server (GDB's host |
625 computer) is %s. */ | 627 computer) is %s. */ |
626 &setlist, &showlist); | 628 &setlist, &showlist); |
627 | 629 |
628 add_com ("upload", class_obscure, m32r_upload_command, _("\ | 630 add_com ("upload", class_obscure, m32r_upload_command, _("\ |
629 Upload the srec file via the monitor's Ethernet upload capability.")); | 631 Upload the srec file via the monitor's Ethernet upload capability.")); |
630 | 632 |
631 add_com ("tload", class_obscure, m32r_load, _("test upload command.")); | 633 add_com ("tload", class_obscure, m32r_load, _("test upload command.")); |
632 } | 634 } |
OLD | NEW |