From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Cc: toolchain-devel@blackfin.uclinux.org
Subject: [PATCH 1/2] sim: export cb_get_string for people to use
Date: Thu, 26 May 2011 19:41:00 -0000 [thread overview]
Message-ID: <1306438878-14479-1-git-send-email-vapier@gentoo.org> (raw)
The common sim code provides a useful "get_string" function which reads
a C string out of the target's memory space. So rename and export it
for other people to use.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
include/gdb/:
2011-05-26 Mike Frysinger <vapier@gentoo.org>
* callback.h (cb_get_string): New prototype.
sim/common/:
2011-05-26 Mike Frysinger <vapier@gentoo.org>
* syscall.c (cb_get_string): Rename from "get_string".
(get_path): Rename get_string call to cb_get_string.
---
include/gdb/callback.h | 4 ++++
sim/common/syscall.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/gdb/callback.h b/include/gdb/callback.h
index 296dfc3..f888957 100644
--- a/include/gdb/callback.h
+++ b/include/gdb/callback.h
@@ -329,6 +329,10 @@ int cb_is_stdin (host_callback *, int);
int cb_is_stdout (host_callback *, int);
int cb_is_stderr (host_callback *, int);
+/* Read a string out of the target. */
+int cb_get_string PARAMS ((host_callback *, CB_SYSCALL *, char *, int,
+ unsigned long));
+
/* Perform a system call. */
CB_RC cb_syscall (host_callback *, CB_SYSCALL *);
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 28816c0..1dfe7aa 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -76,8 +76,8 @@ char *simulator_sysroot = "";
/* Utility of cb_syscall to fetch a path name or other string from the target.
The result is 0 for success or a host errno value. */
-static int
-get_string (cb, sc, buf, buflen, addr)
+int
+cb_get_string (cb, sc, buf, buflen, addr)
host_callback *cb;
CB_SYSCALL *sc;
char *buf;
@@ -121,7 +121,7 @@ get_path (cb, sc, addr, bufp)
int result;
int sysroot_len = strlen (simulator_sysroot);
- result = get_string (cb, sc, buf, MAX_PATH_LEN - sysroot_len, addr);
+ result = cb_get_string (cb, sc, buf, MAX_PATH_LEN - sysroot_len, addr);
if (result == 0)
{
/* Prepend absolute paths with simulator_sysroot. Relative paths
--
1.7.5.rc3
next reply other threads:[~2011-05-26 19:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 19:41 Mike Frysinger [this message]
2011-05-26 19:41 ` [PATCH 2/2] sim: bfin: lookup target strings when tracing system calls Mike Frysinger
2011-12-03 19:05 ` Mike Frysinger
2011-05-27 18:24 ` [PATCH 1/2] sim: export cb_get_string for people to use Tom Tromey
2011-05-27 18:35 ` Mike Frysinger
2011-05-28 14:56 ` [PATCH v2] " Mike Frysinger
2011-12-03 18:40 ` Mike Frysinger
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=1306438878-14479-1-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
--cc=toolchain-devel@blackfin.uclinux.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