home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / opcodes / disassemble.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-13  |  3.4 KB  |  149 lines

  1. /* Select disassembly routine for specified architecture.
  2.    Copyright 1994 Free Software Foundation, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #include "ansidecl.h"
  19. #include "dis-asm.h"
  20.  
  21. #ifdef ARCH_all
  22. #define ARCH_a29k
  23. #define ARCH_alpha
  24. #define ARCH_h8300
  25. #define ARCH_h8500
  26. #define ARCH_hppa
  27. #define ARCH_i386
  28. #define ARCH_i960
  29. #define ARCH_m68k
  30. #define ARCH_m88k
  31. #define ARCH_mips
  32. #define ARCH_ns32k
  33. #define ARCH_powerpc
  34. #define ARCH_rs6000
  35. #define ARCH_sh
  36. #define ARCH_sparc
  37. #define ARCH_z8k
  38. #endif
  39.  
  40. disassembler_ftype
  41. disassembler (abfd)
  42.      bfd *abfd;
  43. {
  44.   enum bfd_architecture a = bfd_get_arch (abfd);
  45.   disassembler_ftype disassemble;
  46.  
  47.   switch (a)
  48.     {
  49.       /* If you add a case to this table, also add it to the
  50.      ARCH_all definition right above this function.  */
  51. #ifdef ARCH_a29k
  52.     case bfd_arch_a29k:
  53.       /* As far as I know we only handle big-endian 29k objects.  */
  54.       disassemble = print_insn_big_a29k;
  55.       break;
  56. #endif
  57. #ifdef ARCH_alpha
  58.     case bfd_arch_alpha:
  59.       disassemble = print_insn_alpha;
  60.       break;
  61. #endif
  62. #ifdef ARCH_h8300
  63.     case bfd_arch_h8300:
  64.       if (bfd_get_mach(abfd) == bfd_mach_h8300h)
  65.     disassemble = print_insn_h8300h;
  66.       else 
  67.     disassemble = print_insn_h8300;
  68.       break;
  69. #endif
  70. #ifdef ARCH_h8500
  71.     case bfd_arch_h8500:
  72.       disassemble = print_insn_h8500;
  73.       break;
  74. #endif
  75. #ifdef ARCH_hppa
  76.     case bfd_arch_hppa:
  77.       disassemble = print_insn_hppa;
  78.       break;
  79. #endif
  80. #ifdef ARCH_i386
  81.     case bfd_arch_i386:
  82.       disassemble = print_insn_i386;
  83.       break;
  84. #endif
  85. #ifdef ARCH_i960
  86.     case bfd_arch_i960:
  87.       disassemble = print_insn_i960;
  88.       break;
  89. #endif
  90. #ifdef ARCH_m68k
  91.     case bfd_arch_m68k:
  92.       disassemble = print_insn_m68k;
  93.       break;
  94. #endif
  95. #ifdef ARCH_m88k
  96.     case bfd_arch_m88k:
  97.       disassemble = print_insn_m88k;
  98.       break;
  99. #endif
  100. #ifdef ARCH_ns32k
  101.     case bfd_arch_ns32k:
  102.       disassemble = print_insn_ns32k;
  103.       break;
  104. #endif
  105. #ifdef ARCH_mips
  106.     case bfd_arch_mips:
  107.       if (abfd->xvec->byteorder_big_p)
  108.     disassemble = print_insn_big_mips;
  109.       else
  110.     disassemble = print_insn_little_mips;
  111.       break;
  112. #endif
  113. #ifdef ARCH_powerpc
  114.     case bfd_arch_powerpc:
  115.       if (abfd->xvec->byteorder_big_p)
  116.     disassemble = print_insn_big_powerpc;
  117.       else
  118.     disassemble = print_insn_little_powerpc;
  119.       break;
  120. #endif
  121. #ifdef ARCH_rs6000
  122.     case bfd_arch_rs6000:
  123.       disassemble = print_insn_rs6000;
  124.       break;
  125. #endif
  126. #ifdef ARCH_sh
  127.     case bfd_arch_sh:
  128.       disassemble = print_insn_sh;
  129.       break;
  130. #endif
  131. #ifdef ARCH_sparc
  132.     case bfd_arch_sparc:
  133.       disassemble = print_insn_sparc;
  134.       break;
  135. #endif
  136. #ifdef ARCH_z8k
  137.     case bfd_arch_z8k:
  138.       if (bfd_get_mach(abfd) == bfd_mach_z8001)
  139.     disassemble = print_insn_z8001;
  140.       else 
  141.     disassemble = print_insn_z8002;
  142.       break;
  143. #endif
  144.     default:
  145.       return 0;
  146.     }
  147.   return disassemble;
  148. }
  149.