+ /* On HP/UX, we sometimes encounter core files where none of the threads
+ was found to be the running thread (ie the signal was set to -1 for
+ all threads). This happens when the program was aborted externally
+ via a TT_CORE ttrace system call. In that case, we just pick one
+ thread at random to be the active thread. */
+ if (core_kernel_thread_id (abfd) != 0
+ && bfd_get_section_by_name (abfd, ".reg") == NULL)
+ {
+ asection *asect = bfd_sections_find_if (abfd, thread_section_p, NULL);
+ asection *reg_sect;
+
+ if (asect != NULL)
+ {
+ reg_sect = make_bfd_asection (abfd, ".reg", asect->flags,
+ asect->size, asect->vma,
+ asect->alignment_power);
+ if (reg_sect == NULL)
+ goto fail;
+
+ reg_sect->filepos = asect->filepos;
+ }
+ }
+