Compile liblttng-ust-baddr c files into liblttng-ust
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 28 Nov 2013 15:38:52 +0000 (16:38 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 28 Nov 2013 15:55:00 +0000 (16:55 +0100)
Move them into liblttng-ust/, where they are now compiled.

This is to ensure we don't rely on statically linked libs (and
associated constructor problems), and that we don't install a shared
object in the system needlessly.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 files changed:
Makefile.am
configure.ac
liblttng-ust-baddr/Makefile.am [deleted file]
liblttng-ust-baddr/lttng-ust-baddr.c [deleted file]
liblttng-ust-baddr/lttng-ust-baddr.h [deleted file]
liblttng-ust-baddr/ust_baddr_statedump.c [deleted file]
liblttng-ust-baddr/ust_baddr_statedump.h [deleted file]
liblttng-ust/Makefile.am
liblttng-ust/lttng-ust-baddr.c [new file with mode: 0644]
liblttng-ust/lttng-ust-baddr.h [new file with mode: 0644]
liblttng-ust/lttng-ust-comm.c
liblttng-ust/ust_baddr_statedump.c [new file with mode: 0644]
liblttng-ust/ust_baddr_statedump.h [new file with mode: 0644]

index 6fab95641fab971faf950728300ddae5cadedc3b..b79d2dd9086fde3e3a524286d129e4f45cdc5e17 100644 (file)
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I config
 
-SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm liblttng-ust-baddr \
+SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm \
                liblttng-ust \
                liblttng-ust-ctl \
                liblttng-ust-fork \
index 60460da5710800504778be4f8ceb64133ff25f05..72a03140d930fe6ba8ba8919363f08bdb823fa3c 100644 (file)
@@ -288,7 +288,6 @@ AC_CONFIG_FILES([
        liblttng-ust/Makefile
        liblttng-ust-ctl/Makefile
        liblttng-ust-fork/Makefile
-       liblttng-ust-baddr/Makefile
        liblttng-ust-dl/Makefile
        liblttng-ust-java/Makefile
        liblttng-ust-jul/Makefile
diff --git a/liblttng-ust-baddr/Makefile.am b/liblttng-ust-baddr/Makefile.am
deleted file mode 100644 (file)
index cdbc0c1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
-AM_CFLAGS = -fno-strict-aliasing
-
-noinst_LTLIBRARIES = liblttng-ust-baddr.la
-
-liblttng_ust_baddr_la_SOURCES = \
-       lttng-ust-baddr.c \
-       ust_baddr_statedump.c \
-       ust_baddr_statedump.h
diff --git a/liblttng-ust-baddr/lttng-ust-baddr.c b/liblttng-ust-baddr/lttng-ust-baddr.c
deleted file mode 100644 (file)
index 1e6e08d..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#define _GNU_SOURCE
-#include <dlfcn.h>
-#include <link.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdio.h>
-#include "usterr.h"
-
-#include "lttng-ust-baddr.h"
-
-#define TRACEPOINT_DEFINE
-#include "ust_baddr_statedump.h"
-
-static int
-extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *data)
-{
-       int j;
-       int num_loadable_segment = 0;
-
-       for (j = 0; j < info->dlpi_phnum; j++) {
-               char resolved_path[PATH_MAX];
-               struct stat sostat;
-               void *base_addr_ptr;
-
-               if (info->dlpi_phdr[j].p_type != PT_LOAD)
-                       continue;
-
-               /* Calculate virtual memory address of the loadable segment */
-               base_addr_ptr = (void *) info->dlpi_addr
-                       + info->dlpi_phdr[j].p_vaddr;
-
-               num_loadable_segment += 1;
-               if ((info->dlpi_name == NULL || info->dlpi_name[0] == 0)
-                               && num_loadable_segment == 1) {
-                       /*
-                        * If the iterated element is the executable itself we
-                        * have to use Dl_info to determine its full path
-                        */
-                       Dl_info dl_info = { 0 };
-                       if (!dladdr(base_addr_ptr, &dl_info))
-                               return 0;
-                       if (!realpath(dl_info.dli_fname, resolved_path))
-                               return 0;
-               } else {
-                       /*
-                        * For regular dl_phdr_info entries we have to check if
-                        * the path to the shared object really exists
-                        */
-                       if (!realpath(info->dlpi_name, resolved_path)) {
-                               /* Found vDSO, put the 'path' into brackets */
-                               snprintf(resolved_path, PATH_MAX - 1, "[%s]",
-                                               info->dlpi_name);
-                       }
-               }
-
-               if (stat(resolved_path, &sostat)) {
-                       sostat.st_size = 0;
-                       sostat.st_mtime = -1;
-               }
-
-               tracepoint(ust_baddr_statedump, soinfo,
-                               (struct lttng_session *) data, base_addr_ptr,
-                               resolved_path, sostat.st_size, sostat.st_mtime);
-
-               /*
-                * We are only interested in the base address (lowest virtual
-                * address associated with the memory image), skip the rest
-                */
-               break;
-       }
-       return 0;
-}
-
-int
-lttng_ust_baddr_statedump(struct lttng_session *session)
-{
-       if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP"))
-               return 0;
-       /*
-        * Iterate through the list of currently loaded shared objects and
-        * generate events for loadable segments using extract_soinfo_events
-        */
-       dl_iterate_phdr(extract_soinfo_events, session);
-       return 0;
-}
diff --git a/liblttng-ust-baddr/lttng-ust-baddr.h b/liblttng-ust-baddr/lttng-ust-baddr.h
deleted file mode 100644 (file)
index d338541..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef LTTNG_UST_BADDR_H
-#define LTTNG_UST_BADDR_H
-
-/*
- * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <lttng/ust-events.h>
-
-int lttng_ust_baddr_statedump(struct lttng_session *session);
-
-#endif /* LTTNG_UST_BADDR_H */
diff --git a/liblttng-ust-baddr/ust_baddr_statedump.c b/liblttng-ust-baddr/ust_baddr_statedump.c
deleted file mode 100644 (file)
index 75f74ca..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#define TRACEPOINT_CREATE_PROBES
-#define TP_SESSION_CHECK
-#include "ust_baddr_statedump.h"
diff --git a/liblttng-ust-baddr/ust_baddr_statedump.h b/liblttng-ust-baddr/ust_baddr_statedump.h
deleted file mode 100644 (file)
index 77a9af4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER ust_baddr_statedump
-
-#if !defined(_TRACEPOINT_UST_BADDR_STATEDUMP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
-#define _TRACEPOINT_UST_BADDR_STATEDUMP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.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 <stdint.h>
-#include <unistd.h>
-#include <lttng/ust-events.h>
-
-#define LTTNG_UST_BADDR_STATEDUMP_PROVIDER
-#include <lttng/tracepoint.h>
-
-TRACEPOINT_EVENT(ust_baddr_statedump, soinfo,
-       TP_ARGS(struct lttng_session *, session, void *, baddr, const char*, sopath, int64_t, size, int64_t, mtime),
-       TP_FIELDS(
-               ctf_integer_hex(void *, baddr, baddr)
-               ctf_string(sopath, sopath)
-               ctf_integer(int64_t, size, size)
-               ctf_integer(int64_t, mtime, mtime)
-       )
-)
-
-#endif /* _TRACEPOINT_UST_BADDR_STATEDUMP_H */
-
-#undef TRACEPOINT_INCLUDE
-#define TRACEPOINT_INCLUDE "./ust_baddr_statedump.h"
-
-/* This part must be outside ifdef protection */
-#include <lttng/tracepoint-event.h>
-
-#ifdef __cplusplus
-}
-#endif
index f00fe45fdf10e536b05608d6cb70402648673066..b165c3219896ccda953f2ace5ad3a1decb3cb110 100644 (file)
@@ -35,6 +35,10 @@ liblttng_ust_runtime_la_SOURCES = \
        lttng-filter-interpreter.c \
        filter-bytecode.h \
        lttng-hash-helper.h \
+       lttng-ust-baddr.c \
+       lttng-ust-baddr.h \
+       ust_baddr_statedump.c \
+       ust_baddr_statedump.h \
        tracepoint-internal.h \
        clock.h \
        compat.h \
@@ -69,7 +73,6 @@ liblttng_ust_la_LIBADD = \
        -lurcu-cds \
        $(top_builddir)/snprintf/libustsnprintf.la \
        $(top_builddir)/liblttng-ust-comm/liblttng-ust-comm.la \
-       $(top_builddir)/liblttng-ust-baddr/liblttng-ust-baddr.la \
        liblttng-ust-tracepoint.la \
        liblttng-ust-runtime.la liblttng-ust-support.la
 
