From 0fc8719996feb46a3718daaea07176e09a33bf51 Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Sat, 19 Nov 2011 02:09:11 +0000 Subject: HVM-23 Compile qemu userland tools with CTF data --- Makefile.target | 6 ++++++ ctf.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 ctf.sh diff --git a/Makefile.target b/Makefile.target index e0745b3..ca0a740 100644 --- a/Makefile.target +++ b/Makefile.target @@ -377,11 +377,17 @@ endif # CONFIG_SOFTMMU obj-y += $(addprefix ../, $(trace-obj-y)) obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o +# +# Uh, ctfconvert and ctfmerge are in our paths... right... +# + ifeq ($(TRACE_BACKEND),dtrace) ifneq ($(strip $(CONFIG_SOLARIS)),) $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(call quiet-command, dtrace $(CONFIG_DTRACE_FLAGS) -o ../trace-dtrace.o -s ../trace-dtrace.dtrace -G $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)," LINK $(TARGET_DIR)$@.dtrace") + $(call quiet-command, find ../ -type f -name '*.o' -exec ../ctf.sh '{}' \;) $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) + $(call quiet-command, ctfmerge -L VERSION -o $@ $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) else $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) diff --git a/ctf.sh b/ctf.sh new file mode 100755 index 0000000..167c950 --- /dev/null +++ b/ctf.sh @@ -0,0 +1,30 @@ +#!/usr/bin/bash +# +# We need to run ctfconvert on all the .o files in qemu. However, some of these +# .o files contain some snippets that are going to cause ctfconvert to fail. If +# ctfconvert is run with the -i option, it will delete the .o file. This is bad. +# Instead we end up using a temporary file and move over it. +# +# This file gets invoked from inside the x86-64_softmmu directory, hence the +# extra .. in the path below. That's kind of ugly, and I almost apologize. +# + +sh_arg0=$(basename $0) +ctf_bin=$(pwd)/../../../illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/ctfconvert + +function fail +{ + local msg="$*" + [[ -z "$msg" ]] && msg="failed" + echo "$sh_arg0: $msg" >&2 + exit 1 +} + + +[[ $# -eq 1 ]] || fail "missing arguments" + +echo "Converting $1" +$ctf_bin -L VERSION -o $1.ctf $1 +[[ $? -ne 0 ]] && exit 1 +mv $1.ctf $1 +exit 0 -- cgit v1.2.3