From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30764 invoked by alias); 16 Jan 2014 18:39:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 30753 invoked by uid 89); 16 Jan 2014 18:39:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_00,GARBLED_BODY autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2014 18:39:28 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1W3rqe-0003z6-CY from Yao_Qi@mentor.com ; Thu, 16 Jan 2014 10:39:24 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 16 Jan 2014 10:39:24 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Thu, 16 Jan 2014 10:39:23 -0800 Message-ID: <52D826DF.4000505@codesourcery.com> Date: Thu, 16 Jan 2014 18:39:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Doug Evans CC: Pedro Alves , Subject: Re: [PATCH 4/6] gdbserver: Delimit debugging output for readability References: <52B1842F.5020401@redhat.com> <21205.55987.69477.892571@ruffy.mtv.corp.google.com> In-Reply-To: <21205.55987.69477.892571@ruffy.mtv.corp.google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00638.txt.bz2 On 01/15/2014 08:47 AM, Doug Evans wrote: > While going through the reviews, I found myself wanting something more, > namely timestamps (like "set debug timestamp on" in gdb). > Hi Doug, Could you help me to understand how useful timestamps are for measuring performance? or you use timestamps for other purposes? > This patch adds a check for gettimeofday and doesn't fall back to using one > in libiberty or gnulib, leaving that for another day. gdbserver has used gnulib, which means we can use gettimeofday unconditionally in gdbserver? > diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c > index 1b0da6c..e7d3e4f 100644 > --- a/gdb/gdbserver/linux-aarch64-low.c > +++ b/gdb/gdbserver/linux-aarch64-low.c > @@ -323,7 +323,7 @@ aarch64_get_pc (struct regcache *regcache) > > collect_register_by_name (regcache, "pc", &pc); > if (debug_threads) > - fprintf (stderr, "stop pc is %08lx\n", pc); > + debug_printf ("stop pc is %08lx\n", pc); > return pc; IWBN to move "if (debug_threads)" into debug_printf too. > diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c > index eff4499..1ce5512 100644 > --- a/gdb/gdbserver/utils.c > +++ b/gdb/gdbserver/utils.c > @@ -17,6 +17,7 @@ > + > +/* Increase or decrease the debug printf call nesting level. > + FUNCTION_NAME is the name of the calling function, or NULL if unknown. > + Call this when entering major routines that can trigger a lot of debug > + output before it exits. It allows the reader to associate subsequent > + debug output to the call that ultimately triggered it. */ > + > +void > +debug_level_incr (int incr, const char *function_name) > +{ > + gdb_assert (incr == 1 || incr == -1); > + > + /* Increment(/decrement) the level by one before printing the function name, > + to distinguish this as an entry(/exit) point. > + Then increment(/decrement) it again so that debugging printfs within > + the function are recognized as such. */ > + if (function_name != NULL) > + { > + debug_nesting_level += incr; > + debug_printf ("%s %s\n", > + incr > 0 ? ">>>>entering" : "<<< + function_name); > + } > + debug_nesting_level += incr; > + > + /* Don't crash on mismatched enter/exit, but still inform the user. */ > + if (debug_nesting_level < 0) > + { > + debug_printf ("ERROR: mismatch in debug_level_enter/exit, level < 0\n"); > + debug_nesting_level = 0; > + } > +} > + utils.c is compiled to both gdbserver and ipa. IMO, ipa code should be thread-safe, because it can be used by a multi-threaded program. -- Yao (齐尧)