From patchwork Tue Mar 11 12:42:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 36 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id 8E39C3600FA for ; Tue, 11 Mar 2014 05:45:09 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 3DD5D638A4AA5; Tue, 11 Mar 2014 05:45:09 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 233D0638A4A9B for ; Tue, 11 Mar 2014 05:45:09 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=w5DD7 jL1rb/DB4FrSKO+vd2TMi3cKFh/YdNKjFh+BLzKfa9yoCTkpK3qIsLE7uy+3QZH+ hh/PU+NcK/Vlcrcv22ABtExNlBEOqMz4fJKPK0LK5kSKseMlWX0kOQxq8BMbq65V VD7ics+seuv8YRPUxX5Np//tLxM/x4EehHg8XE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=eu4bZzs+98q hSg3eJTij11MoJwE=; b=IVQiLyHD9F/iWsJkeD4jM0l4ROnoaYO+9XhmuLYumJD jU2uBhn55FXuBW5TEaZlpovjEShyZEqEp8587G2rt8LQQTE06/oc9znGfeDpyy5x 1L69K+j6NHs9tmtQgfYK2g9ZxXKuj8na9RKVoCvvylkvJM12Di4gkdHH3DvxhGQI = Received: (qmail 5938 invoked by alias); 11 Mar 2014 12:45:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5403 invoked by uid 89); 11 Mar 2014 12:44:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00 autolearn=ham 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; Tue, 11 Mar 2014 12:44:54 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WNM38-0002qk-Pt from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 11 Mar 2014 05:44:50 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 11 Mar 2014 05:44:50 -0700 Received: from qiyao.dyndns.org.com (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; Tue, 11 Mar 2014 05:44:49 -0700 From: Yao Qi To: Subject: [PATCH 3/3] Remove target_read_live_memory Date: Tue, 11 Mar 2014 20:42:11 +0800 Message-ID: <1394541731-27486-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1394541731-27486-1-git-send-email-yao@codesourcery.com> References: <1394541731-27486-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in As we move code on reading unavailable memory to target side, GDB core side doesn't need the "switching momentarily out of tfind mode" dance. The target remote knows how to read live memory (through remote_ops). Remove set_traceframe_number and make_cleanup_restore_traceframe_number, since they are no longer used. gdb: 2014-03-11 Yao Qi * remote.c (target_read_live_memory): Remove. (memory_xfer_live_readonly_partial): Rename it to remote_xfer_live_readonly_partial. Remove arguments 'ops' and 'object'. All callers updated. Call remote_read_bytes_1 instead of target_read_live_memory. * tracepoint.c (set_traceframe_number): Remove. (make_cleanup_restore_traceframe_number): Likewise . * tracepoint.h (set_traceframe_number): Remove declaration. (make_cleanup_restore_traceframe_number): Likewise. --- gdb/remote.c | 47 +++++++++-------------------------------------- gdb/tracepoint.c | 15 --------------- gdb/tracepoint.h | 9 --------- 3 files changed, 9 insertions(+), 62 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index b5c6b4b..c31d986 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6874,46 +6874,19 @@ remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len, return TARGET_XFER_OK; } -/* Read memory from the live target, even if currently inspecting a - traceframe. The return is the same as that of target_read. */ - -static enum target_xfer_status -target_read_live_memory (enum target_object object, - ULONGEST memaddr, gdb_byte *myaddr, ULONGEST len, - ULONGEST *xfered_len) -{ - enum target_xfer_status ret; - struct cleanup *cleanup; - - /* Switch momentarily out of tfind mode so to access live memory. - Note that this must not clear global state, such as the frame - cache, which must still remain valid for the previous traceframe. - We may be _building_ the frame cache at this point. */ - cleanup = make_cleanup_restore_traceframe_number (); - set_traceframe_number (-1); - - ret = target_xfer_partial (current_target.beneath, object, NULL, - myaddr, NULL, memaddr, len, xfered_len); - - do_cleanups (cleanup); - return ret; -} - -/* Using the set of read-only target sections of OPS, read live - read-only memory. Note that the actual reads start from the - top-most target again. +/* Using the set of read-only target sections of remote, read live + read-only memory. For interface/parameters/return description see target.h, to_xfer_partial. */ static enum target_xfer_status -memory_xfer_live_readonly_partial (struct target_ops *ops, - enum target_object object, - gdb_byte *readbuf, ULONGEST memaddr, +remote_xfer_live_readonly_partial (gdb_byte *readbuf, ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len) { struct target_section *secp; struct target_section_table *table; + struct target_ops *ops = &remote_ops; secp = target_section_by_addr (ops, memaddr); if (secp != NULL @@ -6933,8 +6906,8 @@ memory_xfer_live_readonly_partial (struct target_ops *ops, if (memend <= p->endaddr) { /* Entire transfer is within this section. */ - return target_read_live_memory (object, memaddr, - readbuf, len, xfered_len); + return remote_read_bytes_1 (memaddr, readbuf, len, + xfered_len); } else if (memaddr >= p->endaddr) { @@ -6945,8 +6918,8 @@ memory_xfer_live_readonly_partial (struct target_ops *ops, { /* This section overlaps the transfer. Just do half. */ len = p->endaddr - memaddr; - return target_read_live_memory (object, memaddr, - readbuf, len, xfered_len); + return remote_read_bytes_1 (memaddr, readbuf, len, + xfered_len); } } } @@ -6998,9 +6971,7 @@ remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len, do_cleanups (old_chain); /* This goes through the topmost target again. */ - res = memory_xfer_live_readonly_partial (&remote_ops, - TARGET_OBJECT_MEMORY, - myaddr, memaddr, + res = remote_xfer_live_readonly_partial (myaddr, memaddr, len, xfered_len); if (res == TARGET_XFER_OK) return TARGET_XFER_OK; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 673fddd..c522193 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3216,15 +3216,6 @@ set_current_traceframe (int num) clear_traceframe_info (); } -/* Make the traceframe NUM be the current trace frame, and do nothing - more. */ - -void -set_traceframe_number (int num) -{ - traceframe_number = num; -} - /* A cleanup used when switching away and back from tfind mode. */ struct current_traceframe_cleanup @@ -3261,12 +3252,6 @@ make_cleanup_restore_current_traceframe (void) restore_current_traceframe_cleanup_dtor); } -struct cleanup * -make_cleanup_restore_traceframe_number (void) -{ - return make_cleanup_restore_integer (&traceframe_number); -} - /* Given a number and address, return an uploaded tracepoint with that number, creating if necessary. */ diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 8a1abbf..39b5edb 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -269,21 +269,12 @@ extern int get_traceframe_number (void); /* Returns the tracepoint number for current traceframe. */ extern int get_tracepoint_number (void); -/* Make the traceframe NUM be the current GDB trace frame number, and - do nothing more. In particular, this does not flush the - register/frame caches or notify the target about the trace frame - change, so that is can be used when we need to momentarily access - live memory. Targets lazily switch their current traceframe to - match GDB's traceframe number, at the appropriate times. */ -extern void set_traceframe_number (int); - /* Make the traceframe NUM be the current trace frame, all the way to the target, and flushes all global state (register/frame caches, etc.). */ extern void set_current_traceframe (int num); struct cleanup *make_cleanup_restore_current_traceframe (void); -struct cleanup *make_cleanup_restore_traceframe_number (void); void free_actions (struct breakpoint *);