Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jan 2007 13:13:49 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        src-committers@freebsd.org
Cc:        cvs-src@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/libexec/rtld-elf rtld.c src/usr.bin/kdump kdump.c
Message-ID:  <200701091313.50169.jhb@freebsd.org>
In-Reply-To: <200701091750.l09Ho520002603@repoman.freebsd.org>
References:  <200701091750.l09Ho520002603@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 09 January 2007 12:50, John Baldwin wrote:
> jhb         2007-01-09 17:50:05 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     libexec/rtld-elf     rtld.c 
>     usr.bin/kdump        kdump.c 
>   Log:
>   Add various utrace's for use with ktrace to the ELF runtime linker.  To
>   activate the traces, set the LD_UTRACE (or LD_32_UTRACE) environment
>   variable.  This also includes code in kdump(8) to parse the traces.
>   
>   Reviewed by:    kan, jdp
>   MFC after:      2 weeks

Some sample output:

-bash-2.05b$ cat foo.c
#include <dlfcn.h>
#include <err.h>

int
main(int ac, char **av)
{
        void *p;

        p = dlopen("libpcap.so.4", RTLD_NOW);
        if (p == 0)
                errx(1, "dlopen: %s", dlerror());
        dlclose(p);
}
-bash-2.05b$ env LD_UTRACE=yes LD_PRELOAD=libm.so.2 ktrace ./foo
-bash-2.05b$ kdump -t u
 17266 foo      USER  RTLD: loaded   0x800529200 @ 0x800633000 - 0x800754fff (/usr/lib/compat/libm.so.2)
 17266 foo      USER  RTLD: LD_PRELOAD finished
 17266 foo      USER  RTLD: loaded   0x800529400 @ 0x800755000 - 0x80096cfff (/lib/libc.so.6)
 17266 foo      USER  RTLD: init 0x8006362c0 for 0x800529200 (/usr/lib/compat/libm.so.2)
 17266 foo      USER  RTLD: init 0x80077e568 for 0x800529400 (/lib/libc.so.6)
 17266 foo      USER  dlopen(libpcap.so.4, RTLD_NOW)
 17266 foo      USER  RTLD: loaded   0x800529600 @ 0x80096d000 - 0x800a96fff (/lib/libpcap.so.4)
 17266 foo      USER  0x800529600 = dlopen(libpcap.so.4) ref 1
 17266 foo      USER  RTLD: init 0x800971b70 for 0x800529600 (/lib/libpcap.so.4)
 17266 foo      USER  dlclose(0x800529600) (/lib/libpcap.so.4, 1)
 17266 foo      USER  RTLD: fini 0x8009840b4 for 0x800529600 (/lib/libpcap.so.4)
 17266 foo      USER  RTLD: unloaded 0x800529600 @ 0x80096d000 - 0x800a96fff (/lib/libpcap.so.4)
 17266 foo      USER  dlclose(0x800529600) finished
 17266 foo      USER  RTLD: fini 0x80082cdf4 for 0x800529400 (/lib/libc.so.6)
 17266 foo      USER  RTLD: fini 0x80064a1a4 for 0x800529200 (/usr/lib/compat/libm.so.2)

-- 
John Baldwin



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