+
+ Elf *elf;
+ i = snprintf (name, sizeof (name), "/proc/%ld/exe", (long) pid);
+ assert (i > 0 && i < (ssize_t) sizeof (name) - 1);
+ int elf_fd = open (name, O_RDONLY);
+ if (elf_fd >= 0)
+ {
+ elf = elf_begin (elf_fd, ELF_C_READ_MMAP, NULL);
+ if (elf == NULL)
+ {
+ /* Just ignore, dwfl_attach_state will fall back to trying
+ to associate the Dwfl with one of the existing DWfl_Module
+ ELF images (to know the machine/class backend to use). */
+ close (elf_fd);
+ elf_fd = -1;
+ }
+ }
+ else
+ elf = NULL;