From: xscript@gmx.net (Lluís)
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 08/18] instrument: Handle config-time activation
Date: Mon, 18 Oct 2010 20:27:58 +0200 [thread overview]
Message-ID: <b30c94e6b97fc24fce6de418b484fde18697d58b.1287772676.git.vilanova@ac.upc.edu> (raw)
In-Reply-To: <cover.1287772676.git.vilanova@ac.upc.edu>
Add a '--with-instrument' configuration option pointing to user-provided
instrumentation callbacks.
Make is invoked on the user-provided directory, which must build a static
library that might contain extra code needed by the user-provided
instrumentation.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
Makefile.target | 29 ++++++++++++++++++++++++++---
configure | 19 +++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 9152723..90867e7 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -351,12 +351,35 @@ libbackdoor-clean:
VPATH=$(VPATH) SRC_PATH=$(SRC_PATH) V="$(V)" clean || true
endif
+#########################################################
+# static instrumentation
+ifdef CONFIG_INSTRUMENT
+VPATH := $(VPATH):$(INSTRUMENT_PATH)
+
+LIBINSTRUMENT_LIB = libinstrument/libinstrument.a
+LIBINSTRUMENT_CLEAN = libinstrument-clean
+
+libinstrument/Makefile:
+ $(call quiet-command, mkdir -p libinstrument, " CREAT $(TARGET_DIR)$@")
+ $(call quiet-command, rm -f libinstrument/Makefile)
+ $(call quiet-command, ln -s $(INSTRUMENT_PATH)/Makefile libinstrument/Makefile)
+
+libinstrument/libinstrument.a: libinstrument/Makefile force
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libinstrument \
+ QEMU_CFLAGS="$(QEMU_CFLAGS) -I../target-$(TARGET_BASE_ARCH)" \
+ TARGET_DIR=$(TARGET_DIR)libinstrument/ VPATH=$(VPATH) \
+ SRC_PATH=$(SRC_PATH) V="$(V)" libinstrument.a)
+
+libinstrument-clean:
+ $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(LIBINSTRUMENT_DIR) \
+ VPATH=$(VPATH) SRC_PATH=$(SRC_PATH) V="$(V)" clean || true
+endif
-$(QEMU_PROG)-prepare: $(GENERATED_HEADERS) $(LIBBACKDOOR_LIB) $(QEMU_PROG)
+$(QEMU_PROG)-prepare: $(GENERATED_HEADERS) $(LIBBACKDOOR_LIB) $(LIBINSTRUMENT_LIB) $(QEMU_PROG)
-$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(LIBBACKDOOR_LIB)
- $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) $(LIBBACKDOOR_LIB)
+$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(LIBBACKDOOR_LIB) $(LIBINSTRUMENT_LIB)
+ $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) $(LIBBACKDOOR_LIB) $(LIBINSTRUMENT_LIB)
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
diff --git a/configure b/configure
index 0de937e..454124c 100755
--- a/configure
+++ b/configure
@@ -333,6 +333,7 @@ trace_file="trace"
spice=""
backdoor=""
+instrument=""
# OS specific
if check_define __linux__ ; then
@@ -750,6 +751,14 @@ for opt do
backdoor=`readlink -f $backdoor`
fi
;;
+ --with-instrument=*) instrument="$optarg"
+ if test ! -f "$instrument/Makefile"; then
+ echo "ERROR: cannot make into $instrument"
+ show_help="yes"
+ else
+ instrument=`readlink -f $instrument`
+ fi
+ ;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
@@ -942,6 +951,7 @@ echo " Default:trace-<pid>"
echo " --disable-spice disable spice"
echo " --enable-spice enable spice"
echo " --with-backdoor=PATH enable backdoor communication and compile implementation in PATH"
+echo " --with-instrument=PATH enable static instrumentation and compile user code in PATH"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
@@ -2335,6 +2345,9 @@ echo "spice support $spice"
if test -n "$backdoor"; then
echo "Backdoor comm. $backdoor"
fi
+if test -n "$instrument"; then
+ echo "Instrumentation $instrument"
+fi
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2599,6 +2612,12 @@ if test -n "$backdoor"; then
echo "BACKDOOR_PATH=$backdoor" >> $config_host_mak
rm -rf *-{linux-user,softmmu}/libbackdoor/
fi
+if test -n "$instrument"; then
+ echo "CONFIG_INSTRUMENT=y" >> $config_host_mak
+ echo "INSTRUMENT_PATH=$instrument" >> $config_host_mak
+ QEMU_CFLAGS="-I$instrument $QEMU_CFLAGS"
+ rm -rf *-{linux-user,softmmu}/libinstrument/
+fi
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
--
1.7.1
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
next prev parent reply other threads:[~2010-10-22 19:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 18:32 [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation Lluís
2010-10-22 18:53 ` Lluís
2010-10-18 17:24 ` [Qemu-devel] [PATCH 01/18] backdoor: Handle config-time activation Lluís
2010-10-18 17:40 ` [Qemu-devel] [PATCH 04/18] backdoor: Declare guest-side interface macros Lluís
2010-10-18 18:08 ` [Qemu-devel] [PATCH 06/18] backdoor: [i386] " Lluís
2010-10-18 18:27 ` Lluís [this message]
2010-10-19 19:14 ` [Qemu-devel] [PATCH 05/18] backdoor: [i386] Decode backdoor instructions Lluís
2010-10-19 19:22 ` [Qemu-devel] [PATCH 02/18] backdoor: Declare host-side backdoor helpers Lluís
2010-10-19 19:33 ` [Qemu-devel] [PATCH 03/18] backdoor: [all] Include backdoor helper declarations Lluís
2010-10-19 20:05 ` [Qemu-devel] [PATCH 07/18] backdoor: Add a simple example Lluís
2010-10-19 21:11 ` [Qemu-devel] [PATCH 13/18] instrument: Add FETCH point Lluís
2010-10-19 21:12 ` [Qemu-devel] [PATCH 15/18] instrument: Add VMEM point Lluís
2010-10-19 21:36 ` [Qemu-devel] [PATCH 18/18] instrument: [i386] Call PLVL point Lluís
2010-10-19 21:36 ` [Qemu-devel] [PATCH 17/18] instrument: Add " Lluís
2010-10-19 21:37 ` [Qemu-devel] [PATCH 10/18] instrument: Dynamic per-CPU state of static instrumentation points Lluís
2010-10-19 21:40 ` [Qemu-devel] [PATCH 14/18] instrument: [i386] Call FETCH point Lluís
2010-10-21 14:36 ` [Qemu-devel] [PATCH 11/18] instrument: Code-generation macros Lluís
2010-10-21 17:42 ` [Qemu-devel] [PATCH 09/18] instrument: Add initial instrumentation example Lluís
2010-10-21 20:55 ` [Qemu-devel] [PATCH 12/18] instrument: [all] Include instrumentation helper declarations Lluís
2010-10-22 14:00 ` [Qemu-devel] [PATCH 16/18] instrument: [all] Call VMEM point Lluís
2010-10-23 12:40 ` [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation Blue Swirl
2010-10-25 10:54 ` backdoor [Was: Re: [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation] Lluís
2010-10-25 12:29 ` [Qemu-devel] Re: backdoor [Was: " Paolo Bonzini
2010-10-25 13:37 ` [Qemu-devel] Re: backdoor Lluís
2010-10-25 21:20 ` Anthony Liguori
2010-10-25 22:48 ` Lluís
2010-10-25 23:06 ` Anthony Liguori
2010-10-26 20:03 ` Lluís
2010-10-25 17:27 ` backdoor [Was: Re: [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation] Blue Swirl
2010-10-25 20:54 ` [Qemu-devel] Re: backdoor Lluís
2010-10-25 11:13 ` instrument [Was: Re: [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation] Lluís
2010-10-25 18:31 ` Blue Swirl
2010-10-25 21:48 ` [Qemu-devel] Re: instrument Lluís
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b30c94e6b97fc24fce6de418b484fde18697d58b.1287772676.git.vilanova@ac.upc.edu \
--to=xscript@gmx.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).