From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45446 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9Mt8-0001w4-Dn for qemu-devel@nongnu.org; Fri, 22 Oct 2010 15:02:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9Mt4-0006L4-MR for qemu-devel@nongnu.org; Fri, 22 Oct 2010 15:02:48 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:43217 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P9Mt4-0006KQ-BH for qemu-devel@nongnu.org; Fri, 22 Oct 2010 15:02:46 -0400 From: xscript@gmx.net (=?utf-8?Q?Llu=C3=ADs?=) In-Reply-To: Date: Mon, 18 Oct 2010 20:27:58 +0200 References: Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 08/18] instrument: Handle config-time activation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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=C3=ADs Vilanova --- 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=3D$(VPATH) SRC_PATH=3D$(SRC_PATH) V=3D"$(V)" clean || true endif =20 +######################################################### +# static instrumentation +ifdef CONFIG_INSTRUMENT +VPATH :=3D $(VPATH):$(INSTRUMENT_PATH) + +LIBINSTRUMENT_LIB =3D libinstrument/libinstrument.a +LIBINSTRUMENT_CLEAN =3D 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/Mak= efile) + +libinstrument/libinstrument.a: libinstrument/Makefile force + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libinstrument \ + QEMU_CFLAGS=3D"$(QEMU_CFLAGS) -I../target-$(TARGET_BASE_ARCH)" \ + TARGET_DIR=3D$(TARGET_DIR)libinstrument/ VPATH=3D$(VPATH) \ + SRC_PATH=3D$(SRC_PATH) V=3D"$(V)" libinstrument.a) + +libinstrument-clean: + $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(LIBINSTRUMENT_DIR) \ + VPATH=3D$(VPATH) SRC_PATH=3D$(SRC_PATH) V=3D"$(V)" clean || true +endif =20 =20 -$(QEMU_PROG)-prepare: $(GENERATED_HEADERS) $(LIBBACKDOOR_LIB) $(QEMU_PROG) +$(QEMU_PROG)-prepare: $(GENERATED_HEADERS) $(LIBBACKDOOR_LIB) $(LIBINSTRUM= ENT_LIB) $(QEMU_PROG) =20 -$(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) $(L= IBINSTRUMENT_LIB) + $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) $(LIBBACKDOOR_LIB) $(L= IBINSTRUMENT_LIB) =20 =20 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=3D"trace" spice=3D"" =20 backdoor=3D"" +instrument=3D"" =20 # OS specific if check_define __linux__ ; then @@ -750,6 +751,14 @@ for opt do backdoor=3D`readlink -f $backdoor` fi ;; + --with-instrument=3D*) instrument=3D"$optarg" + if test ! -f "$instrument/Makefile"; then + echo "ERROR: cannot make into $instrument" + show_help=3D"yes" + else + instrument=3D`readlink -f $instrument` + fi + ;; *) echo "ERROR: unknown option $opt"; show_help=3D"yes" ;; esac @@ -942,6 +951,7 @@ echo " Default:trace-" echo " --disable-spice disable spice" echo " --enable-spice enable spice" echo " --with-backdoor=3DPATH enable backdoor communication and compi= le implementation in PATH" +echo " --with-instrument=3DPATH enable static instrumentation and compi= le user code in PATH" echo "" echo "NOTE: The object files are built at the place where configure is lau= nched" 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 =20 if test $sdl_too_old =3D "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=3D$backdoor" >> $config_host_mak rm -rf *-{linux-user,softmmu}/libbackdoor/ fi +if test -n "$instrument"; then + echo "CONFIG_INSTRUMENT=3Dy" >> $config_host_mak + echo "INSTRUMENT_PATH=3D$instrument" >> $config_host_mak + QEMU_CFLAGS=3D"-I$instrument $QEMU_CFLAGS" + rm -rf *-{linux-user,softmmu}/libinstrument/ +fi =20 # XXX: suppress that if [ "$bsd" =3D "yes" ] ; then --=20 1.7.1 --=20 "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