2002-11-29 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / stack.c
index a37312602208afee5b30b0f191eac9ee8ebb4b39..999de6fde4c6acb0577b3d00fe3f796db730d165 100644 (file)
@@ -356,11 +356,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
      frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the next frame
      was not entered as the result of a call, and we want to get the
      line containing fi->pc.  */
-  sal =
-    find_pc_line (fi->pc,
-                 fi->next != NULL
-                 && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
-                 && !(get_frame_type (fi->next) == DUMMY_FRAME));
+  find_frame_sal (fi, &sal);
 
   location_print = (source == LOCATION 
                    || source == LOC_AND_ADDRESS
@@ -757,11 +753,10 @@ frame_info (char *addr_exp, int from_tty)
   if (fi == NULL)
     error ("Invalid frame specified.");
 
-  sal = find_pc_line (fi->pc,
-                     fi->next != NULL
-                     && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
-                     && !(get_frame_type (fi->next) == DUMMY_FRAME));
+  find_frame_sal (fi, &sal);
   func = get_frame_function (fi);
+  /* FIXME: cagney/2002-11-28: Why bother?  Won't sal.symtab contain
+     the same value.  */
   s = find_pc_symtab (fi->pc);
   if (func)
     {
@@ -858,7 +853,8 @@ frame_info (char *addr_exp, int from_tty)
   if (fi->next || calling_frame_info)
     puts_filtered ("\n");
   if (s)
-    printf_filtered (" source language %s.\n", language_str (s->language));
+    printf_filtered (" source language %s.\n",
+                    language_str (s->language));
 
 #ifdef PRINT_EXTRA_FRAME_INFO
   PRINT_EXTRA_FRAME_INFO (fi);
@@ -1543,8 +1539,22 @@ get_selected_block (CORE_ADDR *addr_in_block)
   if (!target_has_stack)
     return 0;
 
+  /* NOTE: cagney/2002-11-28: Why go to all this effort to not create
+     a selected/current frame?  Perhaphs this function is called,
+     indirectly, by WFI in "infrun.c" where avoiding the creation of
+     an inner most frame is very important (it slows down single
+     step).  I suspect, though that this was true in the deep dark
+     past but is no longer the case.  A mindless look at all the
+     callers tends to support this theory.  I think we should be able
+     to assume that there is always a selcted frame.  */
+  /* gdb_assert (selected_frame != NULL); So, do you feel lucky? */
   if (!selected_frame)
-    return get_current_block (addr_in_block);
+    {
+      CORE_ADDR pc = read_pc ();
+      if (addr_in_block != NULL)
+       *addr_in_block = pc;
+      return block_for_pc (pc);
+    }
   return get_frame_block (selected_frame, addr_in_block);
 }
 
@@ -1737,7 +1747,7 @@ return_command (char *retval_exp, int from_tty)
   if (selected_frame == NULL)
     error ("No selected frame.");
   thisfun = get_frame_function (selected_frame);
-  selected_frame_addr = FRAME_FP (selected_frame);
+  selected_frame_addr = get_frame_base (selected_frame);
   selected_frame_pc = selected_frame->pc;
 
   /* Compute the return value (if any -- possibly getting errors here).  */
@@ -1799,7 +1809,7 @@ return_command (char *retval_exp, int from_tty)
   /* If we are at the end of a call dummy now, pop the dummy frame too.  */
 
   if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (),
-                               FRAME_FP (get_current_frame ())))
+                               get_frame_base (get_current_frame ())))
     POP_FRAME;
 
   /* If interactive, print the frame that is now current.  */
This page took 0.024326 seconds and 4 git commands to generate.