* symtab.c (find_pc_symtab): Don't lose if OBJF_REORDERED
[deliverable/binutils-gdb.git] / gdb / h8300-tdep.c
index e139174128a88081dc3000130c6284336df125f0..954e25816349b455a68336fc3a90567062b52065 100644 (file)
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
  Contributed by Steve Chamberlain
@@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "frame.h"
 #include "obstack.h"
 #include "symtab.h"
-#include <dis-asm.h>
+#include "dis-asm.h"
 #include "gdbcmd.h"
 #include "gdbtypes.h"
 
@@ -98,16 +98,14 @@ h8300_skip_prologue (start_pc)
 }
 
 int
-print_insn (memaddr, stream)
-     CORE_ADDR memaddr;
-     FILE *stream;
+gdb_print_insn_h8300 (memaddr, info)
+     bfd_vma memaddr;
+     disassemble_info *info;
 {
-  disassemble_info info;
-  GDB_INIT_DISASSEMBLE_INFO(info, stream);
   if (h8300hmode)
-    return print_insn_h8300h (memaddr, &info);
+    return print_insn_h8300h (memaddr, info);
   else
-    return print_insn_h8300 (memaddr, &info);
+    return print_insn_h8300 (memaddr, info);
 }
 
 /* Given a GDB frame, determine the address of the calling function's frame.
@@ -117,9 +115,9 @@ print_insn (memaddr, stream)
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
 
-FRAME_ADDR
-FRAME_CHAIN (thisframe)
-     FRAME thisframe;
+CORE_ADDR
+h8300_frame_chain (thisframe)
+     struct frame_info *thisframe;
 {
   frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
   return thisframe->fsr->regs[SP_REGNUM];
@@ -208,7 +206,7 @@ static CORE_ADDR
 examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
      register CORE_ADDR ip;
      register CORE_ADDR limit;
-     FRAME_ADDR after_prolog_fp;
+     CORE_ADDR after_prolog_fp;
      struct frame_saved_regs *fsr;
      struct frame_info *fi;
 {
@@ -331,7 +329,7 @@ init_extra_frame_info (fromleaf, fi)
 
 CORE_ADDR
 frame_saved_pc (frame)
-     FRAME frame;
+     struct frame_info *frame;
 {
   return frame->from_pc;
 }
@@ -373,23 +371,16 @@ h8300_pop_frame ()
 {
   unsigned regnum;
   struct frame_saved_regs fsr;
-  struct frame_info *fi;
-
-  FRAME frame = get_current_frame ();
+  struct frame_info *frame = get_current_frame ();
 
-  fi = get_frame_info (frame);
-  get_frame_saved_regs (fi, &fsr);
+  get_frame_saved_regs (frame, &fsr);
 
   for (regnum = 0; regnum < 8; regnum++)
     {
       if (fsr.regs[regnum])
-       {
-         write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
-       }
+       write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
 
       flush_cached_frames ();
-      set_current_frame (create_new_frame (read_register (FP_REGNUM),
-                                          read_pc ()));
     }
 }
 
@@ -415,8 +406,8 @@ set_machine (args, from_tty)
      char *args;
      int from_tty;
 {
-  printf ("\"set machine\" must be followed by h8300 or h8300h.\n");
-  help_list (setmemorylist, "set memory ", -1, stdout);
+  printf_unfiltered ("\"set machine\" must be followed by h8300 or h8300h.\n");
+  help_list (setmemorylist, "set memory ", -1, gdb_stdout);
 }
 
 void
@@ -441,55 +432,47 @@ print_register_hook (regno)
   if (regno == 8)
     {
       /* CCR register */
-
       int C, Z, N, V;
-      unsigned char b[2];
+      unsigned char b[4];
       unsigned char l;
-
       read_relative_register_raw_bytes (regno, b);
-      l = b[1];
-      printf ("\t");
-      printf ("I-%d - ", (l & 0x80) != 0);
-      printf ("H-%d - ", (l & 0x20) != 0);
+      l = b[REGISTER_VIRTUAL_SIZE(8) -1];
+      printf_unfiltered ("\t");
+      printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
+      printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
       N = (l & 0x8) != 0;
       Z = (l & 0x4) != 0;
       V = (l & 0x2) != 0;
       C = (l & 0x1) != 0;
-      printf ("N-%d ", N);
-      printf ("Z-%d ", Z);
-      printf ("V-%d ", V);
-      printf ("C-%d ", C);
+      printf_unfiltered ("N-%d ", N);
+      printf_unfiltered ("Z-%d ", Z);
+      printf_unfiltered ("V-%d ", V);
+      printf_unfiltered ("C-%d ", C);
       if ((C | Z) == 0)
-       printf ("u> ");
+       printf_unfiltered ("u> ");
       if ((C | Z) == 1)
-       printf ("u<= ");
+       printf_unfiltered ("u<= ");
       if ((C == 0))
-       printf ("u>= ");
+       printf_unfiltered ("u>= ");
       if (C == 1)
-       printf ("u< ");
+       printf_unfiltered ("u< ");
       if (Z == 0)
-       printf ("!= ");
+       printf_unfiltered ("!= ");
       if (Z == 1)
-       printf ("== ");
+       printf_unfiltered ("== ");
       if ((N ^ V) == 0)
-       printf (">= ");
+       printf_unfiltered (">= ");
       if ((N ^ V) == 1)
-       printf ("< ");
+       printf_unfiltered ("< ");
       if ((Z | (N ^ V)) == 0)
-       printf ("> ");
+       printf_unfiltered ("> ");
       if ((Z | (N ^ V)) == 1)
-       printf ("<= ");
+       printf_unfiltered ("<= ");
     }
 }
 
-/* This doesn't quite fit either in the simulator or in gdb proper.
-   Perhaps the simulator could return 1 to mean it loaded it and 0 to
-   mean "you deal with it, caller".  */
-
-int 
-sim_load (abfd, prog)
-bfd *abfd;
-char *prog;
+void
+_initialize_h8300_tdep ()
 {
-  return sim_load_standard (abfd); 
+  tm_print_insn = gdb_print_insn_h8300;
 }
This page took 0.029177 seconds and 4 git commands to generate.