Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / inline-frame.c
index 896b0004e4a381c24cb9042841d80dd6b5813d3f..2ba57b06dfdc9e68deea938858847b400e4b1377 100644 (file)
@@ -1,6 +1,7 @@
 /* Inline frame unwinder for GDB.
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
 
    This file is part of GDB.
 
@@ -27,7 +28,6 @@
 #include "gdbthread.h"
 #include "regcache.h"
 #include "symtab.h"
-#include "vec.h"
 #include "frame.h"
 #include <algorithm>
 
@@ -155,17 +155,13 @@ inline_frame_this_id (struct frame_info *this_frame,
      frame").  This will take work.  */
   gdb_assert (frame_id_p (*this_id));
 
-  /* For now, require we don't match outer_frame_id either (see
-     comment above).  */
-  gdb_assert (!frame_id_eq (*this_id, outer_frame_id));
-
   /* Future work NOTE: Alexandre Oliva applied a patch to GCC 4.3
      which generates DW_AT_entry_pc for inlined functions when
      possible.  If this attribute is available, we should use it
      in the frame ID (and eventually, to set breakpoints).  */
   func = get_frame_function (this_frame);
   gdb_assert (func != NULL);
-  (*this_id).code_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
+  (*this_id).code_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func));
   (*this_id).artificial_depth++;
 }
 
@@ -266,13 +262,14 @@ static int
 block_starting_point_at (CORE_ADDR pc, const struct block *block)
 {
   const struct blockvector *bv;
-  struct block *new_block;
+  const struct block *new_block;
 
   bv = blockvector_for_pc (pc, NULL);
   if (BLOCKVECTOR_MAP (bv) == NULL)
     return 0;
 
-  new_block = (struct block *) addrmap_find (BLOCKVECTOR_MAP (bv), pc - 1);
+  new_block = (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bv),
+                                                  pc - 1);
   if (new_block == NULL)
     return 1;
 
@@ -300,10 +297,18 @@ stopped_by_user_bp_inline_frame (const block *frame_block, bpstat stop_chain)
          bp_location *loc = s->bp_location_at;
          enum bp_loc_type t = loc->loc_type;
 
-         if ((t == bp_loc_software_breakpoint
-              || t == bp_loc_hardware_breakpoint)
-             && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
-           return true;
+         if (t == bp_loc_software_breakpoint
+             || t == bp_loc_hardware_breakpoint)
+           {
+             /* If the location has a function symbol, check whether
+                the frame was for that inlined function.  If it has
+                no function symbol, then assume it is.  I.e., default
+                to presenting the stop at the innermost inline
+                function.  */
+             if (loc->symbol == nullptr
+                 || frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
+               return true;
+           }
        }
     }
 
@@ -333,8 +338,8 @@ skip_inline_frames (thread_info *thread, bpstat stop_chain)
          if (block_inlined_p (cur_block))
            {
              /* See comments in inline_frame_this_id about this use
-                of BLOCK_START.  */
-             if (BLOCK_START (cur_block) == this_pc
+                of BLOCK_ENTRY_PC.  */
+             if (BLOCK_ENTRY_PC (cur_block) == this_pc
                  || block_starting_point_at (this_pc, cur_block))
                {
                  /* Do not skip the inlined frame if execution
This page took 0.036447 seconds and 4 git commands to generate.