ARI fix: OP eol rule.
[deliverable/binutils-gdb.git] / gdb / blockframe.c
index f6565e545ea9a160505db124e89c20ecbec71cf0..f3d631108a47b9d404307c3ac02c15c624273500 100644 (file)
@@ -36,6 +36,7 @@
 #include "command.h"
 #include "gdbcmd.h"
 #include "block.h"
+#include "inline-frame.h"
 
 /* Prototypes for exported functions. */
 
@@ -61,11 +62,29 @@ struct block *
 get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block)
 {
   const CORE_ADDR pc = get_frame_address_in_block (frame);
+  struct frame_info *next_frame;
+  struct block *bl;
+  int inline_count;
 
   if (addr_in_block)
     *addr_in_block = pc;
 
-  return block_for_pc (pc);
+  bl = block_for_pc (pc);
+  if (bl == NULL)
+    return NULL;
+
+  inline_count = frame_inlined_callees (frame);
+
+  while (inline_count > 0)
+    {
+      if (block_inlined_p (bl))
+       inline_count--;
+
+      bl = BLOCK_SUPERBLOCK (bl);
+      gdb_assert (bl != NULL);
+    }
+
+  return bl;
 }
 
 CORE_ADDR
@@ -104,9 +123,14 @@ struct symbol *
 get_frame_function (struct frame_info *frame)
 {
   struct block *bl = get_frame_block (frame, 0);
-  if (bl == 0)
-    return 0;
-  return block_linkage_function (bl);
+
+  if (bl == NULL)
+    return NULL;
+
+  while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
+    bl = BLOCK_SUPERBLOCK (bl);
+
+  return BLOCK_FUNCTION (bl);
 }
 \f
 
@@ -229,9 +253,9 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
          psb = find_pc_sect_psymbol (pst, mapped_pc, section);
 
          if (psb
-             && (msymbol == NULL ||
-                 (SYMBOL_VALUE_ADDRESS (psb)
-                  >= SYMBOL_VALUE_ADDRESS (msymbol))))
+             && (msymbol == NULL
+                 || (SYMBOL_VALUE_ADDRESS (psb)
+                     >= SYMBOL_VALUE_ADDRESS (msymbol))))
            {
              /* This case isn't being cached currently. */
              if (address)
@@ -339,7 +363,6 @@ block_innermost_frame (struct block *block)
   struct frame_info *frame;
   CORE_ADDR start;
   CORE_ADDR end;
-  CORE_ADDR calling_pc;
 
   if (block == NULL)
     return NULL;
@@ -350,8 +373,8 @@ block_innermost_frame (struct block *block)
   frame = get_current_frame ();
   while (frame != NULL)
     {
-      calling_pc = get_frame_address_in_block (frame);
-      if (calling_pc >= start && calling_pc < end)
+      struct block *frame_block = get_frame_block (frame, NULL);
+      if (frame_block != NULL && contained_in (frame_block, block))
        return frame;
 
       frame = get_prev_frame (frame);
This page took 0.025142 seconds and 4 git commands to generate.