+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
+ }
+ this_frame->stop_reason = UNWIND_SAME_ID;
+ return NULL;
+ }
+
+ /* Check that this and the next frame do not unwind the PC register
+ to the same memory location. If they do, then even though they
+ have different frame IDs, the new frame will be bogus; two
+ functions can't share a register save slot for the PC. This can
+ happen when the prologue analyzer finds a stack adjustment, but
+ no PC save.
+
+ This check does assume that the "PC register" is roughly a
+ traditional PC, even if the gdbarch_unwind_pc method adjusts
+ it (we do not rely on the value, only on the unwound PC being
+ dependent on this value). A potential improvement would be
+ to have the frame prev_pc method and the gdbarch unwind_pc
+ method set the same lval and location information as
+ frame_register_unwind. */
+ if (this_frame->level > 0
+ && gdbarch_pc_regnum (gdbarch) >= 0
+ && get_frame_type (this_frame) == NORMAL_FRAME
+ && get_frame_type (this_frame->next) == NORMAL_FRAME)
+ {
+ int optimized, realnum, nrealnum;
+ enum lval_type lval, nlval;
+ CORE_ADDR addr, naddr;
+
+ frame_register_unwind_location (this_frame,
+ gdbarch_pc_regnum (gdbarch),
+ &optimized, &lval, &addr, &realnum);
+ frame_register_unwind_location (get_next_frame (this_frame),
+ gdbarch_pc_regnum (gdbarch),
+ &optimized, &nlval, &naddr, &nrealnum);
+
+ if ((lval == lval_memory && lval == nlval && addr == naddr)
+ || (lval == lval_register && lval == nlval && realnum == nrealnum))
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // no saved PC }\n");
+ }
+
+ this_frame->stop_reason = UNWIND_NO_SAVED_PC;
+ this_frame->prev = NULL;
+ return NULL;
+ }
+ }