From patchwork Tue Jun 5 10:39:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 10448025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A667D60467 for ; Tue, 5 Jun 2018 10:45:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FB85205D6 for ; Tue, 5 Jun 2018 10:45:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8232028FC8; Tue, 5 Jun 2018 10:45:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 298AA205D6 for ; Tue, 5 Jun 2018 10:45:18 +0000 (UTC) Received: from localhost ([::1]:45600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQ9Sn-0002pe-Dh for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Jun 2018 06:45:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQ9NY-0005tu-Pd for qemu-devel@nongnu.org; Tue, 05 Jun 2018 06:39:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQ9NV-0006W9-Kz for qemu-devel@nongnu.org; Tue, 05 Jun 2018 06:39:52 -0400 Received: from mail.ispras.ru ([83.149.199.45]:55980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQ9NV-0006VU-CZ for qemu-devel@nongnu.org; Tue, 05 Jun 2018 06:39:49 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 8F5D3540226; Tue, 5 Jun 2018 13:39:48 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Tue, 05 Jun 2018 13:39:48 +0300 Message-ID: <152819518838.30857.7489579122481731984.stgit@pasha-ThinkPad-T60> In-Reply-To: <152819515565.30857.16834004920507717324.stgit@pasha-ThinkPad-T60> References: <152819515565.30857.16834004920507717324.stgit@pasha-ThinkPad-T60> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [RFC PATCH v2 6/7] plugin: add instruction execution logger X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, maria.klimushenkova@ispras.ru, dovgaluk@ispras.ru, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, vilanova@ac.upc.edu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Pavel Dovgalyuk This patch adds a plugin for logging addresses of all executed instructions, making a complete instruction-level trace. Signed-off-by: Pavel Dovgalyuk --- plugins/exec-log/Makefile | 19 +++++++++++++++++++ plugins/exec-log/exec-log.c | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 plugins/exec-log/Makefile create mode 100644 plugins/exec-log/exec-log.c diff --git a/plugins/exec-log/Makefile b/plugins/exec-log/Makefile new file mode 100644 index 0000000..86374f4 --- /dev/null +++ b/plugins/exec-log/Makefile @@ -0,0 +1,19 @@ +CFLAGS += -I../include -fno-PIE -fPIC -O3 +LDFLAGS += -shared +# TODO: Windows +DSOSUF := .so + +NAME:= exec-log +BIN := $(NAME)$(DSOSUF) + +FILES := exec-log.o + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +all: $(FILES) + $(CC) $(LDFLAGS) -o $(BIN) $(FILES) + +clean: + rm $(FILES) + rm $(BIN) diff --git a/plugins/exec-log/exec-log.c b/plugins/exec-log/exec-log.c new file mode 100644 index 0000000..7fc7975 --- /dev/null +++ b/plugins/exec-log/exec-log.c @@ -0,0 +1,18 @@ +#include +#include +#include "plugins.h" + +bool plugin_init(const char *args) +{ + return true; +} + +bool plugin_needs_before_insn(uint64_t pc, void *cpu) +{ + return true; +} + +void plugin_before_insn(uint64_t pc, void *cpu) +{ + qemulib_log("executing instruction at %lx\n", pc); +}