From patchwork Wed Jul 29 07:17:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 7909 Received: (qmail 73652 invoked by alias); 29 Jul 2015 07:17:53 -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 73614 invoked by uid 89); 29 Jul 2015 07:17:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f179.google.com Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 29 Jul 2015 07:17:51 +0000 Received: by pdjr16 with SMTP id r16so999790pdj.3 for ; Wed, 29 Jul 2015 00:17:49 -0700 (PDT) X-Received: by 10.70.125.129 with SMTP id mq1mr91662042pdb.19.1438154269272; Wed, 29 Jul 2015 00:17:49 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id c5sm38832012pds.87.2015.07.29.00.17.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jul 2015 00:17:48 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] PR record/18691: Fix fails in solib-precsave.exp Date: Wed, 29 Jul 2015 08:17:38 +0100 Message-Id: <1438154258-16402-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes We see the following regressions in testing on x86_64-linux, reverse-step^M Cannot access memory at address 0x2aaaaaed26c0^M (gdb) FAIL: gdb.reverse/solib-precsave.exp: reverse-step into solib function one when GDB reverse step into a function, GDB wants to skip prologue so it requests TARGET_OBJECT_CODE_MEMORY to read some code memory in memory_xfer_partial_1. However in dcache_read_memory_partial, the object becomes TARGET_OBJECT_MEMORY return ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL, myaddr, NULL, memaddr, len, xfered_len); in reverse debugging, ops->to_xfer_partial is record_full_core_xfer_partial and it will return TARGET_XFER_E_IO because it can't find any records. The test fails. At this moment, the delegate relationship is like dcache -> record-core -> core -> exec and we want to GDB read memory across targets, which means if the requested memory isn't found in record-core, GDB can read memory from core, and exec even further if needed. I find raw_memory_xfer_partial is exactly what I want. Regression tested on x86_64-linux both native and gdbserver. gdb: 2015-07-29 Yao Qi PR record/18691 * dcache.c (dcache_read_memory_partial): Call raw_memory_xfer_partial. * target.c (raw_memory_xfer_partial): Make it non-static. * target.h (raw_memory_xfer_partial): Declare. --- gdb/dcache.c | 5 ++--- gdb/target.c | 2 +- gdb/target.h | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gdb/dcache.c b/gdb/dcache.c index 3c8319f..f87c529 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -498,9 +498,8 @@ dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache, { /* Even though reading the whole line failed, we may be able to read a piece starting where the caller wanted. */ - return ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL, - myaddr, NULL, memaddr, len, - xfered_len); + return raw_memory_xfer_partial (ops, myaddr, NULL, memaddr, len, + xfered_len); } else { diff --git a/gdb/target.c b/gdb/target.c index 4e2d005..01bac7e 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1060,7 +1060,7 @@ memory_xfer_check_region (gdb_byte *readbuf, const gdb_byte *writebuf, instance, could have some of memory but delegate other bits to the target below it. So, we must manually try all targets. */ -static enum target_xfer_status +enum target_xfer_status raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr, LONGEST len, ULONGEST *xfered_len) diff --git a/gdb/target.h b/gdb/target.h index 32234f7..75b830d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -265,6 +265,11 @@ typedef enum target_xfer_status ULONGEST len, ULONGEST *xfered_len); +enum target_xfer_status +raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf, + const gdb_byte *writebuf, ULONGEST memaddr, LONGEST len, + ULONGEST *xfered_len); + /* Request that OPS transfer up to LEN addressable units of the target's OBJECT. When reading from a memory object, the size of an addressable unit is architecture dependent and can be found using