Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: David Lamy-Charrier <david.lamy@gmail.com>
Cc: gdb@sources.redhat.com
Subject: Re: Convenience variable for filename in add-symbol-file not expanded
Date: Thu, 29 Sep 2005 14:04:00 -0000	[thread overview]
Message-ID: <433BF3E4.5010001@st.com> (raw)
In-Reply-To: <6541ed4c0509290637259f1b9f@mail.gmail.com>

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


  reply	other threads:[~2005-09-29 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-29 12:36 Ruppert
2005-09-29 12:50 ` David Lamy-Charrier
2005-09-29 13:00   ` Andrew STUBBS
2005-09-29 13:38     ` David Lamy-Charrier
2005-09-29 14:04       ` Andrew STUBBS [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-29 10:22 David Lamy-Charrier

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=433BF3E4.5010001@st.com \
    --to=andrew.stubbs@st.com \
    --cc=david.lamy@gmail.com \
    --cc=gdb@sources.redhat.com \
    /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