Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 05:31:46 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r418513 - in head/devel: . dwarves dwarves/files
Message-ID:  <201607140531.u6E5VkSG041584@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem (src committer)
Date: Thu Jul 14 05:31:46 2016
New Revision: 418513
URL: https://svnweb.freebsd.org/changeset/ports/418513

Log:
  New port: devel/dwarves
  
  Dwarves is a collection of debuginfo manipulating and inspecting libraries and
  programs, including the popular 'pahole' tool.
  
  WWW: https://acmel.wordpress.com/category/kernel-hacking/
  Git: http://repo.or.cz/dwarves.git (Github repo is stale)
  
  Sponsored by:	EMC / Isilon Storage Division

Added:
  head/devel/dwarves/
  head/devel/dwarves/Makefile   (contents, props changed)
  head/devel/dwarves/distinfo   (contents, props changed)
  head/devel/dwarves/files/
  head/devel/dwarves/files/patch-CMakeLists.txt   (contents, props changed)
  head/devel/dwarves/files/patch-ctf__loader.c   (contents, props changed)
  head/devel/dwarves/files/patch-dtagnames.c   (contents, props changed)
  head/devel/dwarves/files/patch-dutil.h   (contents, props changed)
  head/devel/dwarves/files/patch-dwarves.c   (contents, props changed)
  head/devel/dwarves/files/patch-dwarves__fprintf.c   (contents, props changed)
  head/devel/dwarves/files/patch-elf__symtab.c   (contents, props changed)
  head/devel/dwarves/files/patch-exitfail.h   (contents, props changed)
  head/devel/dwarves/files/patch-libctf.c   (contents, props changed)
  head/devel/dwarves/files/patch-pdwtags.c   (contents, props changed)
  head/devel/dwarves/files/patch-pglobal.c   (contents, props changed)
  head/devel/dwarves/files/patch-prefcnt.c   (contents, props changed)
  head/devel/dwarves/files/patch-strings.c   (contents, props changed)
  head/devel/dwarves/pkg-descr   (contents, props changed)
  head/devel/dwarves/pkg-plist   (contents, props changed)
Modified:
  head/devel/Makefile

Modified: head/devel/Makefile
==============================================================================
--- head/devel/Makefile	Thu Jul 14 05:31:03 2016	(r418512)
+++ head/devel/Makefile	Thu Jul 14 05:31:46 2016	(r418513)
@@ -408,6 +408,7 @@
     SUBDIR += dulwich
     SUBDIR += duplo
     SUBDIR += dwarfdump
+    SUBDIR += dwarves
     SUBDIR += dxa65
     SUBDIR += dyncall
     SUBDIR += e00compr

Added: head/devel/dwarves/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/Makefile	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,40 @@
+# Created by: Conrad Meyer <cem@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	dwarves
+PORTVERSION=	1.10
+CATEGORIES=	devel
+MASTER_SITES=	https://fedorapeople.org/~acme/dwarves/
+# http://fedorapeople.org/~acme/dwarves/%{name}-%{version}.tar.bz2
+# git: http://repo.or.cz/dwarves.git
+# ML: http://news.gmane.org/gmane.comp.debugging.dwarves
+
+MAINTAINER=	cem@FreeBSD.org
+COMMENT=	Debugging Information Manipulation Tools
+
+LICENSE=	GPLv2
+LICENSE_FILE_GPLv2=	$(WRKSRC)/COPYING
+
+LIB_DEPENDS=	libargp.so:devel/argp-standalone \
+		libdw.so:devel/elfutils
+BUILD_DEPENDS=	cmake>=0:devel/cmake \
+		gnulib>=0:devel/gnulib
+
+# Source is a tarbomb:
+WRKSRC=		$(WRKDIR)
+
+USES=		cmake:outsource localbase tar:bzip2
+USE_LDCONFIG=	yes
+
+#CMAKE_VERBOSE=	1
+
+post-patch:
+	@${CP} -a \
+	    $(LOCALBASE)/share/gnulib/lib/gettext.h \
+	    $(LOCALBASE)/share/gnulib/lib/obstack.c \
+	    $(LOCALBASE)/share/gnulib/lib/obstack.h \
+	    $(WRKSRC)/
+	@${REINPLACE_CMD} -e 's|_GL_ATTRIBUTE_PURE|__attribute__((__pure__))|g' \
+	    $(WRKSRC)/obstack.h $(WRKSRC)/obstack.c
+
+.include <bsd.port.mk>

Added: head/devel/dwarves/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/distinfo	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1468468005
+SHA256 (dwarves-1.10.tar.bz2) = 557306e1b58b475f689f44095ec62388877b1a8dd06174f97e309994c15bcc14
+SIZE (dwarves-1.10.tar.bz2) = 96919

Added: head/devel/dwarves/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-CMakeLists.txt	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,66 @@
+--- CMakeLists.txt.orig	2012-03-20 16:17:25 UTC
++++ CMakeLists.txt
+@@ -31,11 +31,14 @@ add_definitions(-D_GNU_SOURCE -DDWARVES_
+ find_package(DWARF REQUIRED)
+ find_package(ZLIB REQUIRED)
+ 
+-_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${__LIB}" "libdir")
++# For argp-standalone
++find_library(ARGP argp ${LOCALBASE}/lib)
++
++_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/lib${__LIB}" "libdir")
+ 
+ set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings
+ 		     ctf_encoder.c ctf_loader.c libctf.c dwarf_loader.c
+-		     dutil.c elf_symtab.c rbtree.c)
++		     dutil.c elf_symtab.c rbtree.c obstack.c)
+ add_library(dwarves SHARED ${dwarves_LIB_SRCS})
+ set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1)
+ set_target_properties(dwarves PROPERTIES LINK_INTERFACE_LIBRARIES "")
+@@ -53,11 +56,11 @@ target_link_libraries(dwarves_reorganize
+ 
+ set(codiff_SRCS codiff.c)
+ add_executable(codiff ${codiff_SRCS})
+-target_link_libraries(codiff dwarves)
++target_link_libraries(codiff dwarves ${ARGP})
+ 
+ set(ctracer_SRCS ctracer.c)
+ add_executable(ctracer ${ctracer_SRCS})
+-target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY})
++target_link_libraries(ctracer dwarves dwarves_emit dwarves_reorganize ${ELF_LIBRARY} ${ARGP})
+ 
+ set(dtagnames_SRCS dtagnames.c)
+ add_executable(dtagnames ${dtagnames_SRCS})
+@@ -65,19 +68,19 @@ target_link_libraries(dtagnames dwarves)
+ 
+ set(pahole_SRCS pahole.c)
+ add_executable(pahole ${pahole_SRCS})
+-target_link_libraries(pahole dwarves dwarves_reorganize)
++target_link_libraries(pahole dwarves dwarves_reorganize ${ARGP})
+ 
+ set(pdwtags_SRCS pdwtags.c)
+ add_executable(pdwtags ${pdwtags_SRCS})
+-target_link_libraries(pdwtags dwarves)
++target_link_libraries(pdwtags dwarves ${ARGP})
+ 
+ set(pglobal_SRCS pglobal.c)
+ add_executable(pglobal ${pglobal_SRCS})
+-target_link_libraries(pglobal dwarves)
++target_link_libraries(pglobal dwarves ${ARGP})
+ 
+ set(pfunct_SRCS pfunct.c )
+ add_executable(pfunct ${pfunct_SRCS})
+-target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY})
++target_link_libraries(pfunct dwarves dwarves_emit ${ELF_LIBRARY} ${ARGP})
+ 
+ set(prefcnt_SRCS prefcnt.c)
+ add_executable(prefcnt ${prefcnt_SRCS})
+@@ -89,7 +92,7 @@ target_link_libraries(scncopy dwarves ${
+ 
+ set(syscse_SRCS syscse.c)
+ add_executable(syscse ${syscse_SRCS})
+-target_link_libraries(syscse dwarves)
++target_link_libraries(syscse dwarves ${ARGP})
+ 
+ install(TARGETS codiff ctracer dtagnames pahole pdwtags
+ 		pfunct pglobal prefcnt scncopy syscse RUNTIME DESTINATION

Added: head/devel/dwarves/files/patch-ctf__loader.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-ctf__loader.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,10 @@
+--- ctf_loader.c.orig	2012-03-20 16:17:25 UTC
++++ ctf_loader.c
+@@ -11,7 +11,6 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <stddef.h>
+-#include <malloc.h>
+ #include <string.h>
+ #include <limits.h>
+ #include <libgen.h>

Added: head/devel/dwarves/files/patch-dtagnames.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-dtagnames.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,37 @@
+--- dtagnames.c.orig	2012-03-20 16:17:25 UTC
++++ dtagnames.c
+@@ -9,16 +9,33 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <malloc.h>
++
++/* For mallctl */
++#include <err.h>
++#include <errno.h>
++#include <malloc_np.h>
+ 
+ #include "dwarves.h"
+ #include "dutil.h"
+ 
+ static void print_malloc_stats(void)
+ {
++#if 0
+ 	struct mallinfo m = mallinfo();
+ 
+ 	fprintf(stderr, "size: %u\n", m.uordblks);
++#else
++	size_t allocated, olen;
++	int rc;
++
++	olen = sizeof(allocated);
++	rc = mallctl("stats.allocated", &allocated, &olen, NULL, 0);
++	if (rc != 0) {
++		errno = rc;
++		err(1, "mallctl stats.allocated");
++	}
++	fprintf(stderr, "size: %zu\n", allocated);
++#endif
+ }
+ 
+ static int class__tag_name(struct tag *self, struct cu *cu __unused,

Added: head/devel/dwarves/files/patch-dutil.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-dutil.h	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,12 @@
+--- dutil.h.orig	2012-03-20 16:17:25 UTC
++++ dutil.h
+@@ -25,7 +25,9 @@
+ #define __pure __attribute__ ((pure))
+ #endif
+ 
++#ifndef roundup
+ #define roundup(x,y) ((((x) + ((y) - 1)) / (y)) * (y))
++#endif
+ 
+ static inline __attribute__((const)) bool is_power_of_2(unsigned long n)
+ {

Added: head/devel/dwarves/files/patch-dwarves.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-dwarves.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,11 @@
+--- dwarves.c.orig	2012-03-20 16:17:25 UTC
++++ dwarves.c
+@@ -16,6 +16,8 @@
+ #include <fcntl.h>
+ #include <fnmatch.h>
+ #include <libelf.h>
++/* For PATH_MAX */
++#include <limits.h>
+ #include <search.h>
+ #include <stdio.h>
+ #include <stdlib.h>

Added: head/devel/dwarves/files/patch-dwarves__fprintf.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-dwarves__fprintf.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,35 @@
+--- dwarves_fprintf.c.orig	2012-03-20 16:18:48 UTC
++++ dwarves_fprintf.c
+@@ -9,6 +9,9 @@
+   published by the Free Software Foundation.
+ */
+ 
++/* For CACHE_LINE_SIZE */
++#include <sys/param.h>
++
+ #include <dwarf.h>
+ #include <errno.h>
+ #include <stdio.h>
+@@ -74,7 +77,6 @@ static const char *dwarf_tag_names[] = {
+ 	[DW_TAG_unspecified_type]	  = "unspecified_type",
+ 	[DW_TAG_partial_unit]		  = "partial_unit",
+ 	[DW_TAG_imported_unit]		  = "imported_unit",
+-	[DW_TAG_mutable_type]		  = "mutable_type",
+ 	[DW_TAG_condition]		  = "condition",
+ 	[DW_TAG_shared_type]		  = "shared_type",
+ #ifdef STB_GNU_UNIQUE
+@@ -1664,7 +1666,14 @@ void cus__print_error_msg(const char *pr
+ void dwarves__fprintf_init(uint16_t user_cacheline_size)
+ {
+ 	if (user_cacheline_size == 0) {
++#if 0
+ 		long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
++#else
++		/*
++		 * CEM: Ideally we could get this programmatically.
++		 */
++		long sys_cacheline_size = CACHE_LINE_SIZE;
++#endif
+ 
+ 		if (sys_cacheline_size > 0)
+ 			cacheline_size = sys_cacheline_size;

Added: head/devel/dwarves/files/patch-elf__symtab.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-elf__symtab.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,12 @@
+--- elf_symtab.c.orig	2012-03-20 16:17:25 UTC
++++ elf_symtab.c
+@@ -7,8 +7,8 @@
+   published by the Free Software Foundation.
+ */
+ 
+-#include <malloc.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ 
+ #include "dutil.h"

Added: head/devel/dwarves/files/patch-exitfail.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-exitfail.h	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,5 @@
+--- exitfail.h.orig	2016-07-14 04:42:52 UTC
++++ exitfail.h
+@@ -0,0 +1,2 @@
++#pragma once
++#define	exit_failure	EXIT_FAILURE

Added: head/devel/dwarves/files/patch-libctf.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-libctf.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,12 @@
+--- libctf.c.orig	2012-03-20 16:17:25 UTC
++++ libctf.c
+@@ -1,7 +1,8 @@
++#include <sys/stat.h>
++
+ #include <fcntl.h>
+ #include <gelf.h>
+ #include <limits.h>
+-#include <malloc.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>

Added: head/devel/dwarves/files/patch-pdwtags.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-pdwtags.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,10 @@
+--- pdwtags.c.orig	2012-05-14 22:41:11 UTC
++++ pdwtags.c
+@@ -9,7 +9,6 @@
+ #include <argp.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <malloc.h>
+ 
+ #include "dwarves.h"
+ #include "dutil.h"

Added: head/devel/dwarves/files/patch-pglobal.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-pglobal.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,38 @@
+--- pglobal.c.orig	2012-03-20 16:17:25 UTC
++++ pglobal.c
+@@ -8,7 +8,6 @@
+  */
+ 
+ #include <argp.h>
+-#include <malloc.h>
+ #include <search.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -92,7 +91,7 @@ static void extvar__add(const struct var
+ 		nodep = tsearch(gvar, &tree, extvar__compare);
+ 		if (nodep == NULL)
+ 			oom("tsearch");
+-		else if (*nodep != gvar)
++		else if (*nodep != gvar) {
+ 			if (gvar->var->declaration) {
+ 				gvar->next = (*nodep)->next;
+ 				(*nodep)->next = gvar;
+@@ -100,6 +99,7 @@ static void extvar__add(const struct var
+ 				gvar->next = *nodep;
+ 				*nodep = gvar;
+ 			}
++		}
+ 	}
+ }
+ 
+@@ -313,7 +313,10 @@ int main(int argc, char *argv[])
+ 		twalk(tree, function_action__walk);
+ 	}
+ 
++#if 0
++	/* Our search.h doesn't implement tdestroy; leak for now. */
+ 	tdestroy(tree, free_node);
++#endif
+ 	rc = EXIT_SUCCESS;
+ out_cus_delete:
+ 	cus__delete(cus);

Added: head/devel/dwarves/files/patch-prefcnt.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-prefcnt.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,16 @@
+--- prefcnt.c.orig	2012-03-20 16:17:25 UTC
++++ prefcnt.c
+@@ -66,9 +66,11 @@ static void refcnt_tag(struct tag *tag, 
+ 
+ 	tag->visited = 1;
+ 
+-	if (tag__is_struct(tag) || tag__is_union(tag))
+-		type__for_each_member(tag__type(tag), member)
++	if (tag__is_struct(tag) || tag__is_union(tag)) {
++		type__for_each_member(tag__type(tag), member) {
+ 			refcnt_member(member, cu);
++		}
++	}
+ }
+ 
+ static void refcnt_lexblock(const struct lexblock *lexblock, const struct cu *cu)

Added: head/devel/dwarves/files/patch-strings.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/files/patch-strings.c	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,13 @@
+--- strings.c.orig	2012-03-20 16:17:25 UTC
++++ strings.c
+@@ -39,7 +39,10 @@ void strings__delete(struct strings *sel
+ {
+ 	if (self == NULL)
+ 		return;
++#if 0
++	/* Our search.h doesn't implement tdestroy; leak for now. */
+ 	tdestroy(self->tree, do_nothing);
++#endif
+ 	__gobuffer__delete(&self->gb);
+ 	free(self);
+ }

Added: head/devel/dwarves/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/pkg-descr	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,18 @@
+Dwarves is a set of tools that use the debugging information inserted in ELF
+binaries by compilers such as GCC, used by well known debuggers such as GDB,
+and more recent ones such as systemtap.
+
+Utilities in the dwarves suite include pahole, that can be used to find
+alignment holes in structs and classes in languages such as C, C++, but not
+limited to these.
+
+It also extracts other information such as CPU cacheline alignment, helping
+pack those structures to achieve more cache hits.
+
+A diff like tool, codiff can be used to compare the effects changes in source
+code generate on the resulting binaries.
+
+Another tool is pfunct, that can be used to find all sorts of information about
+functions, inlines, decisions made by the compiler about inlining, etc.
+
+WWW: http://acmel.wordpress.com/

Added: head/devel/dwarves/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/dwarves/pkg-plist	Thu Jul 14 05:31:46 2016	(r418513)
@@ -0,0 +1,34 @@
+bin/codiff
+bin/ctracer
+bin/dtagnames
+bin/ostra-cg
+bin/pahole
+bin/pdwtags
+bin/pfunct
+bin/pglobal
+bin/prefcnt
+bin/scncopy
+bin/syscse
+include/dwarves/dutil.h
+include/dwarves/dwarves.h
+include/dwarves/dwarves_emit.h
+include/dwarves/dwarves_reorganize.h
+include/dwarves/gobuffer.h
+include/dwarves/list.h
+include/dwarves/rbtree.h
+include/dwarves/strings.h
+lib/libdwarves.so
+lib/libdwarves.so.1
+lib/libdwarves.so.1.0.0
+lib/libdwarves_emit.so
+lib/libdwarves_emit.so.1
+lib/libdwarves_emit.so.1.0.0
+lib/libdwarves_reorganize.so
+lib/libdwarves_reorganize.so.1
+lib/libdwarves_reorganize.so.1.0.0
+%%DATADIR%%/runtime/Makefile
+%%DATADIR%%/runtime/ctracer_relay.c
+%%DATADIR%%/runtime/ctracer_relay.h
+%%DATADIR%%/runtime/linux.blacklist.cu
+%%DATADIR%%/runtime/python/ostra.py
+share/man/man1/pahole.1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607140531.u6E5VkSG041584>