From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11076 invoked by alias); 26 May 2011 19:41:38 -0000 Received: (qmail 11058 invoked by uid 22791); 26 May 2011 19:41:36 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 May 2011 19:41:20 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6715F1CC00F; Thu, 26 May 2011 19:41:19 +0000 (UTC) From: Mike Frysinger 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 Message-Id: <1306438878-14479-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00619.txt.bz2 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/: 2011-05-26 Mike Frysinger * callback.h (cb_get_string): New prototype. sim/common/: 2011-05-26 Mike Frysinger * 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