OLD | NEW |
1 /* gdb.c --- sim interface to GDB. | 1 /* gdb.c --- sim interface to GDB. |
2 | 2 |
3 Copyright (C) 2005, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2005, 2007-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 |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 GNU General Public License for more details. | 16 GNU General Public License for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | 20 |
21 | 21 #include "config.h" |
22 #include <stdio.h> | 22 #include <stdio.h> |
23 #include <assert.h> | 23 #include <assert.h> |
24 #include <signal.h> | 24 #include <signal.h> |
25 #include <string.h> | 25 #include <string.h> |
26 #include <ctype.h> | 26 #include <ctype.h> |
27 | 27 |
28 #include "ansidecl.h" | 28 #include "ansidecl.h" |
29 #include "gdb/callback.h" | 29 #include "gdb/callback.h" |
30 #include "gdb/remote-sim.h" | 30 #include "gdb/remote-sim.h" |
31 #include "gdb/signals.h" | 31 #include "gdb/signals.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 523 |
524 | 524 |
525 /* Given a signal number used by the M32C bsp (that is, newlib), | 525 /* Given a signal number used by the M32C bsp (that is, newlib), |
526 return a target signal number used by GDB. */ | 526 return a target signal number used by GDB. */ |
527 int | 527 int |
528 m32c_signal_to_target (int m32c) | 528 m32c_signal_to_target (int m32c) |
529 { | 529 { |
530 switch (m32c) | 530 switch (m32c) |
531 { | 531 { |
532 case 4: | 532 case 4: |
533 return TARGET_SIGNAL_ILL; | 533 return GDB_SIGNAL_ILL; |
534 | 534 |
535 case 5: | 535 case 5: |
536 return TARGET_SIGNAL_TRAP; | 536 return GDB_SIGNAL_TRAP; |
537 | 537 |
538 case 10: | 538 case 10: |
539 return TARGET_SIGNAL_BUS; | 539 return GDB_SIGNAL_BUS; |
540 | 540 |
541 case 11: | 541 case 11: |
542 return TARGET_SIGNAL_SEGV; | 542 return GDB_SIGNAL_SEGV; |
543 | 543 |
544 case 24: | 544 case 24: |
545 return TARGET_SIGNAL_XCPU; | 545 return GDB_SIGNAL_XCPU; |
546 | 546 |
547 case 2: | 547 case 2: |
548 return TARGET_SIGNAL_INT; | 548 return GDB_SIGNAL_INT; |
549 | 549 |
550 case 8: | 550 case 8: |
551 return TARGET_SIGNAL_FPE; | 551 return GDB_SIGNAL_FPE; |
552 | 552 |
553 case 6: | 553 case 6: |
554 return TARGET_SIGNAL_ABRT; | 554 return GDB_SIGNAL_ABRT; |
555 } | 555 } |
556 | 556 |
557 return 0; | 557 return 0; |
558 } | 558 } |
559 | 559 |
560 | 560 |
561 /* Take a step return code RC and set up the variables consulted by | 561 /* Take a step return code RC and set up the variables consulted by |
562 sim_stop_reason appropriately. */ | 562 sim_stop_reason appropriately. */ |
563 void | 563 void |
564 handle_step (int rc) | 564 handle_step (int rc) |
565 { | 565 { |
566 if (M32C_STEPPED (rc) || M32C_HIT_BREAK (rc)) | 566 if (M32C_STEPPED (rc) || M32C_HIT_BREAK (rc)) |
567 { | 567 { |
568 reason = sim_stopped; | 568 reason = sim_stopped; |
569 siggnal = TARGET_SIGNAL_TRAP; | 569 siggnal = GDB_SIGNAL_TRAP; |
570 } | 570 } |
571 else if (M32C_STOPPED (rc)) | 571 else if (M32C_STOPPED (rc)) |
572 { | 572 { |
573 reason = sim_stopped; | 573 reason = sim_stopped; |
574 siggnal = m32c_signal_to_target (M32C_STOP_SIG (rc)); | 574 siggnal = m32c_signal_to_target (M32C_STOP_SIG (rc)); |
575 } | 575 } |
576 else | 576 else |
577 { | 577 { |
578 assert (M32C_EXITED (rc)); | 578 assert (M32C_EXITED (rc)); |
579 reason = sim_exited; | 579 reason = sim_exited; |
(...skipping 26 matching lines...) Expand all Loading... |
606 /* We don't clear 'stop' here, because then we would miss | 606 /* We don't clear 'stop' here, because then we would miss |
607 interrupts that arrived on the way here. Instead, we clear | 607 interrupts that arrived on the way here. Instead, we clear |
608 the flag in sim_stop_reason, after GDB has disabled the | 608 the flag in sim_stop_reason, after GDB has disabled the |
609 interrupt signal handler. */ | 609 interrupt signal handler. */ |
610 for (;;) | 610 for (;;) |
611 { | 611 { |
612 if (stop) | 612 if (stop) |
613 { | 613 { |
614 stop = 0; | 614 stop = 0; |
615 reason = sim_stopped; | 615 reason = sim_stopped; |
616 » siggnal = TARGET_SIGNAL_INT; | 616 » siggnal = GDB_SIGNAL_INT; |
617 break; | 617 break; |
618 } | 618 } |
619 | 619 |
620 int rc = decode_opcode (); | 620 int rc = decode_opcode (); |
621 #ifdef TIMER_A | 621 #ifdef TIMER_A |
622 update_timer_a (); | 622 update_timer_a (); |
623 #endif | 623 #endif |
624 | 624 |
625 if (!M32C_STEPPED (rc)) | 625 if (!M32C_STEPPED (rc)) |
626 { | 626 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 else | 701 else |
702 printf ("The 'sim' command expects either 'trace' or 'verbose'" | 702 printf ("The 'sim' command expects either 'trace' or 'verbose'" |
703 " as a subcommand.\n"); | 703 " as a subcommand.\n"); |
704 } | 704 } |
705 | 705 |
706 char ** | 706 char ** |
707 sim_complete_command (SIM_DESC sd, char *text, char *word) | 707 sim_complete_command (SIM_DESC sd, char *text, char *word) |
708 { | 708 { |
709 return NULL; | 709 return NULL; |
710 } | 710 } |
OLD | NEW |