mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-22 16:20:29 +01:00
(Logical change 1.245)
This commit is contained in:
parent
7556c9ae61
commit
48cc8c5712
4 changed files with 173 additions and 0 deletions
63
doc/unw_strerror.man
Normal file
63
doc/unw_strerror.man
Normal 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.
|
42
doc/unw_strerror.tex
Normal file
42
doc/unw_strerror.tex
Normal file
|
@ -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}
|
51
src/mi/strerror.c
Normal file
51
src/mi/strerror.c
Normal file
|
@ -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;
|
||||||
|
}
|
17
tests/test-strerror.c
Normal file
17
tests/test-strerror.c
Normal 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