From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 710 invoked by alias); 22 Oct 2009 13:08:49 -0000 Received: (qmail 702 invoked by uid 22791); 22 Oct 2009 13:08:49 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Oct 2009 13:08:41 +0000 Received: (qmail 12769 invoked from network); 22 Oct 2009 13:08:40 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 22 Oct 2009 13:08:40 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFA] Expand "info record" Date: Thu, 22 Oct 2009 13:08:00 -0000 User-Agent: KMail/1.9.10 Cc: Michael Snyder , Hui Zhu References: <4AD358E7.50009@vmware.com> <200910211154.06992.pedro@codesourcery.com> <4ADF25F4.70804@vmware.com> In-Reply-To: <4ADF25F4.70804@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910221408.37498.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2009-10/txt/msg00520.txt.bz2 On Wednesday 21 October 2009 16:17:08, Michael Snyder wrote: > > FTR, it still pains me when I see this: > >> + if (current_target.to_stratum == record_stratum) > >> + { > > > > especially more so now that we have a stratum higher > > than record_statum... > > We do? ... > > OK -- how would you suggest doing this sort of test? In common code, test for target feature or property of interest to the caller code in question (target_has_execution, _has_stack, _has_foo), instead of checking if the current target is target foo or statum foo. In record.c itself, iff you want to know if precord is activated, either iterate over the pushed targets stack looking for &record_ops: static int precord_active (void) { foreach (ops, current_target.beneath) if (ops == &record_ops) return 1; return 0; } ... or, simply keep a global similar to exec.c:using_exec_ops, and check for that. (If you want to consider multi-process at some point, you'll probably move the log-related globals to a per-inferior structure, and presumably keep a list of such objects around in record.c. Then, in record.c, when checking if recording is activated for a given inferior, you'd then check if there's an instance of such an object for the current inferior in that list.) -- Pedro Alves