Received: from eggs.gnu.org ([208.118.235.92]:50395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTLt2-0007Rr-Re for qemu-devel@nongnu.org; Fri, 19 Apr 2013 20:42:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTLt1-0003Mb-Kq for qemu-devel@nongnu.org; Fri, 19 Apr 2013 20:42:40 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:50932 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTLt1-0003MB-Ai for qemu-devel@nongnu.org; Fri, 19 Apr 2013 20:42:39 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20130416134949.21588.80064.stgit@fimbulvetr.bsc.es> <20130416135126.21588.39829.stgit@fimbulvetr.bsc.es> <5170B9E6.7070208@redhat.com> Date: Sat, 20 Apr 2013 02:42:35 +0200 Message-ID: <87r4i6oww4.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 17/23] instrument: Add commandline options to start with an instrumentation library List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org Eric Blake writes: > On 04/16/2013 07:51 AM, Llu=C3=ADs Vilanova wrote: >> Add commandline options to control initial loading of dynamic instrument= ation >> library. >>=20 >> Signed-off-by: Llu=C3=ADs Vilanova >> --- >> @@ -688,6 +690,15 @@ static void usage(void) >> #endif >> "-bsd type select emulated BSD type FreeBSD/NetBSD/OpenBSD (defa= ult)\n" >> "\n" >> +#if defined(CONFIG_TRACE_INSTRUMENT) >> + "Tracing options:\n" >> +#if defined(CONFIG_TRACE_INSTRUMENT_DYNAMIC) >> + "-instr path load a dynamic trace instrumentation libr= ary\n" >> +#endif >> + "-instr-arg string\n" >> + " argument to dynamic trace instrumentation= library (can be given multiple times)\n" >> + "\n" > Why do you document -instr-arg unconditionally, but -instr only when > dynamic trace support is enabled; especially since the text of > -instr-arg mentions that it is tied to dynamic tracing? >> @@ -852,6 +866,14 @@ int main(int argc, char **argv) >> singlestep =3D 1; >> } else if (!strcmp(r, "strace")) { >> do_strace =3D 1; >> +#if defined(CONFIG_TRACE_INSTRUMENT_DYNAMIC) >> + } else if (!strcmp(r, "instr")) { >> + instrument_path =3D argv[optind++]; >> +#endif >> +#if defined(CONFIG_TRACE_INSTRUMENT) >> + } else if (!strcmp(r, "instr-arg")) { >> + instr_parse_args(argv[optind++], &instrument_argc, &instrum= ent_argv); >> +#endif > At least your parsing code matches your documentation, but it still > feels weird. You cannot load a library in non-dynamic mode, but you can still pass it so= me arguments if it's in static mode (CONFIG_TRACE_INSTRUMENT accounts for all cases), thus the "weirdness" :) >> @@ -3378,6 +3397,14 @@ static const struct qemu_argument arg_table[] =3D= { >> {"R", "QEMU_RESERVED_VA", true, handle_arg_reserved_va, >> "size", "reserve 'size' bytes for guest virtual address space"}, >> #endif >> +#if defined(CONFIG_TRACE_INSTRUMENT_DYNAMIC) >> + {"instr", "QEMU_INSTR", true, handle_arg_instrument, >> + "path", "load a dynamic trace instrumentation library"}, >> +#endif >> +#if defined(CONFIG_TRACE_INSTRUMENT) >> + {"instr-arg", "QEMU_INSTR_ARGS", true, handle_arg_instrument_arg, >> + "string", "argument to dynamic trace instrumentation library (= can be given multiple times)"}, > Another case of mentioning the term dynamic even when dynamic > instrumentation is not enabled. Fixed. Thanks a lot, Lluis --=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