diff --git a/liblttng-ust/lttng-ust-baddr.c b/liblttng-ust/lttng-ust-baddr.c
new file mode 100644 (file)
index 0000000..1e6e08d
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <link.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <stdio.h>
+#include "usterr.h"
+
+#include "lttng-ust-baddr.h"
+
+#define TRACEPOINT_DEFINE
+#include "ust_baddr_statedump.h"
+
+static int
+extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *data)
+{
+       int j;
+       int num_loadable_segment = 0;
+
+       for (j = 0; j < info->dlpi_phnum; j++) {
+               char resolved_path[PATH_MAX];
+               struct stat sostat;
+               void *base_addr_ptr;
+
+               if (info->dlpi_phdr[j].p_type != PT_LOAD)
+                       continue;
+
+               /* Calculate virtual memory address of the loadable segment */
+               base_addr_ptr = (void *) info->dlpi_addr
+                       + info->dlpi_phdr[j].p_vaddr;
+
+               num_loadable_segment += 1;
+               if ((info->dlpi_name == NULL || info->dlpi_name[0] == 0)
+                               && num_loadable_segment == 1) {
+                       /*
+                        * If the iterated element is the executable itself we
+                        * have to use Dl_info to determine its full path
+                        */
+                       Dl_info dl_info = { 0 };
+                       if (!dladdr(base_addr_ptr, &dl_info))
+                               return 0;
+                       if (!realpath(dl_info.dli_fname, resolved_path))
+                               return 0;
+               } else {
+                       /*
+                        * For regular dl_phdr_info entries we have to check if
+                        * the path to the shared object really exists
+                        */
+                       if (!realpath(info->dlpi_name, resolved_path)) {
+                               /* Found vDSO, put the 'path' into brackets */
+                               snprintf(resolved_path, PATH_MAX - 1, "[%s]",
+                                               info->dlpi_name);
+                       }
+               }
+
+               if (stat(resolved_path, &sostat)) {
+                       sostat.st_size = 0;
+                       sostat.st_mtime = -1;
+               }
+
+               tracepoint(ust_baddr_statedump, soinfo,
+                               (struct lttng_session *) data, base_addr_ptr,
+                               resolved_path, sostat.st_size, sostat.st_mtime);
+
+               /*
+                * We are only interested in the base address (lowest virtual
+                * address associated with the memory image), skip the rest
+                */
+               break;
+       }
+       return 0;
+}
+
+int
+lttng_ust_baddr_statedump(struct lttng_session *session)
+{
+       if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP"))
+               return 0;
+       /*
+        * Iterate through the list of currently loaded shared objects and
+        * generate events for loadable segments using extract_soinfo_events
+        */
+       dl_iterate_phdr(extract_soinfo_events, session);
+       return 0;
+}
diff --git a/liblttng-ust/lttng-ust-baddr.h b/liblttng-ust/lttng-ust-baddr.h
new file mode 100644 (file)
index 0000000..d338541
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef LTTNG_UST_BADDR_H
+#define LTTNG_UST_BADDR_H
+
+/*
+ * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <lttng/ust-events.h>
+
+int lttng_ust_baddr_statedump(struct lttng_session *session);
+
+#endif /* LTTNG_UST_BADDR_H */
index 2d3766f1326ff407351e3d41088d2d5c0aacf094..b99bf00edec2df760df075f0ad77597a3e1a54d1 100644 (file)
@@ -52,7 +52,7 @@
 #include "lttng-tracer-core.h"
 #include "compat.h"
 #include "../libringbuffer/tlsfixup.h"
-#include "../liblttng-ust-baddr/lttng-ust-baddr.h"
+#include "lttng-ust-baddr.h"
 
 /*
  * Has lttng ust comm constructor been called ?
diff --git a/liblttng-ust/ust_baddr_statedump.c b/liblttng-ust/ust_baddr_statedump.c
new file mode 100644 (file)
index 0000000..75f74ca
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#define TP_SESSION_CHECK
+#include "ust_baddr_statedump.h"
diff --git a/liblttng-ust/ust_baddr_statedump.h b/liblttng-ust/ust_baddr_statedump.h
new file mode 100644 (file)
index 0000000..77a9af4
--- /dev/null
@@ -0,0 +1,60 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER ust_baddr_statedump
+
+#if !defined(_TRACEPOINT_UST_BADDR_STATEDUMP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_BADDR_STATEDUMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2013  Paul Woegerer <paul_woegerer@mentor.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 <stdint.h>
+#include <unistd.h>
+#include <lttng/ust-events.h>
+
+#define LTTNG_UST_BADDR_STATEDUMP_PROVIDER
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(ust_baddr_statedump, soinfo,
+       TP_ARGS(struct lttng_session *, session, void *, baddr, const char*, sopath, int64_t, size, int64_t, mtime),
+       TP_FIELDS(
+               ctf_integer_hex(void *, baddr, baddr)
+               ctf_string(sopath, sopath)
+               ctf_integer(int64_t, size, size)
+               ctf_integer(int64_t, mtime, mtime)
+       )
+)
+
+#endif /* _TRACEPOINT_UST_BADDR_STATEDUMP_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_baddr_statedump.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
This page took 0.032508 seconds and 4 git commands to generate.