From patchwork Tue Jun 21 13:23:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 9190577 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 E0F4C60756 for ; Tue, 21 Jun 2016 13:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1DC127FAC for ; Tue, 21 Jun 2016 13:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6A5528174; Tue, 21 Jun 2016 13:37:34 +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=-6.9 required=2.0 tests=BAYES_00,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 EFA6B27FAC for ; Tue, 21 Jun 2016 13:37:32 +0000 (UTC) Received: from localhost ([::1]:51829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLrw-0002mL-02 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Jun 2016 09:37:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLeY-0004vT-5s for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:23:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLeU-0003ca-2U for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:23:42 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:51020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLeT-0003cV-NT for qemu-devel@nongnu.org; Tue, 21 Jun 2016 09:23:38 -0400 Received: from gw-2.ac.upc.es (gw-2.ac.upc.es [147.83.30.8]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u5LDNbt6019116; Tue, 21 Jun 2016 15:23:37 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-2.ac.upc.es (Postfix) with ESMTPSA id E6FB986E; Tue, 21 Jun 2016 15:23:36 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Tue, 21 Jun 2016 15:23:36 +0200 Message-Id: <146651541668.29362.14633530491352662513.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.8.1 In-Reply-To: <146651540593.29362.4052083744443981585.stgit@fimbulvetr.bsc.es> References: <146651540593.29362.4052083744443981585.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id u5LDNbt6019116 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH 2/2] trace: [bsd-user] Commandline arguments to control tracing 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: Blue Swirl , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: LluĂ­s Vilanova --- bsd-user/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bsd-user/main.c b/bsd-user/main.c index 9f592be..ce2cc17 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -30,6 +30,7 @@ #include "qemu/timer.h" #include "qemu/envlist.h" #include "exec/log.h" +#include "trace/control.h" int singlestep; unsigned long mmap_min_addr; @@ -687,6 +688,14 @@ static void usage(void) "-p pagesize set the host page size to 'pagesize'\n" "-singlestep always run in singlestep mode\n" "-strace log system calls\n" + "-trace-enable name\n" + " enable tracing of specified event names\n" + " (pass '?' to show a list of events)\n" + "-trace-events eventsfile\n" + " enable tracing of specified event names\n" + " (one name/pattern per line)\n" + "-trace-file tracefile\n" + " output trace file\n" "\n" "Environment variables:\n" "QEMU_STRACE Print system calls and arguments similar to the\n" @@ -735,6 +744,7 @@ int main(int argc, char **argv) int gdbstub_port = 0; char **target_environ, **wrk; envlist_t *envlist = NULL; + const char *trace_file = NULL; bsd_type = target_openbsd; if (argc <= 1) @@ -840,6 +850,12 @@ int main(int argc, char **argv) singlestep = 1; } else if (!strcmp(r, "strace")) { do_strace = 1; + } else if (!strcmp(r, "trace-enable")) { + trace_enable_events(argv[optind++]); + } else if (!strcmp(r, "trace-events")) { + trace_init_events(argv[optind++]); + } else if (!strcmp(r, "trace-file")) { + trace_file = argv[optind++]; } else { usage(); @@ -865,6 +881,11 @@ int main(int argc, char **argv) } filename = argv[optind]; + if (!trace_init_backends()) { + exit(1); + } + trace_init_file(trace_file); + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs));