maps.c revision b3fbe5e6c0ab1f506cd04f8dd39bf9656909f535
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <procfs.h>
#include <libelf.h>
#include <link.h>
#include <stdarg.h>
#include "rdb.h"
char *
{
if (len < 17)
return ((char *)0);
if (ident == LM_ID_BASE)
if (ident == LM_ID_LDSO)
return (buf);
}
{
if (soname == PS_OBJ_LDSO)
else if (soname == PS_OBJ_EXEC)
else {
break;
}
return (mip);
}
{
/*
* To early to have the full Link Map info available
* so we use the initial info obtained from procfs
*/
return ((map_info_t *)0);
}
return (mip);
return ((map_info_t *)0);
}
{
char flagstr[1024];
printf("link-maps not yet available\n");
return (RET_FAILED);
}
printf("Link Maps\n");
printf("---------\n");
char sbuf[32];
printf("link-map: id: %s name: ",
if (mip->mi_refname)
mip->mi_refname);
else
printf(" base: 0x%08lx padd_base: 0x%08lx\n",
printf(" data_base: 0x%08llx\n",
(unsigned long long)lp->rl_data_base);
printf(" end: 0x%08lx padd_end: 0x%08lx\n",
flagstr[0] = '\0';
}
printf(" dynamic: 0x%08lx flags: 0x%08x:[%s ]\n",
}
return (RET_OK);
}
{
void *ptr;
perr("stat map");
perr("dm: reading map");
puts("\nMappings");
puts("--------");
puts("addr size prot ident name");
else
puts("addr size prot ident name");
mapptr++) {
printf("%#18lx %#08lx %#04x",
else
printf("0x%08lx 0x%06lx 0x%02x",
if (mip->mi_refname) {
printf(" 0x%02lx %s(%s)",
mip->mi_refname);
} else
printf(" 0x%02lx %s",
}
putchar('\n');
}
putchar('\n');
return (RET_OK);
}
{
int cnt;
void *ptr;
int filefd = -1;
perr("stat map");
perr("dm: reading map");
mapptr++) {
if (mapptr->pr_mapname[0]) {
char procname[MAXPATHLEN];
mapptr->pr_mapname);
}
break;
}
}
if (filefd == -1) {
return (RET_FAILED);
}
return (RET_FAILED);
}
printf("non-elf file\n");
return (RET_FAILED);
}
return (RET_FAILED);
}
#if defined(_ELF64)
#else
#endif
return (RET_FAILED);
}
}
}
mp->mi_pltbase = 0;
mp->mi_pltsize = 0;
mp->mi_pltentsz = 0;
return (RET_FAILED);
}
case SHT_DYNSYM:
break;
case SHT_SYMTAB:
break;
case PLTSECTT:
/* LINTED */
}
break;
default:
/* nothing */
break;
}
}
return (RET_OK);
}
static int
{
char buf[MAXPATHLEN];
return (0);
}
"mi: bad object name address passed: 0x%lx\n",
lop->rl_nameaddr);
return (0);
}
if (lop->rl_refnameaddr) {
MAXPATHLEN) == RET_FAILED) {
"mi1: bad object name address passed: 0x%lx\n",
return (0);
}
} else
mip->mi_refname = 0;
}
return (1);
}
return (1);
}
void
{
if (prev) {
if (prev->mi_refname)
}
}
if (prev) {
if (prev->mi_refname)
}
}
{
return (RET_OK);
}
{
printf("rdb: error setting object padding\n");
return (RET_FAILED);
}
return (RET_OK);
}