From 7171232768ab846e00032b7218b2a4ad275b6ae2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 3 Dec 2011 18:39:43 +0000 Subject: [PATCH] sim: export cb_get_string for people to use 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 --- include/gdb/ChangeLog | 4 ++++ include/gdb/callback.h | 3 +++ sim/common/ChangeLog | 5 +++++ sim/common/syscall.c | 6 +++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index dabaa5b19e0..9ce3db91416 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,7 @@ +2011-12-03 Mike Frysinger + + * callback.h (cb_get_string): New prototype. + 2011-04-14 Mike Frysinger * remote-sim.h (sim_complete_command): New prototype. diff --git a/include/gdb/callback.h b/include/gdb/callback.h index a1f79f94de4..bbc5bb3481b 100644 --- a/include/gdb/callback.h +++ b/include/gdb/callback.h @@ -324,6 +324,9 @@ 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 (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/ChangeLog b/sim/common/ChangeLog index 405888fdd3e..c69b94864b8 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2011-12-03 Mike Frysinger + + * syscall.c (cb_get_string): Rename from "get_string". + (get_path): Rename get_string call to cb_get_string. + 2011-12-03 Mike Frysinger * Make-common.in (VPATH): Add $(srccom). diff --git a/sim/common/syscall.c b/sim/common/syscall.c index 28816c02b55..1dfe7aabaab 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 -- 2.30.2