[minicoredumper] Handling of unavailable bytes in minicoredumps by GDB

Simon Marchi simon.marchi at ericsson.com
Fri Jul 8 17:48:34 CEST 2016


On 16-07-07 09:23 AM, John Ogness wrote:
> This is already done implicitly with the check for gelf.h. But I will
> look into this.

Ah ok, I hadn't seen that check.

I would still suggest using pkg-config, since elfutils provides a .pc file
for libelf.  When libelf is installed in a non-standard location (for example
when you need to test with a hand-built version of libelf), it's easier to
let pkg-config do the hard work than to set CFLAGS/LDFLAGS by hand.

Other than that, the gdb integration seems to work great!

>From 43f5a0c0d3809973b178004d48ea5a602a514189 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi at ericsson.com>
Date: Fri, 8 Jul 2016 11:37:39 -0400
Subject: [PATCH] Use pkg-config to check for libelf

elfutils provides .pc files for its libs, so we can use
PKG_CHECK_MODULES to check for required flags.

Signed-off-by: Simon Marchi <simon.marchi at ericsson.com>
---
 configure.ac                   | 3 ++-
 src/minicoredumper/Makefile.am | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5237832..a0e901b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,6 @@ dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([elf.h],,[AC_MSG_ERROR([elf.h missing!])])
-AC_CHECK_HEADERS([gelf.h],,[AC_MSG_ERROR([gelf.h missing!])])
 AC_CHECK_HEADERS([fcntl.h],,[AC_MSG_ERROR([fcntl.h missing!])])
 AC_CHECK_HEADERS([limits.h],,[AC_MSG_ERROR([limits.h missing!])])
 AC_CHECK_HEADERS([stddef.h],,[AC_MSG_ERROR([stddef.h missing!])])
@@ -82,6 +81,8 @@ if test x$PKGCONFIG_CHECK != xyes ; then
 	AC_MSG_ERROR([pkg-config missing!])
 fi

+PKG_CHECK_MODULES(libelf, libelf)
+
 dnl default-enabled dbus feature
 AC_ARG_WITH([dbus],
 	    [AS_HELP_STRING([--with-dbus],
diff --git a/src/minicoredumper/Makefile.am b/src/minicoredumper/Makefile.am
index 0fff2da..e86d624 100644
--- a/src/minicoredumper/Makefile.am
+++ b/src/minicoredumper/Makefile.am
@@ -25,10 +25,12 @@ minicoredumper_SOURCES += dbus_mcd.c
 dbus_CFLAGS += -DUSE_DBUS -I$(top_srcdir)/src/dbus -I$(top_srcdir)/src/compat
 endif

-minicoredumper_LDADD = $(top_builddir)/lib/libjson.a -lelf -lthread_db -lrt \
-		       @dbus_LIBS@
+minicoredumper_LDADD = $(top_builddir)/lib/libjson.a -lthread_db -lrt \
+		       $(dbus_LIBS) \
+		       $(libelf_LIBS)
 minicoredumper_CFLAGS = -g -Wall -std=c99 -D_GNU_SOURCE $(MCD_WERROR) \
 			-D_LARGEFILE64_SOURCE $(dbus_CFLAGS) \
 			-I$(top_srcdir)/lib \
 			-I$(top_srcdir)/src/api \
-			-I$(top_srcdir)/src/libminicoredumper
+			-I$(top_srcdir)/src/libminicoredumper \
+			$(libelf_CFLAGS)
-- 
2.9.0






More information about the minicoredumper mailing list