From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14611 invoked by alias); 10 Sep 2014 18:00:40 -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 14511 invoked by uid 89); 10 Sep 2014 18:00:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f73.google.com Received: from mail-pa0-f73.google.com (HELO mail-pa0-f73.google.com) (209.85.220.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 10 Sep 2014 18:00:38 +0000 Received: by mail-pa0-f73.google.com with SMTP id kx10so1084429pab.2 for ; Wed, 10 Sep 2014 11:00:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=Tu33MOhk//X3jlyQr7WDVUaN4cUIQsvFVB36VgbJOQo=; b=nEqlQ1Ey7Dj/YW09yGust4oj1cNTQDayTEeA3rQwd3mKLA2Tnb5KDoZFUV8qJxQLEh k67ufMVkWcR6aO5NA9DXDzUIeGZIw7KSlFPSagYxN4YhBceNOodwlSVpaGcQGrHC9qta PRrX8ulZkQplJrIeiSAy3cJy7sJuiavjNf3PQIjlBEHWtYz1WBDkJot3YULgKcnF21f6 uNTHnztTmzQPFvXbTJE8YiTw5zkMr2EYGfnsCKqxPBjZExKBaadP71usDAaVBu6mrzAW v5j1Mx/FlxB+ewmAxFjY/kN98QofQgb9vCCBitSC1H+wInzbw2UxS19efxINXt2bkY2o 9AhQ== X-Gm-Message-State: ALoCoQkfASy10oejqD5+QONWGIVvcqqe1RjVixavQHv/dUbFCwi62cRFevawvc/qN6zzYw0eHGDt X-Received: by 10.66.196.70 with SMTP id ik6mr10044447pac.44.1410372036230; Wed, 10 Sep 2014 11:00:36 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id e24si1177088yhe.3.2014.09.10.11.00.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Sep 2014 11:00:36 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com ([172.17.128.107]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id OXkROsjA.1; Wed, 10 Sep 2014 11:00:36 -0700 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21520.37315.16694.677898@ruffy2.mtv.corp.google.com> Date: Wed, 10 Sep 2014 18:00:00 -0000 To: Gary Benson Cc: gdb-patches@sourceware.org, Pedro Alves Subject: Re: [PATCH 5/9 v7] Introduce common-regcache.h In-Reply-To: <1409320299-6812-6-git-send-email-gbenson@redhat.com> References: <1409320299-6812-1-git-send-email-gbenson@redhat.com> <1409320299-6812-6-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00339.txt.bz2 Gary Benson writes: > This introduces common-regcache.h. This contains two functions that > allow nat/linux-btrace.c to be simplified. A better long term > solution would be unify the regcache code, but this is sufficient for > now. > > This patch differs from the version I posted on August 1 > (https://sourceware.org/ml/gdb-patches/2014-08/msg00010.html) in that > some suggested documentation changes have been made and that various > updates were required to reflect regcache changes recently committed > by Andreas Arnez. > > gdb/ChangeLog: > > * common/common-regcache.h: New file. > * Makefile.in (HFILES_NO_SRCDIR): Add common/common-regcache.h. > * regcache.h: Include common-regcache.h. > (regcache_read_pc): Don't declare. > * regcache.c (get_thread_regcache_for_ptid): New function. > * nat/linux-btrace.c: Don't include regcache.h. > Include common-regcache.h. > (perf_event_read_bts): Use get_thread_regcache_for_ptid. > > gdb/gdbserver/ChangeLog: > > * regcache.h: Include common-regcache.h. > (regcache_read_pc): Don't declare. > * regcache.c (get_thread_regcache_for_ptid): New function. >[...] > diff --git a/gdb/common/common-regcache.h b/gdb/common/common-regcache.h > new file mode 100644 > index 0000000..aef6bfd > --- /dev/null > +++ b/gdb/common/common-regcache.h > @@ -0,0 +1,35 @@ > +/* Cache and manage the values of registers > + > + Copyright (C) 1986-2014 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef COMMON_REGCACHE_H > +#define COMMON_REGCACHE_H > + > +/* This header is a stopgap until we have an independent regcache. */ > + > +/* Return the register cache associated with the thread specified > + by PTID. This function must be provided by the client. */ Hi. Can you add a comment here explaining the ownership of the memory object returned? E.g., is it cached "internally" to the function so that the caller doesn't have to free it? Thanks! > + > +extern struct regcache *get_thread_regcache_for_ptid (ptid_t ptid); > + > +/* Read the PC register. This function must be provided by the > + client. */ > + > +extern CORE_ADDR regcache_read_pc (struct regcache *regcache); > + > +#endif /* COMMON_REGCACHE_H */