Import libexecinfo-1.1

This is a quick-n-dirty BSD licensed clone of backtrace facility found
in the GNU libc, mainly intended for porting linuxish code to BSD
platforms, however it can be used at any platform which has a gcc
compiler.

from bernd@ (patch-execinfo_c from FreeBSD)
This commit is contained in:
ajacoutot 2008-10-21 17:01:24 +00:00
parent e9715000db
commit bc7fe1a93a
7 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# $OpenBSD: Makefile,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
COMMENT= clone of backtrace facility found in the GNU libc
DISTNAME= libexecinfo-1.1
CATEGORIES= devel
SHARED_LIBS= execinfo 0.0
# BSD
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/itetcu/
EXTRACT_SUFX= .tar.bz2
WANTLIB= m
MAKE_ENV= LIBDIR=${PREFIX}/lib \
LIBexecinfo_MAJOR=${LIBexecinfo_VERSION:R} \
LIBexecinfo_MINOR=${LIBexecinfo_VERSION:E}
post-install:
${INSTALL_DATA} ${WRKBUILD}/*.h ${PREFIX}/include
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (libexecinfo-1.1.tar.bz2) = jp6BxVTBxdc1vId0SOkrkQ==
RMD160 (libexecinfo-1.1.tar.bz2) = siJ9QJW+AAIYW2Z7n95xzYdqTtc=
SHA1 (libexecinfo-1.1.tar.bz2) = ojMOrpk4gIUKkMz9w4monN1/las=
SHA256 (libexecinfo-1.1.tar.bz2) = yaIZE+f9rI72szJQsWeqH8CnuKF1FF4mkTpMGdilmx8=
SIZE (libexecinfo-1.1.tar.bz2) = 4841

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
--- Makefile.orig Mon Dec 10 22:07:49 2007
+++ Makefile Mon Dec 10 22:08:07 2007
@@ -30,8 +30,8 @@ SRCS= stacktraverse.c stacktraverse.h execinfo.c execi
INCS= execinfo.h
-SHLIB_MAJOR= 1
-SHLIB_MINOR= 0
+SHLIB_MAJOR= ${LIBexecinfo_MAJOR}
+SHLIB_MINOR= ${LIBexecinfo_MINOR}
NOPROFILE= yes

View File

@ -0,0 +1,46 @@
$OpenBSD: patch-execinfo_c,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
--- execinfo.c.orig Mon Jul 19 07:21:09 2004
+++ execinfo.c Tue Oct 21 18:40:48 2008
@@ -78,7 +78,6 @@ backtrace_symbols(void *const *buffer, int size)
rval = malloc(clen);
if (rval == NULL)
return NULL;
- (char **)cp = &(rval[size]);
for (i = 0; i < size; i++) {
if (dladdr(buffer[i], &info) != 0) {
if (info.dli_sname == NULL)
@@ -92,14 +91,14 @@ backtrace_symbols(void *const *buffer, int size)
2 + /* " <" */
strlen(info.dli_sname) + /* "function" */
1 + /* "+" */
- D10(offset) + /* "offset */
+ 10 + /* "offset */
5 + /* "> at " */
strlen(info.dli_fname) + /* "filename" */
1; /* "\0" */
rval = realloc_safe(rval, clen + alen);
if (rval == NULL)
return NULL;
- snprintf(cp, alen, "%p <%s+%d> at %s",
+ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
buffer[i], info.dli_sname, offset, info.dli_fname);
} else {
alen = 2 + /* "0x" */
@@ -108,11 +107,14 @@ backtrace_symbols(void *const *buffer, int size)
rval = realloc_safe(rval, clen + alen);
if (rval == NULL)
return NULL;
- snprintf(cp, alen, "%p", buffer[i]);
+ snprintf((char *) rval + clen, alen, "%p", buffer[i]);
}
- rval[i] = cp;
- cp += alen;
+ rval[i] = (char *) clen;
+ clen += alen;
}
+
+ for (i = 0; i < size; i++)
+ rval[i] += (int) rval;
return rval;
}

View File

@ -0,0 +1,4 @@
This is a quick-n-dirty BSD licensed clone of backtrace facility found
in the GNU libc, mainly intended for porting linuxish code to BSD
platforms, however it can be used at any platform which has a gcc
compiler.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
@lib lib/libexecinfo.so.${LIBexecinfo_VERSION}

View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
%%SHARED%%
include/execinfo.h
include/stacktraverse.h
lib/libexecinfo.a
lib/libexecinfo_pic.a