Import libexecinfo 1.1 as devel/libexecinfo
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.
This commit is contained in:
parent
3e48e72ed3
commit
2ee4b9b117
6 changed files with 114 additions and 0 deletions
4
devel/libexecinfo/DESCR
Normal file
4
devel/libexecinfo/DESCR
Normal 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.
|
24
devel/libexecinfo/Makefile
Normal file
24
devel/libexecinfo/Makefile
Normal file
|
@ -0,0 +1,24 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 2013/03/14 22:27:15 asau Exp $
|
||||
|
||||
DISTNAME= libexecinfo-1.1
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= $(MASTER_SITE_FREEBSD)
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
|
||||
MAINTAINER= ober@NetBSD.org
|
||||
HOMEPAGE= http://www.freebsdsoftware.org/devel/libexecinfo.html
|
||||
COMMENT= BSD Licensed clone of backtrace facility found in GNU libc
|
||||
LICENSE= 2-clause-bsd
|
||||
|
||||
USE_BSD_MAKEFILE= yes
|
||||
MAKE_FLAGS+= MKLINT=no
|
||||
|
||||
CFLAGS.Linux+= -D_GNU_SOURCE # Dl_info internals
|
||||
CFLAGS.Linux+= -Wno-unused-result # write(2) is declared specially
|
||||
|
||||
INSTALLATION_DIRS= include lib
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA} ${WRKSRC}/execinfo.h ${DESTDIR}${PREFIX}/include
|
||||
|
||||
.include "../../mk/bsd.pkg.mk"
|
7
devel/libexecinfo/PLIST
Normal file
7
devel/libexecinfo/PLIST
Normal file
|
@ -0,0 +1,7 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2013/03/14 22:27:15 asau Exp $
|
||||
include/execinfo.h
|
||||
lib/libexecinfo.a
|
||||
lib/libexecinfo.so
|
||||
lib/libexecinfo.so.1
|
||||
lib/libexecinfo.so.1.0
|
||||
lib/libexecinfo_pic.a
|
13
devel/libexecinfo/buildlink3.mk
Normal file
13
devel/libexecinfo/buildlink3.mk
Normal file
|
@ -0,0 +1,13 @@
|
|||
# $NetBSD: buildlink3.mk,v 1.1.1.1 2013/03/14 22:27:15 asau Exp $
|
||||
|
||||
BUILDLINK_TREE+= libexecinfo
|
||||
|
||||
.if !defined(LIBEXECINFO_BUILDLINK3_MK)
|
||||
LIBEXECINFO_BUILDLINK3_MK:=
|
||||
|
||||
BUILDLINK_API_DEPENDS.libexecinfo+= libexecinfo>=1.1
|
||||
BUILDLINK_ABI_DEPENDS.libexecinfo+= libexecinfo>=1.1
|
||||
BUILDLINK_PKGSRCDIR.libexecinfo?= ../../devel/libexecinfo
|
||||
.endif # LIBEXECINFO_BUILDLINK3_MK
|
||||
|
||||
BUILDLINK_TREE+= -libexecinfo
|
6
devel/libexecinfo/distinfo
Normal file
6
devel/libexecinfo/distinfo
Normal file
|
@ -0,0 +1,6 @@
|
|||
$NetBSD: distinfo,v 1.1.1.1 2013/03/14 22:27:15 asau Exp $
|
||||
|
||||
SHA1 (libexecinfo-1.1.tar.bz2) = a2330eae993880850a90ccfdc389a89cdd7f95ab
|
||||
RMD160 (libexecinfo-1.1.tar.bz2) = b2227d4095be0002185b667b9fde71cd876a4ed7
|
||||
Size (libexecinfo-1.1.tar.bz2) = 4841 bytes
|
||||
SHA1 (patch-execinfo.c) = 01a2337029c623f6e2385c74ca9f7f2a34569356
|
60
devel/libexecinfo/patches/patch-execinfo.c
Normal file
60
devel/libexecinfo/patches/patch-execinfo.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
$NetBSD: patch-execinfo.c,v 1.1.1.1 2013/03/14 22:27:15 asau Exp $
|
||||
|
||||
Patch from FreeBSD ports devel/libexecinfo. Makes execinfo.c compilable
|
||||
|
||||
--- execinfo.c.orig
|
||||
+++ execinfo.c
|
||||
@@ -69,7 +69,8 @@
|
||||
char **
|
||||
backtrace_symbols(void *const *buffer, int size)
|
||||
{
|
||||
- int i, clen, alen, offset;
|
||||
+ size_t clen, alen;
|
||||
+ int i, offset;
|
||||
char **rval;
|
||||
char *cp;
|
||||
Dl_info info;
|
||||
@@ -78,7 +79,6 @@
|
||||
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 +92,14 @@
|
||||
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,12 +108,15 @@
|
||||
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] += (long) rval;
|
||||
+
|
||||
return rval;
|
||||
}
|
||||
|
Loading…
Reference in a new issue