* convenience variables in "target remote" @ 2005-11-10 10:33 Vladimir Prus 2005-11-10 13:43 ` Daniel Jacobowitz 0 siblings, 1 reply; 5+ messages in thread From: Vladimir Prus @ 2005-11-10 10:33 UTC (permalink / raw) To: gdb 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? - Volodya ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: convenience variables in "target remote" 2005-11-10 10:33 convenience variables in "target remote" Vladimir Prus @ 2005-11-10 13:43 ` Daniel Jacobowitz 2005-11-10 14:03 ` Vladimir Prus 0 siblings, 1 reply; 5+ messages in thread From: Daniel Jacobowitz @ 2005-11-10 13:43 UTC (permalink / raw) To: Vladimir Prus; +Cc: gdb 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. Most places that take a number do not support them; that's by design, the full range of expressions are not supported for ports. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: convenience variables in "target remote" 2005-11-10 13:43 ` Daniel Jacobowitz @ 2005-11-10 14:03 ` Vladimir Prus 2005-11-10 16:17 ` Daniel Jacobowitz 2005-11-10 19:32 ` Eli Zaretskii 0 siblings, 2 replies; 5+ messages in thread From: Vladimir Prus @ 2005-11-10 14:03 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: convenience variables in "target remote" 2005-11-10 14:03 ` Vladimir Prus @ 2005-11-10 16:17 ` Daniel Jacobowitz 2005-11-10 19:32 ` Eli Zaretskii 1 sibling, 0 replies; 5+ messages in thread From: Daniel Jacobowitz @ 2005-11-10 16:17 UTC (permalink / raw) To: Vladimir Prus; +Cc: gdb On Thu, Nov 10, 2005 at 05:03:15PM +0300, Vladimir Prus wrote: > 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. Really, it's pretty obvious. It's used in the same places we're evaluating an expression in the context of the target program / architecture. Print, call, set. > > 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 an arbitrary restriction in kdevelop, which is what it looks like to me. We could add support for "convenience variables" just about anywhere. But in general, we want them to behave exactly like target variables, set in the running program; that's how they're defined, with the very specific exceptions of the $arg* variables. In places where, say, a user-defined struct type wouldn't make any sense, convenience variables are probably inappropriate. This is one part of the CLI that I'm trying to hold feature creep to a minimum, pending a better-specified scripting language. -- Daniel Jacobowitz CodeSourcery, LLC ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: convenience variables in "target remote" 2005-11-10 14:03 ` Vladimir Prus 2005-11-10 16:17 ` Daniel Jacobowitz @ 2005-11-10 19:32 ` Eli Zaretskii 1 sibling, 0 replies; 5+ messages in thread From: Eli Zaretskii @ 2005-11-10 19:32 UTC (permalink / raw) To: Vladimir Prus; +Cc: gdb > From: Vladimir Prus <ghost@cs.msu.su> > Date: Thu, 10 Nov 2005 17:03:15 +0300 > Cc: gdb@sources.redhat.com > > > 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. Feel free to donate a detailed description, I would be thrilled to add it to the manual. > seems like arbitrary restriction for me. Feel free to donate code that lifts this ``arbitrary restriction''. TIA ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-11-10 19:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-11-10 10:33 convenience variables in "target remote" Vladimir Prus 2005-11-10 13:43 ` Daniel Jacobowitz 2005-11-10 14:03 ` Vladimir Prus 2005-11-10 16:17 ` Daniel Jacobowitz 2005-11-10 19:32 ` Eli Zaretskii
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).