home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / opcodes / disassemble.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-04  |  3.7 KB  |  164 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_arm
  25. #define ARCH_h8300
  26. #define ARCH_h8500
  27. #define ARCH_hppa
  28. #define ARCH_i386
  29. #define ARCH_i960
  30. #define ARCH_m68k
  31. #define ARCH_m88k
  32. #define ARCH_mips
  33. #define ARCH_ns32k
  34. #define ARCH_powerpc
  35. #define ARCH_rs6000
  36. #define ARCH_sh
  37. #define ARCH_sparc
  38. #define ARCH_w65
  39. #define ARCH_z8k
  40. #endif
  41.  
  42. disassembler_ftype
  43. disassembler (abfd)
  44.      bfd *abfd;
  45. {
  46.   enum bfd_architecture a = bfd_get_arch (abfd);
  47.   disassembler_ftype disassemble;
  48.  
  49.   switch (a)
  50.     {
  51.       /* If you add a case to this table, also add it to the
  52.      ARCH_all definition right above this function.  */
  53. #ifdef ARCH_a29k
  54.     case bfd_arch_a29k:
  55.       /* As far as I know we only handle big-endian 29k objects.  */
  56.       disassemble = print_insn_big_a29k;
  57.       break;
  58. #endif
  59. #ifdef ARCH_alpha
  60.     case bfd_arch_alpha:
  61.       disassemble = print_insn_alpha;
  62.       break;
  63. #endif
  64. #ifdef ARCH_arm
  65.     case bfd_arch_arm:
  66.       disassemble = print_insn_arm;
  67.       break;
  68. #endif
  69. #ifdef ARCH_h8300
  70.     case bfd_arch_h8300:
  71.       if (bfd_get_mach(abfd) == bfd_mach_h8300h)
  72.     disassemble = print_insn_h8300h;
  73.       else 
  74.     disassemble = print_insn_h8300;
  75.       break;
  76. #endif
  77. #ifdef ARCH_h8500
  78.     case bfd_arch_h8500:
  79.       disassemble = print_insn_h8500;
  80.       break;
  81. #endif
  82. #ifdef ARCH_hppa
  83.     case bfd_arch_hppa:
  84.       disassemble = print_insn_hppa;
  85.       break;
  86. #endif
  87. #ifdef ARCH_i386
  88.     case bfd_arch_i386:
  89.       disassemble = print_insn_i386;
  90.       break;
  91. #endif
  92. #ifdef ARCH_i960
  93.     case bfd_arch_i960:
  94.       disassemble = print_insn_i960;
  95.       break;
  96. #endif
  97. #ifdef ARCH_m68k
  98.     case bfd_arch_m68k:
  99.       disassemble = print_insn_m68k;
  100.       break;
  101. #endif
  102. #ifdef ARCH_m88k
  103.     case bfd_arch_m88k:
  104.       disassemble = print_insn_m88k;
  105.       break;
  106. #endif
  107. #ifdef ARCH_ns32k
  108.     case bfd_arch_ns32k:
  109.       disassemble = print_insn_ns32k;
  110.       break;
  111. #endif
  112. #ifdef ARCH_mips
  113.     case bfd_arch_mips:
  114.       if (abfd->xvec->byteorder_big_p)
  115.     disassemble = print_insn_big_mips;
  116.       else
  117.     disassemble = print_insn_little_mips;
  118.       break;
  119. #endif
  120. #ifdef ARCH_powerpc
  121.     case bfd_arch_powerpc:
  122.       if (abfd->xvec->byteorder_big_p)
  123.     disassemble = print_insn_big_powerpc;
  124.       else
  125.     disassemble = print_insn_little_powerpc;
  126.       break;
  127. #endif
  128. #ifdef ARCH_rs6000
  129.     case bfd_arch_rs6000:
  130.       disassemble = print_insn_rs6000;
  131.       break;
  132. #endif
  133. #ifdef ARCH_sh
  134.     case bfd_arch_sh:
  135.       if (abfd->xvec->byteorder_big_p)
  136.     disassemble = print_insn_sh;
  137.       else
  138.     disassemble = print_insn_shl;
  139.       break;
  140. #endif
  141. #ifdef ARCH_sparc
  142.     case bfd_arch_sparc:
  143.       disassemble = print_insn_sparc;
  144.       break;
  145. #endif
  146. #ifdef ARCH_w65
  147.     case bfd_arch_w65:
  148.       disassemble = print_insn_w65;
  149.       break;
  150. #endif
  151. #ifdef ARCH_z8k
  152.     case bfd_arch_z8k:
  153.       if (bfd_get_mach(abfd) == bfd_mach_z8001)
  154.     disassemble = print_insn_z8001;
  155.       else 
  156.     disassemble = print_insn_z8002;
  157.       break;
  158. #endif
  159.     default:
  160.       return 0;
  161.     }
  162.   return disassemble;
  163. }
  164.