public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sources.redhat.com
Subject: Re: convenience variables in "target remote"
Date: Thu, 10 Nov 2005 14:03:00 -0000	[thread overview]
Message-ID: <200511101703.15903.ghost@cs.msu.su> (raw)
In-Reply-To: <20051110134340.GA21648@nevyn.them.org>

On Thursday 10 November 2005 16:43, Daniel Jacobowitz wrote:
> On Thu, Nov 10, 2005 at 01:29:46PM +0300, Vladimir Prus wrote:
> > Hi,
> > it looks like "target remote" command does not handle convenience
> > variables properly:
> >
> >    (gdb) set $var=1234
> >    (gdb) target remote :$var
> >
> >    :$var: Connection refused.
> >
> >    (gdb) target remote :1234
> >    Remote debugging using :1234
> >
> > When $var is used, it's not expanded, at gdb tries to connect to the
> > wrong port?
> >
> > Is this by design, or a bug?
>
> Convenience variables are expanded in roughly the same places that the
> (C) expression evaluator is used to parse expressions.  

That's pretty vague, I think. Does documentation say where exactly that "(C)" 
expression evaluator is used? If not, then guesswork is the only way to find 
out.

> Most places 
> that take a number do not support them; that's by design, the full
> range of expressions are not supported for ports.

In fact, it seems like only literals are supported for ports. This, just like 
requirements that "x" command accept only literal as the number of bugs, 
seems like arbitrary restriction for me.

Specifically, in KDevelop for remote debugging, user should provide a shell 
script to run program remotely, and a gdb script to connect to a program.
The gdb script can just containg "target remote somehost:1234". But I don't 
think it's unreasonable for two people to remotely debug program on the same 
box. So, port should not be hardcoded.

I though about using convenience variables to pass port number from "run 
program" script to "connect to target" gdb script, but due to above 
limitation, this is not possible. So, I should have shell script that will be 
given port number and will produce the set of gdb commands to connect to the 
target. Another level of scripting just to overcome arbitrary restriction in 
gdb.
Or is there some indirect way to use variable in "target remote" command?

- Volodya


  reply	other threads:[~2005-11-10 14:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 10:33 Vladimir Prus
2005-11-10 13:43 ` Daniel Jacobowitz
2005-11-10 14:03   ` Vladimir Prus [this message]
2005-11-10 16:17     ` Daniel Jacobowitz
2005-11-10 19:32     ` Eli Zaretskii

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=200511101703.15903.ghost@cs.msu.su \
    --to=ghost@cs.msu.su \
    --cc=drow@false.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).