| OLD | NEW |
| 1 /* Remote debugging interface for M32R/SDI. | 1 /* Remote debugging interface for M32R/SDI. |
| 2 | 2 |
| 3 Copyright (C) 2003-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2003-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 Contributed by Renesas Technology Co. | 5 Contributed by Renesas Technology Co. |
| 6 Written by Kei Sakamoto <sakamoto.kei@renesas.com>. | 6 Written by Kei Sakamoto <sakamoto.kei@renesas.com>. |
| 7 | 7 |
| 8 This file is part of GDB. | 8 This file is part of GDB. |
| 9 | 9 |
| 10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (c != '+') /* error */ | 174 if (c != '+') /* error */ |
| 175 return -1; | 175 return -1; |
| 176 | 176 |
| 177 return 0; | 177 return 0; |
| 178 } | 178 } |
| 179 | 179 |
| 180 /* Send data to the target and check an ack packet. */ | 180 /* Send data to the target and check an ack packet. */ |
| 181 static int | 181 static int |
| 182 send_data (void *buf, int len) | 182 send_data (void *buf, int len) |
| 183 { | 183 { |
| 184 int ret; | |
| 185 | |
| 186 if (!sdi_desc) | 184 if (!sdi_desc) |
| 187 return -1; | 185 return -1; |
| 188 | 186 |
| 189 if (serial_write (sdi_desc, buf, len) != 0) | 187 if (serial_write (sdi_desc, buf, len) != 0) |
| 190 return -1; | 188 return -1; |
| 191 | 189 |
| 192 if (get_ack () == -1) | 190 if (get_ack () == -1) |
| 193 return -1; | 191 return -1; |
| 194 | 192 |
| 195 return len; | 193 return len; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 443 |
| 446 inferior_ptid = null_ptid; | 444 inferior_ptid = null_ptid; |
| 447 delete_thread_silent (remote_m32r_ptid); | 445 delete_thread_silent (remote_m32r_ptid); |
| 448 return; | 446 return; |
| 449 } | 447 } |
| 450 | 448 |
| 451 /* Tell the remote machine to resume. */ | 449 /* Tell the remote machine to resume. */ |
| 452 | 450 |
| 453 static void | 451 static void |
| 454 m32r_resume (struct target_ops *ops, | 452 m32r_resume (struct target_ops *ops, |
| 455 » ptid_t ptid, int step, enum target_signal sig) | 453 » ptid_t ptid, int step, enum gdb_signal sig) |
| 456 { | 454 { |
| 457 unsigned long pc_addr, bp_addr, ab_addr; | 455 unsigned long pc_addr, bp_addr, ab_addr; |
| 458 int ib_breakpoints; | 456 int ib_breakpoints; |
| 459 unsigned char buf[13]; | 457 unsigned char buf[13]; |
| 460 int i; | 458 int i; |
| 461 | 459 |
| 462 if (remote_debug) | 460 if (remote_debug) |
| 463 { | 461 { |
| 464 if (step) | 462 if (step) |
| 465 fprintf_unfiltered (gdb_stdlog, "\nm32r_resume(step)\n"); | 463 fprintf_unfiltered (gdb_stdlog, "\nm32r_resume(step)\n"); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 698 |
| 701 static ptid_t | 699 static ptid_t |
| 702 m32r_wait (struct target_ops *ops, | 700 m32r_wait (struct target_ops *ops, |
| 703 ptid_t ptid, struct target_waitstatus *status, int options) | 701 ptid_t ptid, struct target_waitstatus *status, int options) |
| 704 { | 702 { |
| 705 static RETSIGTYPE (*prev_sigint) (); | 703 static RETSIGTYPE (*prev_sigint) (); |
| 706 unsigned long bp_addr, pc_addr; | 704 unsigned long bp_addr, pc_addr; |
| 707 int ib_breakpoints; | 705 int ib_breakpoints; |
| 708 long i; | 706 long i; |
| 709 unsigned char buf[13]; | 707 unsigned char buf[13]; |
| 710 unsigned long val; | |
| 711 int ret, c; | 708 int ret, c; |
| 712 | 709 |
| 713 if (remote_debug) | 710 if (remote_debug) |
| 714 fprintf_unfiltered (gdb_stdlog, "m32r_wait()\n"); | 711 fprintf_unfiltered (gdb_stdlog, "m32r_wait()\n"); |
| 715 | 712 |
| 716 status->kind = TARGET_WAITKIND_EXITED; | 713 status->kind = TARGET_WAITKIND_EXITED; |
| 717 status->value.sig = TARGET_SIGNAL_0; | 714 status->value.sig = GDB_SIGNAL_0; |
| 718 | 715 |
| 719 interrupted = 0; | 716 interrupted = 0; |
| 720 prev_sigint = signal (SIGINT, gdb_cntrl_c); | 717 prev_sigint = signal (SIGINT, gdb_cntrl_c); |
| 721 | 718 |
| 722 /* Wait for ready. */ | 719 /* Wait for ready. */ |
| 723 buf[0] = SDI_WAIT_FOR_READY; | 720 buf[0] = SDI_WAIT_FOR_READY; |
| 724 if (serial_write (sdi_desc, buf, 1) != 0) | 721 if (serial_write (sdi_desc, buf, 1) != 0) |
| 725 error (_("Remote connection closed")); | 722 error (_("Remote connection closed")); |
| 726 | 723 |
| 727 while (1) | 724 while (1) |
| 728 { | 725 { |
| 729 c = serial_readchar (sdi_desc, SDI_TIMEOUT); | 726 c = serial_readchar (sdi_desc, SDI_TIMEOUT); |
| 730 if (c < 0) | 727 if (c < 0) |
| 731 error (_("Remote connection closed")); | 728 error (_("Remote connection closed")); |
| 732 | 729 |
| 733 if (c == '-') /* error */ | 730 if (c == '-') /* error */ |
| 734 { | 731 { |
| 735 status->kind = TARGET_WAITKIND_STOPPED; | 732 status->kind = TARGET_WAITKIND_STOPPED; |
| 736 » status->value.sig = TARGET_SIGNAL_HUP; | 733 » status->value.sig = GDB_SIGNAL_HUP; |
| 737 return inferior_ptid; | 734 return inferior_ptid; |
| 738 } | 735 } |
| 739 else if (c == '+') /* stopped */ | 736 else if (c == '+') /* stopped */ |
| 740 break; | 737 break; |
| 741 | 738 |
| 742 if (interrupted) | 739 if (interrupted) |
| 743 ret = serial_write (sdi_desc, "!", 1); /* packet to interrupt */ | 740 ret = serial_write (sdi_desc, "!", 1); /* packet to interrupt */ |
| 744 else | 741 else |
| 745 ret = serial_write (sdi_desc, ".", 1); /* packet to wait */ | 742 ret = serial_write (sdi_desc, ".", 1); /* packet to wait */ |
| 746 if (ret != 0) | 743 if (ret != 0) |
| 747 error (_("Remote connection closed")); | 744 error (_("Remote connection closed")); |
| 748 } | 745 } |
| 749 | 746 |
| 750 status->kind = TARGET_WAITKIND_STOPPED; | 747 status->kind = TARGET_WAITKIND_STOPPED; |
| 751 if (interrupted) | 748 if (interrupted) |
| 752 status->value.sig = TARGET_SIGNAL_INT; | 749 status->value.sig = GDB_SIGNAL_INT; |
| 753 else | 750 else |
| 754 status->value.sig = TARGET_SIGNAL_TRAP; | 751 status->value.sig = GDB_SIGNAL_TRAP; |
| 755 | 752 |
| 756 interrupted = 0; | 753 interrupted = 0; |
| 757 signal (SIGINT, prev_sigint); | 754 signal (SIGINT, prev_sigint); |
| 758 | 755 |
| 759 check_mmu_status (); | 756 check_mmu_status (); |
| 760 | 757 |
| 761 /* Recover parallel bit. */ | 758 /* Recover parallel bit. */ |
| 762 if (last_pc_addr != 0xffffffff) | 759 if (last_pc_addr != 0xffffffff) |
| 763 { | 760 { |
| 764 buf[0] = SDI_WRITE_MEMORY; | 761 buf[0] = SDI_WRITE_MEMORY; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 | 875 |
| 879 /* Terminate the open connection to the remote debugger. | 876 /* Terminate the open connection to the remote debugger. |
| 880 Use this when you want to detach and do something else | 877 Use this when you want to detach and do something else |
| 881 with your gdb. */ | 878 with your gdb. */ |
| 882 static void | 879 static void |
| 883 m32r_detach (struct target_ops *ops, char *args, int from_tty) | 880 m32r_detach (struct target_ops *ops, char *args, int from_tty) |
| 884 { | 881 { |
| 885 if (remote_debug) | 882 if (remote_debug) |
| 886 fprintf_unfiltered (gdb_stdlog, "m32r_detach(%d)\n", from_tty); | 883 fprintf_unfiltered (gdb_stdlog, "m32r_detach(%d)\n", from_tty); |
| 887 | 884 |
| 888 m32r_resume (ops, inferior_ptid, 0, TARGET_SIGNAL_0); | 885 m32r_resume (ops, inferior_ptid, 0, GDB_SIGNAL_0); |
| 889 | 886 |
| 890 /* Calls m32r_close to do the real work. */ | 887 /* Calls m32r_close to do the real work. */ |
| 891 pop_target (); | 888 pop_target (); |
| 892 if (from_tty) | 889 if (from_tty) |
| 893 fprintf_unfiltered (gdb_stdlog, "Ending remote %s debugging\n", | 890 fprintf_unfiltered (gdb_stdlog, "Ending remote %s debugging\n", |
| 894 target_shortname); | 891 target_shortname); |
| 895 } | 892 } |
| 896 | 893 |
| 897 /* Return the id of register number REGNO. */ | 894 /* Return the id of register number REGNO. */ |
| 898 | 895 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 { | 1215 { |
| 1219 struct cleanup *old_chain; | 1216 struct cleanup *old_chain; |
| 1220 asection *section; | 1217 asection *section; |
| 1221 bfd *pbfd; | 1218 bfd *pbfd; |
| 1222 bfd_vma entry; | 1219 bfd_vma entry; |
| 1223 char *filename; | 1220 char *filename; |
| 1224 int quiet; | 1221 int quiet; |
| 1225 int nostart; | 1222 int nostart; |
| 1226 struct timeval start_time, end_time; | 1223 struct timeval start_time, end_time; |
| 1227 unsigned long data_count; /* Number of bytes transferred to memory. */ | 1224 unsigned long data_count; /* Number of bytes transferred to memory. */ |
| 1228 int ret; | |
| 1229 static RETSIGTYPE (*prev_sigint) (); | 1225 static RETSIGTYPE (*prev_sigint) (); |
| 1230 | 1226 |
| 1231 /* for direct tcp connections, we can do a fast binary download. */ | 1227 /* for direct tcp connections, we can do a fast binary download. */ |
| 1232 quiet = 0; | 1228 quiet = 0; |
| 1233 nostart = 0; | 1229 nostart = 0; |
| 1234 filename = NULL; | 1230 filename = NULL; |
| 1235 | 1231 |
| 1236 while (*args != '\000') | 1232 while (*args != '\000') |
| 1237 { | 1233 { |
| 1238 char *arg; | 1234 char *arg; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 | 1693 |
| 1698 add_com ("use_ib_break", class_obscure, use_ib_breakpoints_command, | 1694 add_com ("use_ib_break", class_obscure, use_ib_breakpoints_command, |
| 1699 _("Set breakpoints by IB break.")); | 1695 _("Set breakpoints by IB break.")); |
| 1700 add_com ("use_dbt_break", class_obscure, use_dbt_breakpoints_command, | 1696 add_com ("use_dbt_break", class_obscure, use_dbt_breakpoints_command, |
| 1701 _("Set breakpoints by dbt.")); | 1697 _("Set breakpoints by dbt.")); |
| 1702 | 1698 |
| 1703 /* Yes, 42000 is arbitrary. The only sense out of it, is that it | 1699 /* Yes, 42000 is arbitrary. The only sense out of it, is that it |
| 1704 isn't 0. */ | 1700 isn't 0. */ |
| 1705 remote_m32r_ptid = ptid_build (42000, 0, 42000); | 1701 remote_m32r_ptid = ptid_build (42000, 0, 42000); |
| 1706 } | 1702 } |
| OLD | NEW |