thread->unwind_libunwind_ops = ops;
 }
 
-int unwind__prepare_access(struct thread *thread, struct map *map)
+int unwind__prepare_access(struct thread *thread, struct map *map,
+                          bool *initialized)
 {
        const char *arch;
        enum dso_type dso_type;
        struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
+       int err;
 
        if (thread->addr_space) {
                pr_debug("unwind: thread map already set, dso=%s\n",
                         map->dso->name);
+               if (initialized)
+                       *initialized = true;
                return 0;
        }
 
 out_register:
        unwind__register_ops(thread, ops);
 
-       return thread->unwind_libunwind_ops->prepare_access(thread);
+       err = thread->unwind_libunwind_ops->prepare_access(thread);
+       if (initialized)
+               *initialized = err ? false : true;
+       return err;
 }
 
 void unwind__flush_access(struct thread *thread)
 
 #endif
 
 int LIBUNWIND__ARCH_REG_ID(int regnum);
-int unwind__prepare_access(struct thread *thread, struct map *map);
+int unwind__prepare_access(struct thread *thread, struct map *map,
+                          bool *initialized);
 void unwind__flush_access(struct thread *thread);
 void unwind__finish_access(struct thread *thread);
 #else
 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
-                                        struct map *map __maybe_unused)
+                                        struct map *map __maybe_unused,
+                                        bool *initialized __maybe_unused)
 {
        return 0;
 }
 }
 
 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
-                                        struct map *map __maybe_unused)
+                                        struct map *map __maybe_unused,
+                                        bool *initialized __maybe_unused)
 {
        return 0;
 }