PARAMS elimination.
[deliverable/binutils-gdb.git] / gdb / blockframe.c
index 6b8e83ba82b6a65b851663a2885f1f57470a0cd8..ccc80dbbd3f5d007e31fb42a6716ed92cf1130ce 100644 (file)
 
 /* Prototypes for exported functions. */
 
-void _initialize_blockframe PARAMS ((void));
+void _initialize_blockframe (void);
 
 /* A default FRAME_CHAIN_VALID, in the form that is suitable for most
    targets.  If FRAME_CHAIN_VALID returns zero it means that the given
    frame is the outermost one and has no caller. */
 
 int
-default_frame_chain_valid (chain, thisframe)
+file_frame_chain_valid (chain, thisframe)
      CORE_ADDR chain;
      struct frame_info *thisframe;
 {
   return ((chain) != 0
-         && !inside_main_func ((thisframe)->pc)
-         && !inside_entry_func ((thisframe)->pc));
+         && !inside_entry_file (FRAME_SAVED_PC (thisframe)));
 }
 
 /* Use the alternate method of avoiding running up off the end of the
@@ -55,12 +54,13 @@ default_frame_chain_valid (chain, thisframe)
    the comments in objfiles.h. */
 
 int
-alternate_frame_chain_valid (chain, thisframe)
+func_frame_chain_valid (chain, thisframe)
      CORE_ADDR chain;
      struct frame_info *thisframe;
 {
   return ((chain) != 0
-         && !inside_entry_file (FRAME_SAVED_PC (thisframe)));
+         && !inside_main_func ((thisframe)->pc)
+         && !inside_entry_func ((thisframe)->pc));
 }
 
 /* A very simple method of determining a valid frame */
@@ -286,11 +286,6 @@ reinit_frame_cache ()
     }
 }
 
-/* If a machine allows frameless functions, it should define a macro
-   FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) in param.h.  FI is the struct
-   frame_info for the frame, and FRAMELESS should be set to nonzero
-   if it represents a frameless function invocation.  */
-
 /* Return nonzero if the function for this frame lacks a prologue.  Many
    machines can define FRAMELESS_FUNCTION_INVOCATION to just call this
    function.  */
@@ -300,25 +295,20 @@ frameless_look_for_prologue (frame)
      struct frame_info *frame;
 {
   CORE_ADDR func_start, after_prologue;
+
   func_start = get_pc_function_start (frame->pc);
   if (func_start)
     {
       func_start += FUNCTION_START_OFFSET;
-      after_prologue = func_start;
-#ifdef SKIP_PROLOGUE_FRAMELESS_P
-      /* This is faster, since only care whether there *is* a prologue,
-         not how long it is.  */
-      after_prologue = SKIP_PROLOGUE_FRAMELESS_P (after_prologue);
-#else
-      after_prologue = SKIP_PROLOGUE (after_prologue);
-#endif
-      return after_prologue == func_start;
+      /* This is faster, since only care whether there *is* a
+         prologue, not how long it is.  */
+      return PROLOGUE_FRAMELESS_P (func_start);
     }
   else if (frame->pc == 0)
-    /* A frame with a zero PC is usually created by dereferencing a NULL
-       function pointer, normally causing an immediate core dump of the
-       inferior. Mark function as frameless, as the inferior has no chance
-       of setting up a stack frame.  */
+    /* A frame with a zero PC is usually created by dereferencing a
+       NULL function pointer, normally causing an immediate core dump
+       of the inferior. Mark function as frameless, as the inferior
+       has no chance of setting up a stack frame.  */
     return 1;
   else
     /* If we can't find the start of the function, we don't really
@@ -1108,12 +1098,12 @@ pc_in_call_dummy_at_entry_point (pc, sp, frame_address)
  * zero, and CALL_DUMMY_LOCATION to AT_ENTRY.  Then you must remember
  * to define PUSH_RETURN_ADDRESS, because no call instruction will be
  * being executed by the target.  Also FRAME_CHAIN_VALID as
- * generic_frame_chain_valid and FIX_CALL_DUMMY as
+ * generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as
  * generic_fix_call_dummy.  */
 
 /* Dummy frame.  This saves the processor state just prior to setting
    up the inferior function call.  Older targets save the registers
-   target stack (but that really slows down function calls).  */
+   on the target stack (but that really slows down function calls).  */
 
 struct dummy_frame
 {
@@ -1217,8 +1207,8 @@ generic_push_dummy_frame ()
   dummy_frame = xmalloc (sizeof (struct dummy_frame));
   dummy_frame->registers = xmalloc (REGISTER_BYTES);
 
-  dummy_frame->pc = read_register (PC_REGNUM);
-  dummy_frame->sp = read_register (SP_REGNUM);
+  dummy_frame->pc = read_pc ();
+  dummy_frame->sp = read_sp ();
   dummy_frame->top = dummy_frame->sp;
   dummy_frame->fp = fp;
   read_register_bytes (0, dummy_frame->registers, REGISTER_BYTES);
@@ -1233,19 +1223,18 @@ generic_save_dummy_frame_tos (sp)
   dummy_frame_stack->top = sp;
 }
 
-/* Function: pop_frame
-   Restore the machine state from either the saved dummy stack or a
+/* Restore the machine state from either the saved dummy stack or a
    real stack frame. */
 
 void
-generic_pop_current_frame (pop)
-     void (*pop) PARAMS ((struct frame_info * frame));
+generic_pop_current_frame (void (*popper) (struct frame_info * frame))
 {
   struct frame_info *frame = get_current_frame ();
+
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     generic_pop_dummy_frame ();
   else
-    pop (frame);
+    (*popper) (frame);
 }
 
 /* Function: pop_dummy_frame
@@ -1274,7 +1263,7 @@ generic_pop_dummy_frame ()
    and false for the CRT0 start-up frame.  Purpose is to terminate backtrace */
 
 int
-generic_frame_chain_valid (fp, fi)
+generic_file_frame_chain_valid (fp, fi)
      CORE_ADDR fp;
      struct frame_info *fi;
 {
@@ -1286,6 +1275,20 @@ generic_frame_chain_valid (fp, fi)
            && !inside_entry_file (FRAME_SAVED_PC (fi)));
 }
 
+int
+generic_func_frame_chain_valid (fp, fi)
+     CORE_ADDR fp;
+     struct frame_info *fi;
+{
+  if (PC_IN_CALL_DUMMY ((fi)->pc, fp, fp))
+    return 1;                  /* don't prune CALL_DUMMY frames */
+  else                         /* fall back to default algorithm (see frame.h) */
+    return (fp != 0
+           && (INNER_THAN (fi->frame, fp) || fi->frame == fp)
+           && !inside_main_func ((fi)->pc)
+           && !inside_entry_func ((fi)->pc));
+}
+
 /* Function: fix_call_dummy
    Stub function.  Generic dumy frames typically do not need to fix
    the frame being created */
@@ -1401,7 +1404,7 @@ generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
 }
 
 void
-_initialize_blockframe ()
+_initialize_blockframe (void)
 {
   obstack_init (&frame_cache_obstack);
 }
This page took 0.026514 seconds and 4 git commands to generate.