- struct macro_source_file *main;
- struct macro_scope *ms;
-
- /* If there's a selected frame, use its PC. */
- if (selected_frame)
- sal = find_pc_line (selected_frame->pc, 0);
-
- /* If the target has any registers at all, then use its PC. Why we
- would have registers but no stack, I'm not sure. */
- else if (target_has_registers)
- sal = find_pc_line (read_pc (), 0);
-
- /* If all else fails, fall back to the current listing position. */
+ gdb::unique_xmalloc_ptr<struct macro_scope> ms;
+ struct frame_info *frame;
+ CORE_ADDR pc;
+
+ /* If there's a selected frame, use its PC. */
+ frame = deprecated_safe_get_selected_frame ();
+ if (frame && get_frame_pc_if_available (frame, &pc))
+ sal = find_pc_line (pc, 0);
+
+ /* Fall back to the current listing position. */