dis.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2000 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 <stdarg.h>
#include "rdb.h"
#include "disasm.h"
/*
* I don't link this global but it's a work-around for the
* poor disassemble interface for now.
*/
static struct ps_prochandle * cur_ph;
/*
* This routine converts 'address' into it's closest symbol
* representation.
*
* The following flags are used to effect the output:
*
* FLG_PAP_SONAME
* embed the SONAME in the symbol name
* FLG_PAP_NOHEXNAME
* if no symbol found return a null string
* If this flag is not set return a string displaying
* the 'hex' value of address.
* FLG_PAP_PLTDECOM
* decompose the PLT symbol if possible
*/
char *
{
static char buf[256];
char * str;
map_info_t * mip;
if (flags & FLG_PAP_SONAME) {
/*
* Embed SOName in symbol name
*/
} else
} else
buf[0] = '\0';
if ((flags & FLG_PAP_PLTDECOM) &&
sizeof (pstatus), 0) == -1)
perr("pap: reading pstatus");
char * _str;
"%s0x%lx:plt(%s)",
return (buf);
}
}
}
return (buf);
} else {
else
return (buf);
}
} else {
if (flags & FLG_PAP_NOHEXNAME)
buf[0] = '\0';
else
return (buf);
}
}
char *
print_address(unsigned long address)
{
}
{
char * instr_str;
unsigned int instr;
sizeof (unsigned)) != PS_OK)
perror("da: ps_pread");
0, 0, vers);
}
return (RET_OK);
}
void
{
perr("disasm: PIOCSTATUS");
}