From patchwork Wed Jun 22 10:04:41 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: 9192349 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 29D906075C for ; Wed, 22 Jun 2016 10:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18B452819A for ; Wed, 22 Jun 2016 10:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DD3F283E9; Wed, 22 Jun 2016 10:11:03 +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 908C22819A for ; Wed, 22 Jun 2016 10:11:02 +0000 (UTC) Received: from localhost ([::1]:56934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf7d-00047V-8E for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Jun 2016 06:11:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf1b-0007kB-9Z for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFf1W-00015G-Sl for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:04:47 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:52652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFf1W-00015A-I6 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:04:42 -0400 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u5MA4fOT029170; Wed, 22 Jun 2016 12:04:41 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id 3FDEDF7; Wed, 22 Jun 2016 12:04:41 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 22 Jun 2016 12:04:41 +0200 Message-Id: <146658988099.20512.17672300079925681514.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.8.1 In-Reply-To: <146658987022.20512.14981098714407053522.stgit@fimbulvetr.bsc.es> References: <146658987022.20512.14981098714407053522.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 u5MA4fOT029170 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v2 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bsd-user/main.c b/bsd-user/main.c index 9f592be..542e50e 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,12 @@ 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 (pass 'help' to show a list of events)\n" + "-trace-events eventsfile\n" + " enable tracing of specified event names (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 +742,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 +848,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 +879,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));