OLD | NEW |
1 /* gdb-if.c -- sim interface to GDB. | 1 /* gdb-if.c -- sim interface to GDB. |
2 | 2 |
3 Copyright (C) 2008-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2008-2012 Free Software Foundation, Inc. |
4 Contributed by Red Hat, Inc. | 4 Contributed by Red Hat, Inc. |
5 | 5 |
6 This file is part of the GNU simulators. | 6 This file is part of the GNU simulators. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 SIM_RC | 194 SIM_RC |
195 sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty) | 195 sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty) |
196 { | 196 { |
197 check_desc (sd); | 197 check_desc (sd); |
198 | 198 |
199 if (!abfd) | 199 if (!abfd) |
200 abfd = open_objfile (prog); | 200 abfd = open_objfile (prog); |
201 if (!abfd) | 201 if (!abfd) |
202 return SIM_RC_FAIL; | 202 return SIM_RC_FAIL; |
203 | 203 |
204 rx_load (abfd); | 204 rx_load (abfd, get_callbacks ()); |
205 build_swap_list (abfd); | 205 build_swap_list (abfd); |
206 | 206 |
207 return SIM_RC_OK; | 207 return SIM_RC_OK; |
208 } | 208 } |
209 | 209 |
210 SIM_RC | 210 SIM_RC |
211 sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env) | 211 sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env) |
212 { | 212 { |
213 check_desc (sd); | 213 check_desc (sd); |
214 | 214 |
215 if (abfd) | 215 if (abfd) |
216 { | 216 { |
217 rx_load (abfd); | 217 rx_load (abfd, NULL); |
218 build_swap_list (abfd); | 218 build_swap_list (abfd); |
219 } | 219 } |
220 | 220 |
221 return SIM_RC_OK; | 221 return SIM_RC_OK; |
222 } | 222 } |
223 | 223 |
224 int | 224 int |
225 sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) | 225 sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) |
226 { | 226 { |
227 int i; | 227 int i; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 703 |
704 | 704 |
705 /* Take a step return code RC and set up the variables consulted by | 705 /* Take a step return code RC and set up the variables consulted by |
706 sim_stop_reason appropriately. */ | 706 sim_stop_reason appropriately. */ |
707 void | 707 void |
708 handle_step (int rc) | 708 handle_step (int rc) |
709 { | 709 { |
710 if (execution_error_get_last_error () != SIM_ERR_NONE) | 710 if (execution_error_get_last_error () != SIM_ERR_NONE) |
711 { | 711 { |
712 reason = sim_stopped; | 712 reason = sim_stopped; |
713 siggnal = TARGET_SIGNAL_SEGV; | 713 siggnal = GDB_SIGNAL_SEGV; |
714 } | 714 } |
715 if (RX_STEPPED (rc) || RX_HIT_BREAK (rc)) | 715 if (RX_STEPPED (rc) || RX_HIT_BREAK (rc)) |
716 { | 716 { |
717 reason = sim_stopped; | 717 reason = sim_stopped; |
718 siggnal = TARGET_SIGNAL_TRAP; | 718 siggnal = GDB_SIGNAL_TRAP; |
719 } | 719 } |
720 else if (RX_STOPPED (rc)) | 720 else if (RX_STOPPED (rc)) |
721 { | 721 { |
722 reason = sim_stopped; | 722 reason = sim_stopped; |
723 siggnal = rx_signal_to_host (RX_STOP_SIG (rc)); | 723 siggnal = rx_signal_to_host (RX_STOP_SIG (rc)); |
724 } | 724 } |
725 else | 725 else |
726 { | 726 { |
727 assert (RX_EXITED (rc)); | 727 assert (RX_EXITED (rc)); |
728 reason = sim_exited; | 728 reason = sim_exited; |
(...skipping 30 matching lines...) Expand all Loading... |
759 /* We don't clear 'stop' here, because then we would miss | 759 /* We don't clear 'stop' here, because then we would miss |
760 interrupts that arrived on the way here. Instead, we clear | 760 interrupts that arrived on the way here. Instead, we clear |
761 the flag in sim_stop_reason, after GDB has disabled the | 761 the flag in sim_stop_reason, after GDB has disabled the |
762 interrupt signal handler. */ | 762 interrupt signal handler. */ |
763 for (;;) | 763 for (;;) |
764 { | 764 { |
765 if (stop) | 765 if (stop) |
766 { | 766 { |
767 stop = 0; | 767 stop = 0; |
768 reason = sim_stopped; | 768 reason = sim_stopped; |
769 » siggnal = TARGET_SIGNAL_INT; | 769 » siggnal = GDB_SIGNAL_INT; |
770 break; | 770 break; |
771 } | 771 } |
772 | 772 |
773 rc = setjmp (decode_jmp_buf); | 773 rc = setjmp (decode_jmp_buf); |
774 if (rc == 0) | 774 if (rc == 0) |
775 rc = decode_opcode (); | 775 rc = decode_opcode (); |
776 | 776 |
777 if (execution_error_get_last_error () != SIM_ERR_NONE) | 777 if (execution_error_get_last_error () != SIM_ERR_NONE) |
778 { | 778 { |
779 reason = sim_stopped; | 779 reason = sim_stopped; |
780 » siggnal = TARGET_SIGNAL_SEGV; | 780 » siggnal = GDB_SIGNAL_SEGV; |
781 break; | 781 break; |
782 } | 782 } |
783 | 783 |
784 if (!RX_STEPPED (rc)) | 784 if (!RX_STEPPED (rc)) |
785 { | 785 { |
786 handle_step (rc); | 786 handle_step (rc); |
787 break; | 787 break; |
788 } | 788 } |
789 } | 789 } |
790 } | 790 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 else | 861 else |
862 printf ("The 'sim' command expects either 'trace' or 'verbose'" | 862 printf ("The 'sim' command expects either 'trace' or 'verbose'" |
863 " as a subcommand.\n"); | 863 " as a subcommand.\n"); |
864 } | 864 } |
865 | 865 |
866 char ** | 866 char ** |
867 sim_complete_command (SIM_DESC sd, char *text, char *word) | 867 sim_complete_command (SIM_DESC sd, char *text, char *word) |
868 { | 868 { |
869 return NULL; | 869 return NULL; |
870 } | 870 } |
OLD | NEW |