/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/sysmacros.h>
#include <alloca.h>
#include <rtld_db.h>
#include <libgen.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <gelf.h>
#include <stddef.h>
#include "libproc.h"
#include "Pcontrol.h"
#include "P32ton.h"
#include "Putil.h"
/*
* Pcore.c - Code to initialize a ps_prochandle from a core dump. We
* allocate an additional structure to hold information from the core
* file, and attach this to the standard ps_prochandle in place of the
* ability to examine /proc/<pid>/ files.
*/
/*
* Basic i/o function for reading and writing from the process address space
* stored in the core file and associated shared libraries. We compute the
* appropriate fd and offsets, and let the provided prw function do the rest.
*/
static ssize_t
{
while (resid != 0) {
int fd;
break; /* No mapping for this address */
break; /* No file or file not open */
} else
break;
}
/*
* Important: Be consistent with the behavior of i/o on the as file:
* writing to an invalid address yields EIO; reading from an invalid
* address falls through to returning success and zero bytes.
*/
return (-1);
}
return (n - resid);
}
static ssize_t
{
}
static ssize_t
{
}
/*
* Return the lwp_info_t for the given lwpid. If no such lwpid has been
* encountered yet, allocate a new structure and return a pointer to it.
* Create a list of lwp_info_t structures sorted in decreasing lwp_id order.
*/
static lwp_info_t *
{
uint_t i;
return (lwp);
}
break;
}
}
return (NULL);
return (lwp);
}
/*
* The core file itself contains a series of NOTE segments containing saved
* structures from /proc at the time the process died. For each note we
* comprehend, we define a function to read it in from the core file,
* convert it to our native data model if necessary, and store it inside
* the ps_prochandle. Each function is invoked by Pfgrab_core() with the
* seek pointer on P->asfd positioned appropriately. We populate a table
* of pointers to these note functions below.
*/
static int
{
#ifdef _LP64
if (nbytes < sizeof (pstatus32_t) ||
goto err;
} else
#endif
goto err;
P->orig_status = P->status;
return (0);
err:
dprintf("Pgrab_core: failed to read NT_PSTATUS\n");
return (-1);
}
static int
{
#ifdef _LP64
if (nbytes < sizeof (lwpstatus32_t) ||
goto err;
} else
#endif
if (nbytes < sizeof (lwpstatus_t) ||
goto err;
dprintf("Pgrab_core: failed to add NT_LWPSTATUS\n");
return (-1);
}
/*
* Erase a useless and confusing artifact of the kernel implementation:
* the lwps which did *not* create the core will show SIGKILL. We can
* be assured this is bogus because SIGKILL can't produce core files.
*/
return (0);
err:
dprintf("Pgrab_core: failed to read NT_LWPSTATUS\n");
return (-1);
}
static int
{
#ifdef _LP64
if (nbytes < sizeof (psinfo32_t) ||
goto err;
} else
#endif
goto err;
return (0);
err:
dprintf("Pgrab_core: failed to read NT_PSINFO\n");
return (-1);
}
static int
{
#ifdef _LP64
if (nbytes < sizeof (lwpsinfo32_t) ||
goto err;
} else
#endif
if (nbytes < sizeof (lwpsinfo_t) ||
goto err;
dprintf("Pgrab_core: failed to add NT_LWPSINFO\n");
return (-1);
}
return (0);
err:
dprintf("Pgrab_core: failed to read NT_LWPSINFO\n");
return (-1);
}
static int
{
char *plat;
return (0); /* Already seen */
dprintf("Pgrab_core: failed to read NT_PLATFORM\n");
return (-1);
}
}
return (0);
}
static int
{
return (0); /* Already seen or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_UTSNAME\n");
return (-1);
}
if (_libproc_debug) {
}
return (0);
}
static int
{
return (-1);
return (-1);
return (0);
}
static int
{
int ngroups;
/*
* We allow for prcred_t notes that are actually smaller than a
* prcred_t since the last member isn't essential if there are
* no group memberships. This allows for more flexibility when it
* comes to slightly malformed -- but still valid -- notes.
*/
return (0); /* Already seen or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_PRCRED\n");
return (-1);
}
dprintf("pr_ngroups = %d; resetting to %d based on note size\n",
}
return (0);
}
static int
{
return (0); /* Already seen or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_LDT\n");
return (-1);
}
return (0);
}
#endif /* __i386 */
static int
{
return (0); /* Already seen or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_PRPRIV\n");
return (-1);
}
return (0);
}
static int
{
extern void *__priv_parse_info();
nbytes < sizeof (priv_impl_info_t))
return (0); /* Already seen or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_PRPRIVINFO\n");
return (-1);
}
return (0);
}
static int
{
char *zonename;
return (0); /* Already seen */
if (nbytes != 0) {
return (-1);
dprintf("Pgrab_core: failed to read NT_ZONENAME\n");
return (-1);
}
}
return (0);
}
static int
{
size_t n, i;
#ifdef _LP64
dprintf("Pgrab_core: failed to read NT_AUXV\n");
return (-1);
}
return (-1);
for (i = 0; i < n; i++)
} else {
#endif
return (-1);
return (-1);
}
#ifdef _LP64
}
#endif
if (_libproc_debug) {
for (i = 0; i < n; i++) {
}
}
/*
* Defensive coding for loops which depend upon the auxv array being
* terminated by an AT_NULL element; in each case, we've allocated
* P->auxv to have an additional element which we force to be AT_NULL.
*/
P->nauxv = (int)n;
return (0);
}
static int
{
return (0); /* No lwp yet, already seen, or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_PRXREG\n");
return (-1);
}
return (0);
}
#ifdef __sparc
static int
{
return (0); /* No lwp yet or already seen or no data */
return (-1);
/*
* Since the amount of gwindows data varies with how many windows were
* actually saved, we just read up to the minimum of the note size
* and the size of the gwindows_t type. It doesn't matter if the read
* fails since we have to zero out gwindows first anyway.
*/
#ifdef _LP64
} else {
#endif
#ifdef _LP64
}
#endif
return (0);
}
#ifdef __sparcv9
static int
{
return (0); /* No lwp yet, already seen, or bad size */
return (-1);
dprintf("Pgrab_core: failed to read NT_ASRS\n");
return (-1);
}
return (0);
}
#endif /* __sparcv9 */
static int
{
return (0); /* No lwp yet or already seen */
return (-1);
dprintf("Pgrab_core: failed to read NT_PRCXREGS\n");
return (-1);
}
return (0);
}
#endif /* __sparc */
/*ARGSUSED*/
static int
{
dprintf("skipping unsupported note type\n");
return (0);
}
/*
* Populate a table of function pointers indexed by Note type with our
* functions to process each type of core file note:
*/
note_notsup, /* 0 unassigned */
note_notsup, /* 1 NT_PRSTATUS (old) */
note_notsup, /* 2 NT_PRFPREG (old) */
note_notsup, /* 3 NT_PRPSINFO (old) */
note_xreg, /* 4 NT_PRXREG */
note_platform, /* 5 NT_PLATFORM */
note_auxv, /* 6 NT_AUXV */
#ifdef __sparc
note_gwindows, /* 7 NT_GWINDOWS */
#ifdef __sparcv9
note_asrs, /* 8 NT_ASRS */
#else
note_notsup, /* 8 NT_ASRS */
#endif
#else
note_notsup, /* 7 NT_GWINDOWS */
note_notsup, /* 8 NT_ASRS */
#endif
note_ldt, /* 9 NT_LDT */
#else
note_notsup, /* 9 NT_LDT */
#endif
note_pstatus, /* 10 NT_PSTATUS */
note_notsup, /* 11 unassigned */
note_notsup, /* 12 unassigned */
note_psinfo, /* 13 NT_PSINFO */
note_cred, /* 14 NT_PRCRED */
note_utsname, /* 15 NT_UTSNAME */
note_lwpstatus, /* 16 NT_LWPSTATUS */
note_lwpsinfo, /* 17 NT_LWPSINFO */
note_priv, /* 18 NT_PRPRIV */
note_priv_info, /* 19 NT_PRPRIVINFO */
note_content, /* 20 NT_CONTENT */
note_zonename, /* 21 NT_ZONENAME */
#ifdef __sparc
note_cpuxregs, /* 22 NT_PRCPUXREG */
#else
note_notsup, /* 22 NT_PRCPUXREG */
#endif
};
/*
* Add information on the address space mapping described by the given
* PT_LOAD program header. We fill in more information on the mapping later.
*/
static int
{
int err = 0;
dprintf("mapping base %llx filesz %llu memsz %llu offset %llu\n",
/*
* If Pgcore() or elfcore() fail to write a mapping, they will set
* PF_SUNW_FAILURE in the Phdr and try to stash away the errno for us.
*/
Perror_printf(P, "core file data for mapping at %p not saved: "
dprintf("core file data for mapping at %p not saved: %s\n",
Perror_printf(P, "core file may be corrupt -- data for mapping "
dprintf("core file may be corrupt -- data for mapping "
}
/*
* The mapping name and offset will hopefully be filled in
* by the librtld_db agent. Unfortunately, if it isn't a
* shared library mapping, this information is gone forever.
*/
/*
* At the time of adding this mapping, we just zero the pagesize.
* Once we've processed more of the core file, we'll have the
* pagesize from the auxv's AT_PAGESZ element and we can fill this in.
*/
pmap.pr_pagesize = 0;
/*
* Unfortunately whether or not the mapping was a System V
* shared memory segment is lost. We use -1 to mark it as not shm.
*/
}
/*
* Given a virtual address, name the mapping at that address using the
* specified name, and return the map_info_t pointer.
*/
static map_info_t *
{
}
return (mp);
}
/*
* libproc uses libelf for all of its symbol table manipulation. This function
* takes a symbol table and string table from a core file and places them
* in a memory backed elf file.
*/
static void
{
dprintf("fake_up_symtab: invalid section\n");
return;
}
dprintf("Symbol table already loaded (sh_addr 0x%lx)\n",
return;
}
struct {
} *b;
return;
off = 0;
dprintf("fake_up_symtab: pread of symtab[1] failed\n");
free(b);
return;
}
dprintf("fake_up_symtab: pread of symtab[2] failed\n");
free(b);
return;
}
free(b);
return;
}
#ifdef _LP64
} else {
struct {
} *b;
return;
off = 0;
free(b);
return;
}
free(b);
return;
}
free(b);
return;
}
#endif
}
dprintf("fake_up_symtab: failed to get section data at %p\n",
(void *)scn);
goto err;
}
return;
err:
}
static void
{
}
static void
{
}
/*
* Perform elf_begin on efp->e_fd and verify the ELF file's type and class.
*/
static int
{
#ifdef _BIG_ENDIAN
#else
#endif
int isa_err = 0;
/*
* Because 32-bit libelf cannot deal with large files, we need to read,
* check, and convert the file header manually in case type == ET_CORE.
*/
goto err;
}
*perr = G_ISAINVAL;
} else {
}
}
goto err;
}
/*
* If the file is 64-bit and we are 32-bit, fail with G_LP64. If the
* file is 64-bit and we are 64-bit, re-read the header as a Elf64_Ehdr,
* and convert it to a elf_file_header_t. Otherwise, the file is
* 32-bit, so convert e32 to a elf_file_header_t.
*/
#ifdef _LP64
goto err;
}
#else /* _LP64 */
goto err;
#endif /* _LP64 */
} else {
}
/*
* If the number of section headers or program headers or the section
* header string table index would overflow their respective fields
* in the ELF header, they're stored in the section header at index
* zero. To simplify use elsewhere, we look for those sentinel values
* here.
*/
dprintf("extended ELF header\n");
goto err;
}
goto err;
}
} else {
goto err;
}
}
dprintf("section header count %lu\n",
}
}
}
/*
* It's possible this core file came from a system that
* accidentally truncated the e_phnum field without correctly
* using the extended format in the section header at index
* zero. We try to detect and correct that specific type of
* corruption by using the knowledge that the core dump
* routines usually place the data referenced by the first
* program header immediately after the last header element.
*/
goto err;
}
} else {
goto err;
}
}
dprintf("suspicious program header count %u %u\n",
/*
* If the new program header count we computed doesn't
* jive with count in the ELF header, we'll use the
* data that's there and hope for the best.
*
* If it does, it's also possible that the section
* header offset is incorrect; we'll check that and
* possibly try to fix it.
*/
}
dprintf("using new program header count\n");
} else {
dprintf("inconsistent program header count\n");
}
}
}
/*
* The libelf implementation was never ported to be large-file aware.
* This is typically not a problem for your average executable or
* shared library, but a large 32-bit core file can exceed 2GB in size.
* So if type is ET_CORE, we don't bother doing elf_begin; the code
* in Pfgrab_core() below will do its own i/o and struct conversion.
*/
return (0);
}
goto err;
}
return (0);
err:
return (-1);
}
/*
* Open the specified file and then do a core_elf_fdopen on it.
*/
static int
{
return (0);
}
return (-1);
}
/*
* Close the ELF handle and file descriptor.
*/
static void
{
}
}
}
/*
* Given an ELF file for a statically linked executable, locate the likely
* primary text section and fill in rl_base with its virtual address.
*/
static map_info_t *
{
uint_t i;
return (NULL);
for (i = 0; i < nphdrs; i++) {
}
}
return (NULL);
}
/*
* Given an ELF file and the librtld_db structure corresponding to its primary
* text mapping, deduce where its data segment was loaded and fill in
* rl_data_base and prmap_t.pr_offset accordingly.
*/
static map_info_t *
{
/*
* Find the first loadable, writeable Phdr and compute rl_data_base
* as the virtual address at which is was loaded.
*/
return (NULL);
for (i = 0; i < nphdrs; i++) {
break;
}
}
/*
* If we didn't find an appropriate phdr or if the address we
* computed has no mapping, return NULL.
*/
return (NULL);
/*
* It wouldn't be procfs-related code if we didn't make use of
* unclean knowledge of segvn, even in userland ... the prmap_t's
* pr_offset field will be the segvn offset from mmap(2)ing the
* data section, which will be the file offset & PAGEMASK.
*/
return (mp);
}
/*
* Librtld_db agent callback for iterating over load object mappings.
* For each load object, we allocate a new file_info_t, perform naming,
* and attempt to construct a symbol table for the load object.
*/
static int
{
return (1); /* Keep going; forget this if we can't get a name */
}
dprintf("rd_loadobj name = \"%s\" rl_base = %p\n",
return (1); /* No mapping; advance to next mapping */
}
/*
* Create a new file_info_t for this mapping, and therefore for
* this load object.
*
* If there's an ELF header at the beginning of this mapping,
* file_info_new() will try to use its section headers to
* identify any other mappings that belong to this load object.
*/
dprintf("failed to malloc mapping data\n");
return (0); /* Abort */
}
/* Create a local copy of the load object representation */
dprintf("failed to malloc mapping data\n");
return (0); /* Abort */
}
if (lname[0] != '\0') {
/*
* Naming dance part 1: if we got a name from librtld_db, then
* copy this name to the prmap_t if it is unnamed. If the
* file_info_t is unnamed, name it after the lname.
*/
}
/*
* Naming dance part 2: if the mapping is named and the
* file_info_t is not, name the file after the mapping.
*/
}
/* Associate the file and the mapping. */
/*
* If no section headers were available then we'll have to
* identify this load object's other mappings with what we've
* got: the start and end of the object's corresponding
* address space.
*/
dprintf("core_iter_mapping %s: associating "
"segment at %p\n",
fp->file_pname,
} else {
dprintf("core_iter_mapping %s: segment at "
"%p already associated with %s\n",
fp->file_pname,
}
}
}
/* Ensure that all this file's mappings are named. */
PRMAPSZ);
}
}
/* Attempt to build a symbol table for this file. */
Pbuild_file_symtab(P, fp);
dprintf("core_iter_mapping: no symtab for %s\n",
fp->file_pname);
/* Locate the start of a data segment associated with this file. */
dprintf("found data for %s at %p (pr_offset 0x%llx)\n",
} else {
dprintf("core_iter_mapping: no data found for %s\n",
fp->file_pname);
}
return (1); /* Advance to next mapping */
}
/*
* Callback function for Pfindexec(). In order to confirm a given pathname,
* we verify that we can open it as an ELF file of type ET_EXEC or ET_DYN.
*/
static int
{
return (1);
return (1);
return (0);
}
/*
* Attempt to load any section headers found in the core file. If present,
* this will refer to non-loadable data added to the core file by the kernel
* based on coreadm(1M) settings, including CTF data and the symbol table.
*/
static void
{
const char *name;
void *buf;
int i;
dprintf("corrupt shstrndx (%u) exceeds shnum (%u)\n",
return;
}
/*
* Read the section header table from the core file and then iterate
* over the section headers, converting each to a GElf_Shdr.
*/
dprintf("failed to malloc %u section headers: %s\n",
return;
}
goto out;
}
dprintf("failed to read section headers at off %lld: %s\n",
goto out;
}
core_shdr_to_gelf(p, &shdrs[i]);
else
}
/*
* Read the .shstrtab section from the core file, terminating it with
* an extra \0 so that a corrupt section will not cause us to die.
*/
dprintf("failed to allocate %lu bytes for shstrtab\n",
goto out;
}
dprintf("failed to read %lu bytes of shstrs at off %lld: %s\n",
goto out;
}
/*
* Now iterate over each section in the section header table, locating
* sections of interest and initializing more of the ps_prochandle.
*/
dprintf("skipping section [%d]: corrupt sh_name\n", i);
continue;
}
dprintf("skipping section [%d]: corrupt sh_link\n", i);
continue;
}
dprintf("found section header %s (sh_addr 0x%llx)\n",
dprintf("no map at addr 0x%llx for %s [%d]\n",
continue;
}
dprintf("no mapping file or duplicate buffer "
"for %s [%d]\n", name, i);
continue;
}
dprintf("skipping section %s [%d]: %s\n",
continue;
}
}
}
out:
}
/*
* Main engine for core file initialization: given an fd for the core file
* and an optional pathname, construct the ps_prochandle. The aout_path can
* either be a suggested executable pathname, or a suggested directory to
* use as a possible current working directory.
*/
struct ps_prochandle *
{
struct ps_prochandle *P;
const char *execname;
char *interp;
dprintf("libproc ELF version is more recent than libelf\n");
return (NULL);
}
/*
* Allocate and initialize a ps_prochandle structure for the core.
* There are several key pieces of initialization here:
*
* 1. The PS_DEAD state flag marks this prochandle as a core file.
* PS_DEAD also thus prevents all operations which require state
* to be PS_STOP from operating on this handle.
*
* 2. We keep the core file fd in P->asfd since the core file contains
* the remnants of the process address space.
*
* 3. We set the P->info_valid bit because all information about the
* core is determined by the end of this function; there is no need
* for proc_update_maps() to reload mappings at any later point.
*
* above to handle i/o requests.
*/
return (NULL);
}
(void) memset(P, 0, sizeof (struct ps_prochandle));
P->ctlfd = -1;
P->statfd = -1;
P->agentctlfd = -1;
P->agentstatfd = -1;
P->info_valid = 1;
P->ops = &P_core_ops;
Pinitsym(P);
/*
* Fstat and open the core file and make sure it is a valid ELF core.
*/
goto err;
}
goto err;
/*
* Allocate and initialize a core_info_t to hang off the ps_prochandle
* structure. We keep all core-specific information in this structure.
*/
goto err;
}
/*
* In the days before adjustable core file content, this was the
* default core file content. For new core files, this value will
* be overwritten by the NT_CONTENT note section.
*/
case ELFCLASS32:
break;
case ELFCLASS64:
break;
default:
goto err;
}
/*
* Because the core file may be a large file, we can't use libelf to
* read the Phdrs. We use e_phnum and e_phentsize to simplify things.
*/
goto err;
}
goto err;
}
/*
* Iterate through the program headers in the core file.
* We're interested in two types of Phdrs: PT_NOTE (which
* contains a set of saved /proc structures), and PT_LOAD (which
* represents a memory mapping from the process's address space).
* In the case of PT_NOTE, we're interested in the last PT_NOTE
* in the core file; currently the first PT_NOTE (if present)
* contains /proc structs in the pre-2.6 unstructured /proc format.
*/
else
case PT_NOTE:
notes++;
break;
case PT_LOAD:
goto err;
}
break;
}
}
Psort_mappings(P);
/*
* If we couldn't find anything of type PT_NOTE, or only one PT_NOTE
* was present, abort. The core file is either corrupt or too old.
*/
goto err;
}
/*
* Advance the seek pointer to the start of the PT_NOTE data
*/
dprintf("Pgrab_core: failed to lseek to PT_NOTE data\n");
goto err;
}
/*
* Now process the PT_NOTE structures. Each one is preceded by
* an Elf{32/64}_Nhdr structure describing its type and size.
*
* +--------+
* | header |
* +--------+
* | name |
* | ... |
* +--------+
* | desc |
* | ... |
* +--------+
*/
/*
* as different types, they are both of the same content and
* size, so we don't need to worry about 32/64 conversion here.
*/
dprintf("Pgrab_core: failed to read ELF note header\n");
goto err;
}
/*
* According to the System V ABI, the amount of padding
* following the name field should align the description
* field on a 4 byte boundary for 32-bit binaries or on an 8
* byte boundary for 64-bit binaries. However, this change
* was not made correctly during the 64-bit port so all
* descriptions can assume only 4-byte alignment. We ignore
* the name field and the padding to 4-byte alignment.
*/
dprintf("failed to seek past name and padding\n");
goto err;
}
dprintf("Note hdr n_type=%u n_namesz=%u n_descsz=%u\n",
/*
* Invoke the note handler function from our table
*/
goto err;
}
} else
/*
* Seek past the current note data to the next Elf_Nhdr
*/
dprintf("Pgrab_core: failed to seek to next nhdr\n");
goto err;
}
/*
* Subtract the size of the header and its data from what
* we have left to process.
*/
}
if (nleft != 0) {
dprintf("Pgrab_core: note section malformed\n");
goto err;
}
pagesize = getpagesize();
}
/*
* Locate and label the mappings corresponding to the end of the
* heap (MA_BREAK) and the base of the stack (MA_STACK).
*/
else
/*
* At this point, we have enough information to look for the
* executable and open it: we have access to the auxv, a psinfo_t,
* and the ability to read from mappings provided by the core file.
*/
/*
* Iterate through the sections, looking for the .dynamic and .interp
* sections. If we encounter them, remember their section pointers.
*/
char *sname;
continue;
}
/*
* Get the AT_BASE auxv element. If this is missing (-1), then
* we assume this is a statically-linked executable.
*/
/*
* In order to get librtld_db initialized, we'll need to identify
* and name the mapping corresponding to the run-time linker. The
* AT_BASE auxv element tells us the address where it was mapped,
* and the .interp section of the executable tells us its path.
* If for some reason that doesn't pan out, just use ld.so.1.
*/
else
dprintf(".interp section is missing or could not be read; "
"defaulting to %s\n", interp);
} else
dprintf("detected statically linked executable\n");
/*
* If we have an AT_BASE element, name the mapping at that address
* using the interpreter pathname. Name the corresponding data
* mapping after the interpreter as well.
*/
dprintf("renamed data at %p to %s\n",
}
}
}
/*
* If we have an AT_ENTRY element, name the mapping at that address
* using the special name "a.out" just like /proc does.
*/
/*
* If we're a statically linked executable, then just locate the
* executable's text and data and name them after the executable.
*/
}
P->num_files++;
if (fp->file_lname)
if (fp->file_rname)
Pbuild_file_symtab(P, fp);
}
}
}
/*
* We now have enough information to initialize librtld_db.
* After it warms up, we can iterate through the load object chain
* in the core, which will allow us to construct the file info
* we need to provide symbol information for the other shared
* libraries, and also to fill in the missing mapping names.
*/
core_iter_mapping, P);
if (P->core->core_errno != 0) {
goto err;
}
} else
dprintf("failed to initialize rtld_db agent\n");
/*
* If there are sections, load them and process the data from any
* sections that we can use to annotate the file_info_t's.
*/
core_load_shdrs(P, &core);
/*
* If we previously located a stack or break mapping, and they are
* still anonymous, we now assume that they were MAP_ANON mappings.
* If brk_mp turns out to now have a name, then the heap is still
* sitting at the end of the executable's data+bss mapping: remove
* the previous MA_BREAK setting to be consistent with /proc.
*/
*perr = 0;
return (P);
err:
Pfree(P);
return (NULL);
}
/*
* Grab a core file using a pathname. We just open it and call Pfgrab_core().
*/
struct ps_prochandle *
{
else
return (NULL);
}