Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 2017 08:38:32 +0000 (UTC)
From:      Peter Jeremy <peterj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312984 - in head: lib/libsysdecode libexec/rtld-elf
Message-ID:  <201701300838.v0U8cWNx059740@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: peterj
Date: Mon Jan 30 08:38:32 2017
New Revision: 312984
URL: https://svnweb.freebsd.org/changeset/base/312984

Log:
  Extend LD_UTRACE by also generating utrace(2) log events for runtime linker
  errors.
  
  Reviewed by:	kib, jhb
  Approved by:	jhb(mentor)
  MFC after:	1 week
  Differential Revision:	 D9347

Modified:
  head/lib/libsysdecode/utrace.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld_utrace.h

Modified: head/lib/libsysdecode/utrace.c
==============================================================================
--- head/lib/libsysdecode/utrace.c	Mon Jan 30 08:35:15 2017	(r312983)
+++ head/lib/libsysdecode/utrace.c	Mon Jan 30 08:38:32 2017	(r312984)
@@ -124,6 +124,10 @@ print_utrace_rtld(FILE *fp, void *p)
 		fprintf(fp, "RTLD: %p = dlsym(%p, %s)", ut->mapbase, ut->handle,
 		    ut->name);
 		break;
+	case UTRACE_RTLD_ERROR:
+		fprintf(fp, "RTLD: error: %s\n", ut->name);
+		break;
+
 	default:
 		return (0);
 	}

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Mon Jan 30 08:35:15 2017	(r312983)
+++ head/libexec/rtld-elf/rtld.c	Mon Jan 30 08:38:32 2017	(r312984)
@@ -764,6 +764,7 @@ _rtld_error(const char *fmt, ...)
     rtld_vsnprintf(buf, sizeof buf, fmt, ap);
     error_message = buf;
     va_end(ap);
+    LD_UTRACE(UTRACE_RTLD_ERROR, NULL, NULL, 0, 0, error_message);
 }
 
 /*

Modified: head/libexec/rtld-elf/rtld_utrace.h
==============================================================================
--- head/libexec/rtld-elf/rtld_utrace.h	Mon Jan 30 08:35:15 2017	(r312983)
+++ head/libexec/rtld-elf/rtld_utrace.h	Mon Jan 30 08:38:32 2017	(r312984)
@@ -45,6 +45,7 @@
 #define	UTRACE_FINI_CALL		10
 #define	UTRACE_DLSYM_START		11
 #define	UTRACE_DLSYM_STOP		12
+#define	UTRACE_RTLD_ERROR		13
 
 #define	RTLD_UTRACE_SIG_SZ		4
 #define	RTLD_UTRACE_SIG			"RTLD"



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