mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-25 08:37:38 +01:00
Bring git v0.98.5 tree in sync with released v0.98.5.
Sadly, the conversion from Bitkeeper -> CVS -> git wasn't perfect. Or so it seems.
This commit is contained in:
parent
38d99eee0a
commit
f176ad6fc6
30 changed files with 1247 additions and 0 deletions
1
AUTHORS
1
AUTHORS
|
@ -0,0 +1 @@
|
|||
David Mosberger <davidm@hpl.hp.com>
|
182
INSTALL
182
INSTALL
|
@ -0,0 +1,182 @@
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
0
configure
vendored
Normal file → Executable file
0
configure
vendored
Normal file → Executable file
|
@ -0,0 +1,63 @@
|
|||
'\" t
|
||||
.\" Manual page created with latex2man on Wed Aug 18 16:51:29 CEST 2004
|
||||
.\" NOTE: This file is generated, DO NOT EDIT.
|
||||
.de Vb
|
||||
.ft CW
|
||||
.nf
|
||||
..
|
||||
.de Ve
|
||||
.ft R
|
||||
|
||||
.fi
|
||||
..
|
||||
.TH "UNW\\_STRERROR" "3" "18 August 2004" "Programming Library " "Programming Library "
|
||||
.SH NAME
|
||||
unw_strerror
|
||||
\-\- get text corresponding to error code
|
||||
.PP
|
||||
.SH SYNOPSIS
|
||||
|
||||
.PP
|
||||
#include <libunwind.h>
|
||||
.br
|
||||
.PP
|
||||
const char *
|
||||
unw_strerror(int
|
||||
err_code);
|
||||
.br
|
||||
.PP
|
||||
.SH DESCRIPTION
|
||||
|
||||
.PP
|
||||
The unw_strerror()
|
||||
routine maps the (negative) err_code
|
||||
to a corresponding text message and returns it.
|
||||
.PP
|
||||
.SH RETURN VALUE
|
||||
|
||||
.PP
|
||||
The message that corresponds to err_code
|
||||
or, if the
|
||||
err_code
|
||||
has no corresponding message, the text "invalid error
|
||||
code".
|
||||
.PP
|
||||
.SH THREAD AND SIGNAL SAFETY
|
||||
|
||||
.PP
|
||||
unw_strerror()
|
||||
is thread\-safe as well as safe to use
|
||||
from a signal handler.
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
|
||||
.PP
|
||||
Thomas Hallgren
|
||||
.br
|
||||
BEA Systems
|
||||
.br
|
||||
Stockholm, Sweden
|
||||
.br
|
||||
Email: \fBthallgre@bea.com\fP
|
||||
.br
|
||||
.\" NOTE: This file is generated, DO NOT EDIT.
|
|
@ -0,0 +1,42 @@
|
|||
\documentclass{article}
|
||||
\usepackage[fancyhdr,pdf]{latex2man}
|
||||
|
||||
\input{common.tex}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{Name}{3}{unw\_strerror}{Thomas Hallgren}{Programming Library}{unw\_strerror}unw\_strerror -- get text corresponding to error code
|
||||
\end{Name}
|
||||
|
||||
\section{Synopsis}
|
||||
|
||||
\File{\#include $<$libunwind.h$>$}\\
|
||||
|
||||
\Type{const char *} \Func{unw\_strerror}(\Type{int} \Var{err\_code});\\
|
||||
|
||||
\section{Description}
|
||||
|
||||
The \Func{unw\_strerror}() routine maps the (negative) \Var{err\_code}
|
||||
to a corresponding text message and returns it.
|
||||
|
||||
\section{Return Value}
|
||||
|
||||
The message that corresponds to \Var{err\_code} or, if the
|
||||
\Var{err\_code} has no corresponding message, the text "invalid error
|
||||
code".
|
||||
|
||||
\section{Thread and Signal Safety}
|
||||
|
||||
\Func{unw\_strerror}() is thread-safe as well as safe to use
|
||||
from a signal handler.
|
||||
|
||||
\section{Author}
|
||||
|
||||
\noindent
|
||||
Thomas Hallgren\\
|
||||
BEA Systems\\
|
||||
Stockholm, Sweden\\
|
||||
Email: \Email{thallgre@bea.com}\\
|
||||
\LatexManEnd
|
||||
|
||||
\end{document}
|
|
@ -0,0 +1,343 @@
|
|||
#ifndef DWARF_I_H
|
||||
#define DWARF_I_H
|
||||
|
||||
/* This file contains definitions that cannot be used in code outside
|
||||
of libunwind. In particular, most inline functions are here
|
||||
because otherwise they'd generate unresolved references when the
|
||||
files are compiled with inlining disabled. */
|
||||
|
||||
#include "dwarf.h"
|
||||
#include "tdep.h"
|
||||
|
||||
#define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map)
|
||||
|
||||
extern uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH];
|
||||
|
||||
static inline unw_regnum_t
|
||||
dwarf_to_unw_regnum (unw_word_t regnum)
|
||||
{
|
||||
if (regnum <= DWARF_REGNUM_MAP_LENGTH)
|
||||
return dwarf_to_unw_regnum_map[regnum];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef UNW_LOCAL_ONLY
|
||||
|
||||
/* In the local-only case, we can let the compiler directly access
|
||||
memory and don't need to worry about differing byte-order. */
|
||||
|
||||
typedef union
|
||||
{
|
||||
int8_t s8;
|
||||
int16_t s16;
|
||||
int32_t s32;
|
||||
int64_t s64;
|
||||
uint8_t u8;
|
||||
uint16_t u16;
|
||||
uint32_t u32;
|
||||
uint64_t u64;
|
||||
unw_word_t w;
|
||||
void *ptr;
|
||||
}
|
||||
dwarf_misaligned_value_t __attribute__ ((packed));
|
||||
|
||||
static inline int
|
||||
dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int8_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->s8;
|
||||
*addr += sizeof (mvp->s8);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int16_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->s16;
|
||||
*addr += sizeof (mvp->s16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int32_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->s32;
|
||||
*addr += sizeof (mvp->s32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int64_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->s64;
|
||||
*addr += sizeof (mvp->s64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint8_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->u8;
|
||||
*addr += sizeof (mvp->u8);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint16_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->u16;
|
||||
*addr += sizeof (mvp->u16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint32_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->u32;
|
||||
*addr += sizeof (mvp->u32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint64_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->u64;
|
||||
*addr += sizeof (mvp->u64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
unw_word_t *val, void *arg)
|
||||
{
|
||||
dwarf_misaligned_value_t *mvp = (void *) *addr;
|
||||
|
||||
*val = mvp->w;
|
||||
*addr += sizeof (mvp->w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !UNW_LOCAL_ONLY */
|
||||
|
||||
static inline int
|
||||
dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint8_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val, aligned_addr = *addr & -sizeof (unw_word_t);
|
||||
unw_word_t off = *addr - aligned_addr;
|
||||
int ret;
|
||||
|
||||
*addr += 1;
|
||||
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
val >>= 8*off;
|
||||
#else
|
||||
val >>= 8*(sizeof (unw_word_t) - 1 - off);
|
||||
#endif
|
||||
*valp = (uint8_t) val;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint16_t *val, void *arg)
|
||||
{
|
||||
uint8_t v0, v1;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu8 (as, a, addr, &v0, arg)) < 0
|
||||
|| (ret = dwarf_readu8 (as, a, addr, &v1, arg)) < 0)
|
||||
return ret;
|
||||
|
||||
if (tdep_big_endian (as))
|
||||
*val = (uint16_t) v0 << 8 | v1;
|
||||
else
|
||||
*val = (uint16_t) v1 << 8 | v0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint32_t *val, void *arg)
|
||||
{
|
||||
uint16_t v0, v1;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu16 (as, a, addr, &v0, arg)) < 0
|
||||
|| (ret = dwarf_readu16 (as, a, addr, &v1, arg)) < 0)
|
||||
return ret;
|
||||
|
||||
if (tdep_big_endian (as))
|
||||
*val = (uint32_t) v0 << 16 | v1;
|
||||
else
|
||||
*val = (uint32_t) v1 << 16 | v0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
uint64_t *val, void *arg)
|
||||
{
|
||||
uint32_t v0, v1;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu32 (as, a, addr, &v0, arg)) < 0
|
||||
|| (ret = dwarf_readu32 (as, a, addr, &v1, arg)) < 0)
|
||||
return ret;
|
||||
|
||||
if (tdep_big_endian (as))
|
||||
*val = (uint64_t) v0 << 32 | v1;
|
||||
else
|
||||
*val = (uint64_t) v1 << 32 | v0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int8_t *val, void *arg)
|
||||
{
|
||||
uint8_t uval;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu8 (as, a, addr, &uval, arg)) < 0)
|
||||
return ret;
|
||||
*val = (int8_t) uval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int16_t *val, void *arg)
|
||||
{
|
||||
uint16_t uval;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu16 (as, a, addr, &uval, arg)) < 0)
|
||||
return ret;
|
||||
*val = (int16_t) uval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int32_t *val, void *arg)
|
||||
{
|
||||
uint32_t uval;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu32 (as, a, addr, &uval, arg)) < 0)
|
||||
return ret;
|
||||
*val = (int32_t) uval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
int64_t *val, void *arg)
|
||||
{
|
||||
uint64_t uval;
|
||||
int ret;
|
||||
|
||||
if ((ret = dwarf_readu64 (as, a, addr, &uval, arg)) < 0)
|
||||
return ret;
|
||||
*val = (int64_t) uval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
unw_word_t *val, void *arg)
|
||||
{
|
||||
switch (sizeof (unw_word_t))
|
||||
{
|
||||
case 4:
|
||||
return dwarf_readu32 (as, a, addr, (uint32_t *) val, arg);
|
||||
|
||||
case 8:
|
||||
return dwarf_readu64 (as, a, addr, (uint64_t *) val, arg);
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !UNW_LOCAL_ONLY */
|
||||
|
||||
/* Read an unsigned "little-endian base 128" value. See Chapter 7.6
|
||||
of DWARF spec v3. */
|
||||
|
||||
static inline int
|
||||
dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
unw_word_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val = 0, shift = 0;
|
||||
unsigned char byte;
|
||||
int ret;
|
||||
|
||||
do
|
||||
{
|
||||
if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0)
|
||||
return ret;
|
||||
|
||||
val |= ((unw_word_t) byte & 0x7f) << shift;
|
||||
shift += 7;
|
||||
}
|
||||
while (byte & 0x80);
|
||||
|
||||
*valp = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read a signed "little-endian base 128" value. See Chapter 7.6 of
|
||||
DWARF spec v3. */
|
||||
|
||||
static inline int
|
||||
dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
|
||||
unw_word_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val = 0, shift = 0;
|
||||
unsigned char byte;
|
||||
int ret;
|
||||
|
||||
do
|
||||
{
|
||||
if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0)
|
||||
return ret;
|
||||
|
||||
val |= ((unw_word_t) byte & 0x7f) << shift;
|
||||
shift += 7;
|
||||
}
|
||||
while (byte & 0x80);
|
||||
|
||||
if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0)
|
||||
/* sign-extend negative value */
|
||||
val |= ((unw_word_t) -1) << shift;
|
||||
|
||||
*valp = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* DWARF_I_H */
|
|
@ -0,0 +1,32 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
/* Use glibc's jump-buffer indices; NPTL peeks at SP and BSP: */
|
||||
|
||||
#define JB_SP 0
|
||||
#define JB_RP 8
|
||||
#define JB_BSP 17
|
||||
#define JB_MASK_SAVED 70
|
||||
#define JB_MASK 71
|
|
@ -0,0 +1,63 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#ifndef libunwind_ptrace_h
|
||||
#define libunwind_ptrace_h
|
||||
|
||||
#include <libunwind.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Helper routines which make it easy to use libunwind via ptrace().
|
||||
They're available only if UNW_REMOTE_ONLY is _not_ defined and they
|
||||
aren't really part of the libunwind API. They are implemented in a
|
||||
archive library called libunwind-ptrace.a. */
|
||||
|
||||
extern void *_UPT_create (pid_t);
|
||||
extern void _UPT_destroy (void *);
|
||||
extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t,
|
||||
unw_proc_info_t *, int, void *);
|
||||
extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *);
|
||||
extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *,
|
||||
void *);
|
||||
extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int,
|
||||
void *);
|
||||
extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *,
|
||||
int, void *);
|
||||
extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
|
||||
int, void *);
|
||||
extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t,
|
||||
unw_word_t *, void *);
|
||||
extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *);
|
||||
extern unw_accessors_t _UPT_accessors;
|
||||
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libunwind_ptrace_h */
|
127
include/remote.h
127
include/remote.h
|
@ -0,0 +1,127 @@
|
|||
#ifndef REMOTE_H
|
||||
#define REMOTE_H
|
||||
|
||||
/* Helper functions for accessing (remote) memory. These functions
|
||||
assume that all addresses are naturally aligned (e.g., 32-bit
|
||||
quantity is stored at a 32-bit-aligned address. */
|
||||
|
||||
#ifdef UNW_LOCAL_ONLY
|
||||
|
||||
static inline int
|
||||
fetch8 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int8_t *valp, void *arg)
|
||||
{
|
||||
*valp = *(int8_t *) *addr;
|
||||
*addr += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetch16 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int16_t *valp, void *arg)
|
||||
{
|
||||
*valp = *(int16_t *) *addr;
|
||||
*addr += 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetch32 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int32_t *valp, void *arg)
|
||||
{
|
||||
*valp = *(int32_t *) *addr;
|
||||
*addr += 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetchw (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, unw_word_t *valp, void *arg)
|
||||
{
|
||||
*valp = *(unw_word_t *) *addr;
|
||||
*addr += sizeof (unw_word_t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !UNW_LOCAL_ONLY */
|
||||
|
||||
#define WSIZE (sizeof (unw_word_t))
|
||||
|
||||
static inline int
|
||||
fetch8 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int8_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
|
||||
int ret;
|
||||
|
||||
*addr += 1;
|
||||
|
||||
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
val >>= 8*off;
|
||||
#else
|
||||
val >>= 8*(WSIZE - 1 - off);
|
||||
#endif
|
||||
*valp = val & 0xff;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetch16 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int16_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
|
||||
int ret;
|
||||
|
||||
assert ((off & 0x1) == 0);
|
||||
|
||||
*addr += 2;
|
||||
|
||||
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
val >>= 8*off;
|
||||
#else
|
||||
val >>= 8*(WSIZE - 2 - off);
|
||||
#endif
|
||||
*valp = val & 0xffff;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetch32 (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, int32_t *valp, void *arg)
|
||||
{
|
||||
unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
|
||||
int ret;
|
||||
|
||||
assert ((off & 0x3) == 0);
|
||||
|
||||
*addr += 4;
|
||||
|
||||
ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
val >>= 8*off;
|
||||
#else
|
||||
val >>= 8*(WSIZE - 4 - off);
|
||||
#endif
|
||||
*valp = val & 0xffffffff;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fetchw (unw_addr_space_t as, unw_accessors_t *a,
|
||||
unw_word_t *addr, unw_word_t *valp, void *arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = (*a->access_mem) (as, *addr, valp, 0, arg);
|
||||
*addr += WSIZE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !UNW_LOCAL_ONLY */
|
||||
|
||||
#endif /* REMOTE_H */
|
|
@ -0,0 +1,31 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
|
||||
|
||||
#define JB_SP 4
|
||||
#define JB_RP 5
|
||||
#define JB_MASK_SAVED 6
|
||||
#define JB_MASK 7
|
|
@ -0,0 +1,31 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
|
||||
|
||||
#define JB_SP 6
|
||||
#define JB_RP 7
|
||||
#define JB_MASK_SAVED 8
|
||||
#define JB_MASK 9
|
|
@ -0,0 +1,44 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2003 Hewlett-Packard Co
|
||||
Contributed by ...
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "unwind_i.h"
|
||||
|
||||
static inline int
|
||||
common_init (struct cursor *c)
|
||||
{
|
||||
int ret;
|
||||
|
||||
c->ip_loc = HPPA_REG_LOC (c, UNW_HPPA_IP);
|
||||
c->sp_loc = HPPA_REG_LOC (c, UNW_HPPA_SP);
|
||||
|
||||
ret = hppa_get (c, c->ip_loc, &c->ip);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = hppa_get (c, HPPA_REG_LOC (c, UNW_HPPA_SP), &c->sp);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
.global _UI_longjmp_cont
|
||||
|
||||
.align 32
|
||||
.proc longjmp_continuation
|
||||
longjmp_continuation:
|
||||
_UI_longjmp_cont: // non-function label for {sig,}longjmp.c
|
||||
.prologue
|
||||
.save rp, r15
|
||||
.body
|
||||
mov rp = r15
|
||||
mov r8 = r16
|
||||
br.sptk.many rp
|
||||
.endp longjmp_continuation
|
|
@ -0,0 +1,34 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "tdep.h"
|
||||
|
||||
PROTECTED int
|
||||
unw_get_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t *valp)
|
||||
{
|
||||
struct cursor *c = (struct cursor *) cursor;
|
||||
|
||||
return tdep_access_fpreg (c, regnum, valp, 0);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "tdep.h"
|
||||
|
||||
PROTECTED int
|
||||
unw_set_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t val)
|
||||
{
|
||||
struct cursor *c = (struct cursor *) cursor;
|
||||
|
||||
return tdep_access_fpreg (c, regnum, &val, 1);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gdestroy_addr_space.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gget_accessors.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gget_fpreg.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gget_reg.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gset_caching_policy.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gset_fpreg.c"
|
||||
#endif
|
|
@ -0,0 +1,5 @@
|
|||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||
#include "Gset_reg.c"
|
||||
#endif
|
|
@ -0,0 +1,51 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 BEA Systems
|
||||
Contributed by Thomas Hallgren <thallgre@bea.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/* Returns the text corresponding to the given err_code or the
|
||||
text "invalid error code" if the err_code is invalid. */
|
||||
const char *
|
||||
unw_strerror (int err_code)
|
||||
{
|
||||
const char *cp;
|
||||
unw_error_t error = (unw_error_t)-err_code;
|
||||
switch (error)
|
||||
{
|
||||
case UNW_ESUCCESS: cp = "no error"; break;
|
||||
case UNW_EUNSPEC: cp = "unspecified (general) error"; break;
|
||||
case UNW_ENOMEM: cp = "out of memory"; break;
|
||||
case UNW_EBADREG: cp = "bad register number"; break;
|
||||
case UNW_EREADONLYREG: cp = "attempt to write read-only register"; break;
|
||||
case UNW_ESTOPUNWIND: cp = "stop unwinding"; break;
|
||||
case UNW_EINVALIDIP: cp = "invalid IP"; break;
|
||||
case UNW_EBADFRAME: cp = "bad frame"; break;
|
||||
case UNW_EINVAL: cp = "unsupported operation or bad value"; break;
|
||||
case UNW_EBADVERSION: cp = "unwind info has unsupported version"; break;
|
||||
case UNW_ENOINFO: cp = "no unwind info found"; break;
|
||||
default: cp = "invalid error code";
|
||||
}
|
||||
return cp;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2004 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv, char **envp)
|
||||
{
|
||||
char *program, **child_argv;
|
||||
struct timeval start, stop;
|
||||
double secs;
|
||||
int status, i;
|
||||
long count;
|
||||
pid_t pid;
|
||||
|
||||
count = atol (argv[1]);
|
||||
program = argv[2];
|
||||
|
||||
child_argv = alloca ((argc - 1) * sizeof (char *));
|
||||
for (i = 0; i < argc - 2; ++i)
|
||||
child_argv[i] = argv[2 + i];
|
||||
child_argv[i] = NULL;
|
||||
|
||||
gettimeofday (&start, NULL);
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
pid = fork ();
|
||||
if (pid == 0)
|
||||
{
|
||||
execve (program, child_argv, envp);
|
||||
_exit (-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
waitpid (pid, &status, 0);
|
||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: child failed\n", argv[0]);
|
||||
exit (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
gettimeofday (&stop, NULL);
|
||||
|
||||
secs = ((stop.tv_sec + 1e-6 * stop.tv_usec)
|
||||
- (start.tv_sec + 1e-6 * start.tv_usec));
|
||||
printf ("%lu nsec/execution\n",
|
||||
(unsigned long) (1e9 * secs / (double) count));
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#define NSTACKS 1024
|
||||
#define STACK_SIZE_SHIFT 17
|
||||
#define STACK_SIZE (1 << STACK_SIZE_SHIFT)
|
0
tests/run-check-namespace
Normal file → Executable file
0
tests/run-check-namespace
Normal file → Executable file
0
tests/run-ia64-test-dyn1
Normal file → Executable file
0
tests/run-ia64-test-dyn1
Normal file → Executable file
0
tests/run-ptrace-mapper
Normal file → Executable file
0
tests/run-ptrace-mapper
Normal file → Executable file
0
tests/run-ptrace-misc
Normal file → Executable file
0
tests/run-ptrace-misc
Normal file → Executable file
|
@ -0,0 +1,17 @@
|
|||
#include <libunwind.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i, verbose = argc > 1;
|
||||
const char *msg;
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
msg = unw_strerror (-i);
|
||||
if (verbose)
|
||||
printf ("%6d -> %s\n", -i, msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue