Julian Seward 487756039c Add a new module: the debug-logger. For a while now, we've used the
same logging mechanism to emit both end-user messages and debugging-
valgrind-itself messages.  This commit creates a new mechanism for the
latter purpose.

The main feature of m_debuglog is that it has zero dependencies on any
other module and therefore can safely operate all the way through
stage1 and stage2 startup.  It is restricted to emitting debug info on
file descriptor 2 (stderr), but that's not a big deal.

As a result of this change the basic formatted-print routines
(vprintf) have been moved from vg_mylibc.c into m_debuglog, so that
m_debuglog remains standalone.

The %y format string is currently disabled, since supporting it ("show
symbol corresponding to this address") would create a dependency from
m_debuglog to the entire debug-info reading machinery and all the
stuff that depends on, thereby making a nonsense of m_debuglog being
standalone.  Its omission does not seem to cause any regression tests
to fail, though.

The debug logger is activated with "-d".  More "-d"s make it more
verbose.

m_debuglog.o is linked into both stage1 and stage2, but as it is
completely standalone this causes no particular problems.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3559
2005-04-25 01:36:56 +00:00

162 lines
4.0 KiB
Makefile

include $(top_srcdir)/Makefile.all.am
include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
## When building, we are only interested in the current arch/OS/platform.
## But when doing 'make dist', we are interested in every arch/OS/platform.
## That's what DIST_SUBDIRS specifies.
SUBDIRS = \
$(VG_ARCH) $(VG_OS) $(VG_PLATFORM) \
m_sigframe demangle .
DIST_SUBDIRS = \
$(VG_ARCH_ALL) $(VG_OS_ALL) $(VG_PLATFORM_ALL) \
m_sigframe demangle .
AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" -I$(srcdir)/demangle \
-DKICKSTART_BASE=@KICKSTART_BASE@ \
-DVG_PLATFORM="$(VG_PLATFORM)"
AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_CORE_AM_CFLAGS@
AM_CFLAGS += -fno-omit-frame-pointer
default.supp: $(SUPP_FILES)
bin_PROGRAMS = \
valgrind
val_PROGRAMS = \
stage2 \
vg_inject.so
noinst_LIBRARIES = lib_replace_malloc.a
noinst_HEADERS = \
core.h \
core_asm.h \
pub_core_errormgr.h \
pub_core_execontext.h \
pub_core_stacktrace.h \
pub_core_sigframe.h \
pub_core_debuglog.h \
ume.h \
vg_symtab2.h \
vg_symtypes.h \
vg_toolint.h
EXTRA_DIST = \
valgrind.vs \
gen_toolint.pl toolfuncs.def README_MODULES.txt
BUILT_SOURCES = vg_toolint.c vg_toolint.h
CLEANFILES = vg_toolint.c vg_toolint.h
valgrind_SOURCES = \
ume.c \
\
stage1.c \
m_debuglog.c \
${VG_ARCH}/jmp_with_stack.c
valgrind_DEPENDENCIES =
valgrind_LDFLAGS=-static -g
valgrind_LDADD=
stage2_SOURCES = \
m_errormgr.c \
m_execontext.c \
m_stacktrace.c \
m_debuglog.c \
ume.c \
\
vg_scheduler.c \
vg_default.c \
vg_demangle.c \
vg_hashtable.c \
vg_replace_malloc.c \
vg_main.c \
vg_malloc2.c \
vg_memory.c \
vg_messages.c \
vg_mylibc.c \
vg_needs.c \
vg_procselfmaps.c \
vg_dummy_profile.c \
vg_signals.c \
vg_symtab2.c \
vg_threadmodel.c \
vg_pthreadmodel.c \
vg_redir.c \
vg_dwarf.c \
vg_stabs.c \
vg_skiplist.c \
vg_symtypes.c \
vg_syscalls.c \
vg_toolint.c \
vg_translate.c \
vg_transtab.c
## libplatform.a must be before libarch.a and libos.a, it seems.
stage2_extra= \
demangle/libdemangle.a \
m_sigframe/libsigframe.a \
${VG_PLATFORM}/libplatform.a \
${VG_ARCH}/libarch.a \
${VG_OS}/libos.a \
@VEX_DIR@/libvex.a
## Test repeated in both arms of the if-then-else because older versions of
## automake don't seem to like having += within an if-then-else.
if USE_PIE
stage2_CFLAGS = $(AM_CFLAGS) -fpie
stage2_DEPENDENCIES = \
$(srcdir)/valgrind.vs \
$(stage2_extra)
stage2_LDFLAGS = -Wl,--export-dynamic -g \
-Wl,-version-script $(srcdir)/valgrind.vs \
-pie
else
stage2_CFLAGS = $(AM_CFLAGS)
stage2_DEPENDENCIES = \
$(srcdir)/valgrind.vs ${VG_ARCH}/stage2.lds \
$(stage2_extra)
stage2_LDFLAGS = -Wl,--export-dynamic -g \
-Wl,-version-script $(srcdir)/valgrind.vs \
-Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,${VG_ARCH}/stage2.lds
endif
stage2_LDADD= $(stage2_extra) -ldl
vg_toolint.c: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def ./Makefile
rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl callwrap < $(srcdir)/toolfuncs.def > $@ || rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl missingfuncs < $(srcdir)/toolfuncs.def >> $@ || rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl initfunc < $(srcdir)/toolfuncs.def >> $@ || rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl structdef < $(srcdir)/toolfuncs.def >> $@ || rm -f $@
vg_toolint.h: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def ./Makefile
rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl proto < $(srcdir)/toolfuncs.def > $@ || rm -f $@
$(PERL) $(srcdir)/gen_toolint.pl struct < $(srcdir)/toolfuncs.def >> $@ || rm -f $@
vg_inject_so_SOURCES = vg_intercept.c
vg_inject_so_CFLAGS = $(AM_CFLAGS) -fpic
vg_inject_so_LDADD = -ldl
vg_inject_so_LDFLAGS = \
-shared \
-Wl,--soname,vg_inject.so \
-Wl,-z,initfirst
lib_replace_malloc_a_SOURCES = vg_replace_malloc.c
lib_replace_malloc_a_CFLAGS = $(AM_CFLAGS) -fpic -fno-omit-frame-pointer
MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS)
all-local:
mkdir -p $(inplacedir)
for i in $(val_PROGRAMS); do \
to=$(inplacedir)/$$i; \
rm -f $$$to; \
ln -sf ../$(subdir)/$$i $$to; \
done