From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 3/3] Remove target_read_live_memory
Date: Tue, 11 Mar 2014 12:45:00 -0000 [thread overview]
Message-ID: <1394541731-27486-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1394541731-27486-1-git-send-email-yao@codesourcery.com>
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 <yao@codesourcery.com>
* 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 *);
--
1.7.7.6
next prev parent reply other threads:[~2014-03-11 12:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 12:44 [PATCH 1/3] Move the traceframe_available_memory code from memory_xfer_partial_1 down to the targets Yao Qi
2014-03-11 12:45 ` Yao Qi [this message]
2014-03-21 12:01 ` [PATCH 3/3] Remove target_read_live_memory Pedro Alves
2014-03-22 11:23 ` Yao Qi
2014-03-11 12:45 ` [PATCH 2/3] Factor remote_read_bytes Yao Qi
2014-03-21 11:57 ` Pedro Alves
2014-03-21 9:41 ` [PATCH 1/3] Move the traceframe_available_memory code from memory_xfer_partial_1 down to the targets Yao Qi
2014-03-21 11:56 ` Pedro Alves
2014-03-22 11:20 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394541731-27486-3-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox