/*
* 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 <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "Pcontrol.h"
#include "Pstack.h"
const char *
{
Elf32_Rel r;
size_t i;
fp->file_plt_base == 0 ||
return (NULL);
}
}
return (NULL);
}
int
{
sizeof (int_syscall_instr))
return (0);
return (1);
return (0);
}
int
{
int ret;
if (dst)
return (ret);
}
return (0);
}
/* ARGSUSED */
int
{
if (buflen < sizeof (int_syscall_instr))
return (0);
return (1);
return (0);
}
/*
* Given a return address, determine the likely number of arguments
* that were pushed on the stack prior to its execution. We do this by
* expecting that a typical call sequence consists of pushing arguments on
* the stack, executing a call instruction, and then performing an add
* on %esp to restore it to the value prior to pushing the arguments for
* the call. We attempt to detect such an add, and divide the addend
* by the size of a word to determine the number of pushed arguments.
*
* If we do not find such an add, this does not necessarily imply that the
* function took no arguments. It is not possible to reliably detect such a
* void function because hand-coded assembler does not always perform an add
* to %esp immediately after the "call" instruction (eg. _sys_call()).
* Because of this, we default to returning MIN(sz, TR_ARG_MAX) instead of 0
* in the absence of an add to %esp.
*/
static ulong_t
{
/*
* Read the instruction at the return location.
*/
return (max);
switch (instr[0]) {
case 0x81: /* count is a longword */
break;
case 0x83: /* count is a byte */
break;
default:
return (max);
}
count /= sizeof (long);
}
static void
{
}
int
{
int nfp = 0;
struct {
long fp;
long pc;
} frame;
int rv;
int frame_flags = 0;
/*
* Type definition for a structure corresponding to an IA32
* signal frame. Refer to the comments in Pstack.c for more info
*/
typedef struct {
long fp;
long pc;
int signo;
} sf_t;
init_uclist(&ucl, P);
break;
if (fp != 0 &&
>= (ssize_t)(2* sizeof (long)))) {
/*
* A return PC of -1 on x86 denotes a signal frame. We
* continue to look for a ucontext as a modest
* precaution against stack corruption.
*/
== sizeof (int))
/*
* The bogus return PC prevents us from calling
* argcount() but we know that the signal
* handler takes three arguments (the signal
* number and pointers to a siginfo_t and a
* ucontext_t).
*/
argc = 3;
} else {
sz -= 2* sizeof (long);
}
} else {
argc = 0;
}
sig)) != 0)
break;
if (frame_flags & PR_SIGNAL_FRAME)
frame_flags = 0;
/* Locate the next frame. */
/*
* In order to allow iteration over java frames (which
* can have their own frame pointers), we allow the
* iterator to change the contents of gregs. If we
* detect a change, then we assume that the new values
* point to the next frame.
*/
/*
* If this is a signal frame then we extract the new
* registers from the saved context, thereby allowing us
* to display the interrupted frame.
*/
} else {
}
}
if (prevfp)
free_uclist(&ucl);
return (rv);
}
{
return (sp);
}
int
{
int i;
return (-1);
return (0);
}
int
{
int i;
!= sizeof (int) * (nargs+1))
return (-1);
return (0);
}