/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <strings.h>
#include <dwarf.h>
#include "_conv.h"
#include <dwarf_msg.h>
/*
* This code is primarily of interest to elfdump. Separating it from dwarf_ehe
* allows other tools to use dwarf_ehe without also pulling this in.
*/
/*
* Translate DW_CFA_ codes, used to identify Call Frame Instructions.
*/
const char *
{
};
};
CONV_DS_MSG_INIT(0, cfa) };
/*
* DWARF CFA opcodes are bytes. The top 2 bits are a primary
* opcode, and if zero, the lower 6 bits specify a sub-opcode
*/
switch (op >> 6) {
case 0x1:
return (MSG_ORIG(MSG_DW_CFA_ADVANCE_LOC));
case 0x2:
return (MSG_ORIG(MSG_DW_CFA_OFFSET));
case 0x3:
return (MSG_ORIG(MSG_DW_CFA_RESTORE));
}
}
/*
* Translate DWARF register numbers to hardware specific names
*
* If good_name is non-NULL, conv_dwarf_regname() will set the variable to
* True(1) if the returned string is considered to be a good name to
* display, and False(0) otherwise. To be considered "good":
*
* - The name must be a well known mnemonic for a register
* from the machine type in question.
*
* - The name must be different than the DWARF name for
* the same register.
*
* The returned string is usable, regardless of the value returned in
* *good_name.
*/
const char *
{
};
CONV_DS_MSG_INIT(0, reg_amd64) };
};
CONV_DS_MSG_INIT(0, reg_i386) };
};
CONV_DS_MSG_INIT(0, reg_sparc) };
switch (mach) {
case EM_AMD64:
/*
* amd64 has several in-bounds names we'd rather not
* use. R8-R15 have the same name as their DWARF counterparts.
* 56-57, and 60-61 are reserved, and don't have a good name.
*/
if (good_name)
case EM_386:
case EM_486:
if (good_name)
case EM_SPARC:
case EM_SPARC32PLUS:
case EM_SPARCV9:
if (good_name)
}
if (good_name)
*good_name = 0;
}