gdbsupport: make gdb_open_cloexec return scoped_fd
[binutils-gdb.git] / gdb / inline-frame.c
index 35ceb27d9c14729efedddab04e1325fc763e62be..df7bd826ff54e6794fbd9f8c77f8c0f5f109d5f4 100644 (file)
@@ -1,6 +1,6 @@
 /* Inline frame unwinder for GDB.
 
-   Copyright (C) 2008-2020 Free Software Foundation, Inc.
+   Copyright (C) 2008-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -161,8 +161,12 @@ inline_frame_this_id (struct frame_info *this_frame,
      real frame's this_id method.  So we must call
      get_prev_frame_always.  Because we are inlined into some
      function, there must be previous frames, so this is safe - as
-     long as we're careful not to create any cycles.  */
-  *this_id = get_frame_id (get_prev_frame_always (this_frame));
+     long as we're careful not to create any cycles.  See related
+     comments in get_prev_frame_always_1.  */
+  frame_info *prev_frame = get_prev_frame_always (this_frame);
+  if (prev_frame == nullptr)
+    error (_("failed to find previous frame when computing inline frame id"));
+  *this_id = get_frame_id (prev_frame);
 
   /* We need a valid frame ID, so we need to be based on a valid
      frame.  FSF submission NOTE: this would be a good assertion to
@@ -171,10 +175,6 @@ 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
@@ -266,6 +266,7 @@ inline_frame_sniffer (const struct frame_unwind *self,
 }
 
 const struct frame_unwind inline_frame_unwind = {
+  "inline",
   INLINE_FRAME,
   default_frame_unwind_stop_reason,
   inline_frame_this_id,
@@ -316,7 +317,7 @@ stopped_by_user_bp_inline_frame (const block *frame_block, bpstat stop_chain)
       if (bpt != NULL
          && (user_breakpoint_p (bpt) || bpt->type == bp_until))
        {
-         bp_location *loc = s->bp_location_at;
+         bp_location *loc = s->bp_location_at.get ();
          enum bp_loc_type t = loc->loc_type;
 
          if (t == bp_loc_software_breakpoint