From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18947 invoked by alias); 29 Sep 2005 14:04:51 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 18913 invoked by uid 22791); 29 Sep 2005 14:04:46 -0000 Received: from fra-del-02.spheriq.net (HELO fra-del-02.spheriq.net) (195.46.51.98) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 29 Sep 2005 14:04:46 +0000 Received: from fra-out-02.spheriq.net (fra-out-02.spheriq.net [195.46.51.130]) by fra-del-02.spheriq.net with ESMTP id j8TE4eYb000968 for ; Thu, 29 Sep 2005 14:04:40 GMT Received: from fra-cus-02.spheriq.net (fra-cus-02.spheriq.net [195.46.51.38]) by fra-out-02.spheriq.net with ESMTP id j8TE41jV013495 for ; Thu, 29 Sep 2005 14:04:32 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-02.spheriq.net with ESMTP id j8TE3xZp029818 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Thu, 29 Sep 2005 14:04:01 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 85578DA41; Thu, 29 Sep 2005 14:03:40 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id 08E2B47235; Thu, 29 Sep 2005 14:06:00 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B68477599D; Thu, 29 Sep 2005 14:06:00 +0000 (UTC) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BA4E44723D; Thu, 29 Sep 2005 14:05:59 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.4.4-GR) with ESMTP id BZY00477 (AUTH "andrew stubbs"); Thu, 29 Sep 2005 15:03:22 +0100 (BST) Message-ID: <433BF3E4.5010001@st.com> Date: Thu, 29 Sep 2005 14:04:00 -0000 From: Andrew STUBBS User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: David Lamy-Charrier Cc: gdb@sources.redhat.com Subject: Re: Convenience variable for filename in add-symbol-file not expanded References: <200509291235.j8TCZHg16388@haiti.swb.siemens.de> <6541ed4c0509290550663f5331@mail.gmail.com> <433BE4EE.6040100@st.com> <6541ed4c0509290637259f1b9f@mail.gmail.com> In-Reply-To: <6541ed4c0509290637259f1b9f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 2.3.0 X-SW-Source: 2005-09/txt/msg00245.txt.bz2 David Lamy-Charrier wrote: > Thanks Andrew, > > I already have a static buffer in the inferior program containing the > path to the file I want to use. > You mean that I should declare a pointer to the variable in the > inferior program too ? > And then how can I access the pointed value in gdb, using > value_of_internalvar() or parse_and_eval_address() or anything else) ? No, I mean you can create a convenience variable with type char*. The command language can be made to substitute convenience variables starting with $, but it seems a little much to expect it to unpick program variables as well. So, if your string were referenced by an inferior variable 'filename', it would look like: (gdb) set $name = filename (gdb) set $address = 0x..... (gdb) add-symbol-file $name $address You can then use lookup_internalvar() to get the address and then read the string from memory somehow, get_target_memory() probably (look in target.h for the various options). Of course, there may be a better way ... anyone? HTH Andrew