* win32-nat.c (child_attach): Reset saw_create counter or subsequent attach
[deliverable/binutils-gdb.git] / gdb / avr-tdep.c
index 71c7796443fb4c1446d34b4f819c40925de2b038..284a3965757a07e4118a0a36a698626061de80fe 100644 (file)
@@ -31,6 +31,7 @@
 #include "symfile.h"
 #include "arch-utils.h"
 #include "regcache.h"
+#include "gdb_string.h"
 
 /* AVR Background:
 
@@ -158,7 +159,7 @@ struct gdbarch_tdep
 
 /* Lookup the name of a register given it's number. */
 
-static char *
+static const char *
 avr_register_name (int regnum)
 {
   static char *register_names[] = {
@@ -523,7 +524,6 @@ avr_scan_prologue (struct frame_info *fi)
                {
                  fi->frame = locals;
 
-                 /* TRoth: Does -1 mean we're in main? */
                  fi->extra_info->is_main = 1;
                  return;
                }
@@ -754,7 +754,8 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi)
     {
       /* We need to setup fi->frame here because run_stack_dummy gets it wrong
          by assuming it's always FP.  */
-      fi->frame = generic_read_register_dummy (fi->pc, fi->frame, fi->frame);
+      fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
+                                                 AVR_PC_REGNUM);
     }
   else if (!fi->next)          /* this is the innermost frame? */
     fi->frame = read_register (fi->extra_info->framereg);
@@ -866,8 +867,8 @@ static CORE_ADDR
 avr_frame_saved_pc (struct frame_info *frame)
 {
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
-    return generic_read_register_dummy (frame->pc, frame->frame,
-                                       AVR_PC_REGNUM);
+    return deprecated_read_register_dummy (frame->pc, frame->frame,
+                                          AVR_PC_REGNUM);
   else
     return frame->extra_info->return_pc;
 }
@@ -956,10 +957,10 @@ avr_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   unsigned char buf[2];
   int wordsize = 2;
+#if 0
   struct minimal_symbol *msymbol;
   CORE_ADDR mon_brk;
-
-  fprintf_unfiltered (gdb_stderr, "avr_push_return_address() was called\n");
+#endif
 
   buf[0] = 0;
   buf[1] = 0;
@@ -995,7 +996,14 @@ avr_skip_prologue (CORE_ADDR pc)
     {
       sal = find_pc_line (func_addr, 0);
 
-      if (sal.line != 0 && sal.end < func_end)
+      /* troth/2002-08-05: For some very simple functions, gcc doesn't
+         generate a prologue and the sal.end ends up being the 2-byte ``ret''
+         instruction at the end of the function, but func_end ends up being
+         the address of the first instruction of the _next_ function. By
+         adjusting func_end by 2 bytes, we can catch these functions and not
+         return sal.end if it is the ``ret'' instruction. */
+
+      if (sal.line != 0 && sal.end < (func_end-2))
        return sal.end;
     }
 
@@ -1025,10 +1033,9 @@ avr_frame_chain (struct frame_info *frame)
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     {
       /* initialize the return_pc now */
-      frame->extra_info->return_pc = generic_read_register_dummy (frame->pc,
-                                                                 frame->
-                                                                 frame,
-                                                                 AVR_PC_REGNUM);
+      frame->extra_info->return_pc
+       = deprecated_read_register_dummy (frame->pc, frame->frame,
+                                         AVR_PC_REGNUM);
       return frame->frame;
     }
   return (frame->extra_info->is_main ? 0
@@ -1208,9 +1215,6 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type);
 
-  /* We might need to define our own here or define FRAME_INIT_SAVED_REGS */
-  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
-
   set_gdbarch_print_insn (gdbarch, print_insn_avr);
 
   set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
@@ -1230,18 +1234,18 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
   set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
-  set_gdbarch_extract_return_value (gdbarch, avr_extract_return_value);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
   set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
-/*    set_gdbarch_push_return_address (gdbarch, avr_push_return_address); */
+  set_gdbarch_push_return_address (gdbarch, avr_push_return_address);
   set_gdbarch_pop_frame (gdbarch, avr_pop_frame);
 
-  set_gdbarch_store_return_value (gdbarch, avr_store_return_value);
+  set_gdbarch_deprecated_store_return_value (gdbarch, avr_store_return_value);
 
   set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
   set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return);
-  set_gdbarch_extract_struct_value_address (gdbarch,
-                                           avr_extract_struct_value_address);
+  set_gdbarch_deprecated_extract_struct_value_address
+    (gdbarch, avr_extract_struct_value_address);
 
   set_gdbarch_frame_init_saved_regs (gdbarch, avr_scan_prologue);
   set_gdbarch_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
This page took 0.035411 seconds and 4 git commands to generate.