* Processing of convenience variables for scripts ...
@ 2002-11-20 0:48 Richard Sharpe
2002-11-20 6:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: Richard Sharpe @ 2002-11-20 0:48 UTC (permalink / raw)
To: gdb
Hi,
The following script does not seem to work:
define load-ko-syms
path ./freebsd_46_i386/debug/export/kernel
set $file = linker_files.tqh_first
set $file = $file->link.tqe_next
if ($file == 0)
printf "No klds to load symbols for\n"
else
while ($file != 0)
add-symbol-file $file->filename ($file->address +
$file->text_offs)
printf "Loaded symbols for %s\n", $file->filename
set $file = $file->link.tqe_next
end
end
end
The loop works, but add-symbol-file seems to be called without the
convenience variables being expanded.
Have it got that right?
If so, what would be the first step to get them expanded?
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org,
sharpe[at]ethereal.com, http://www.richardsharpe.com
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: Processing of convenience variables for scripts ... 2002-11-20 0:48 Processing of convenience variables for scripts Richard Sharpe @ 2002-11-20 6:13 ` Daniel Jacobowitz 2002-11-20 8:32 ` Andrew Cagney 2002-12-08 11:16 ` Doug Evans 0 siblings, 2 replies; 14+ messages in thread From: Daniel Jacobowitz @ 2002-11-20 6:13 UTC (permalink / raw) To: Richard Sharpe; +Cc: gdb On Wed, Nov 20, 2002 at 07:42:04PM +1030, Richard Sharpe wrote: > Hi, > > The following script does not seem to work: > > define load-ko-syms > path ./freebsd_46_i386/debug/export/kernel > set $file = linker_files.tqh_first > set $file = $file->link.tqe_next > if ($file == 0) > printf "No klds to load symbols for\n" > else > while ($file != 0) > add-symbol-file $file->filename ($file->address + > $file->text_offs) > printf "Loaded symbols for %s\n", $file->filename > set $file = $file->link.tqe_next > end > end > end > > The loop works, but add-symbol-file seems to be called without the > convenience variables being expanded. > > Have it got that right? > > If so, what would be the first step to get them expanded? add-symbol-file takes constants, not expressions - so variables are not expanded. This should probably change but it's not clear how, given the parser... -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 6:13 ` Daniel Jacobowitz @ 2002-11-20 8:32 ` Andrew Cagney 2002-11-20 8:36 ` Daniel Jacobowitz 2002-12-08 11:16 ` Doug Evans 1 sibling, 1 reply; 14+ messages in thread From: Andrew Cagney @ 2002-11-20 8:32 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Richard Sharpe, gdb > The loop works, but add-symbol-file seems to be called without the >> convenience variables being expanded. >> >> Have it got that right? >> >> If so, what would be the first step to get them expanded? > > > add-symbol-file takes constants, not expressions - so variables are not > expanded. This should probably change but it's not clear how, given > the parser... A quick/dirty hack would be: eval ..... similar to the SH equivalent. I suspect an eval will be needed anyway. Andrew ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 8:32 ` Andrew Cagney @ 2002-11-20 8:36 ` Daniel Jacobowitz 2002-11-20 9:28 ` Richard Sharpe 0 siblings, 1 reply; 14+ messages in thread From: Daniel Jacobowitz @ 2002-11-20 8:36 UTC (permalink / raw) To: Andrew Cagney; +Cc: Richard Sharpe, gdb On Wed, Nov 20, 2002 at 11:32:24AM -0500, Andrew Cagney wrote: > >The loop works, but add-symbol-file seems to be called without the > >>convenience variables being expanded. > >> > >>Have it got that right? > >> > >>If so, what would be the first step to get them expanded? > > > > > >add-symbol-file takes constants, not expressions - so variables are not > >expanded. This should probably change but it's not clear how, given > >the parser... > > A quick/dirty hack would be: > > eval ..... > > similar to the SH equivalent. I suspect an eval will be needed anyway. Honestly, I'd rather define the CLI grammar I've been talking about than add any more quick hacks. That's a good 6.0 thing to do, clean up our CLI a little... -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 8:36 ` Daniel Jacobowitz @ 2002-11-20 9:28 ` Richard Sharpe 2002-11-20 10:36 ` Daniel Jacobowitz 0 siblings, 1 reply; 14+ messages in thread From: Richard Sharpe @ 2002-11-20 9:28 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Andrew Cagney, gdb On Wed, 20 Nov 2002, Daniel Jacobowitz wrote: > On Wed, Nov 20, 2002 at 11:32:24AM -0500, Andrew Cagney wrote: > > >The loop works, but add-symbol-file seems to be called without the > > >>convenience variables being expanded. > > >> > > >>Have it got that right? > > >> > > >>If so, what would be the first step to get them expanded? > > > > > > > > >add-symbol-file takes constants, not expressions - so variables are not > > >expanded. This should probably change but it's not clear how, given > > >the parser... > > > > A quick/dirty hack would be: > > > > eval ..... > > > > similar to the SH equivalent. I suspect an eval will be needed anyway. > > Honestly, I'd rather define the CLI grammar I've been talking about > than add any more quick hacks. That's a good 6.0 thing to do, clean up > our CLI a little... I have a short-term need and a long-term need. I am willing to expend effort on both. Where is the description of this grammar? Regards ----- Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, sharpe[at]ethereal.com, http://www.richardsharpe.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 9:28 ` Richard Sharpe @ 2002-11-20 10:36 ` Daniel Jacobowitz 2002-11-20 21:40 ` Eli Zaretskii ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Daniel Jacobowitz @ 2002-11-20 10:36 UTC (permalink / raw) To: Richard Sharpe; +Cc: Andrew Cagney, gdb On Thu, Nov 21, 2002 at 04:22:53AM +1030, Richard Sharpe wrote: > On Wed, 20 Nov 2002, Daniel Jacobowitz wrote: > > > On Wed, Nov 20, 2002 at 11:32:24AM -0500, Andrew Cagney wrote: > > > >The loop works, but add-symbol-file seems to be called without the > > > >>convenience variables being expanded. > > > >> > > > >>Have it got that right? > > > >> > > > >>If so, what would be the first step to get them expanded? > > > > > > > > > > > >add-symbol-file takes constants, not expressions - so variables are not > > > >expanded. This should probably change but it's not clear how, given > > > >the parser... > > > > > > A quick/dirty hack would be: > > > > > > eval ..... > > > > > > similar to the SH equivalent. I suspect an eval will be needed anyway. > > > > Honestly, I'd rather define the CLI grammar I've been talking about > > than add any more quick hacks. That's a good 6.0 thing to do, clean up > > our CLI a little... > > I have a short-term need and a long-term need. > > I am willing to expend effort on both. Where is the description of this > grammar? In that case, in the short term, it would be worthwhile to implement eval. A simple version would just find any individual word that started with a $ and substitute variables, and end up with something like "eval add-symbol-file $name $addr". The long-term grammar is still entirely in my imagination, alas. It requires: - Examining and recording the syntax of all our existing CLI commands (ouch!). The manual is good but not complete enough IMVHO; people add quirks to functions without documenting them. - Determining which syntax structures we need to preserve and which should go. - Parsing CLI lines before calling the assigned functions, according to some data registered with the handler function. This will involve changing syntax for at least some commands, I expect. I think it's worthwhile but we need to see how invasive it would be. This can be done a bit at a time. I want to get decode_line_1 tamed a bit first... David has made astonishing progress cleaning it up, next will be to characterize its behavior a little better. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 10:36 ` Daniel Jacobowitz @ 2002-11-20 21:40 ` Eli Zaretskii 2002-12-05 16:52 ` Fernando Nasser 2002-12-08 11:36 ` Doug Evans 2 siblings, 0 replies; 14+ messages in thread From: Eli Zaretskii @ 2002-11-20 21:40 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Andrew Cagney, gdb On Wed, 20 Nov 2002, Daniel Jacobowitz wrote: > - Examining and recording the syntax of all our existing CLI commands > (ouch!). The manual is good but not complete enough IMVHO; people > add quirks to functions without documenting them. If you find undocumented features, please tell what they are. Let's at least have a list of them. TIA ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 10:36 ` Daniel Jacobowitz 2002-11-20 21:40 ` Eli Zaretskii @ 2002-12-05 16:52 ` Fernando Nasser 2002-12-08 11:36 ` Doug Evans 2 siblings, 0 replies; 14+ messages in thread From: Fernando Nasser @ 2002-12-05 16:52 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Richard Sharpe, Andrew Cagney, gdb Daniel Jacobowitz wrote: > In that case, in the short term, it would be worthwhile to implement > eval. A simple version would just find any individual word that > started with a $ and substitute variables, and end up with something > like "eval add-symbol-file $name $addr". > Seems useful to me, and probably not difficult to implement. -- Fernando Nasser Red Hat - Toronto E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 10:36 ` Daniel Jacobowitz 2002-11-20 21:40 ` Eli Zaretskii 2002-12-05 16:52 ` Fernando Nasser @ 2002-12-08 11:36 ` Doug Evans 2002-12-08 12:30 ` Daniel Jacobowitz 2 siblings, 1 reply; 14+ messages in thread From: Doug Evans @ 2002-12-08 11:36 UTC (permalink / raw) To: fnasser; +Cc: gdb Fernando writes: >>Daniel Jacobowitz wrote: >> >> In that case, in the short term, it would be worthwhile to implement >> eval. A simple version would just find any individual word that >> started with a $ and substitute variables, and end up with something >> like "eval add-symbol-file $name $addr". > > Seems useful to me, and probably not difficult to implement. add-symbol-file takes a file name as the first argument and you can't store strings (of any kind) in convenience variables. I haven't checked FSF sources in the last few months, maybe things have improved. If so great. If not, how would this work? ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-12-08 11:36 ` Doug Evans @ 2002-12-08 12:30 ` Daniel Jacobowitz 2002-12-08 12:52 ` Doug Evans 0 siblings, 1 reply; 14+ messages in thread From: Daniel Jacobowitz @ 2002-12-08 12:30 UTC (permalink / raw) To: Doug Evans; +Cc: fnasser, gdb On Sun, Dec 08, 2002 at 11:36:22AM -0800, Doug Evans wrote: > Fernando writes: > >>Daniel Jacobowitz wrote: > >> > >> In that case, in the short term, it would be worthwhile to implement > >> eval. A simple version would just find any individual word that > >> started with a $ and substitute variables, and end up with something > >> like "eval add-symbol-file $name $addr". > > > > Seems useful to me, and probably not difficult to implement. > > add-symbol-file takes a file name as the first argument and > you can't store strings (of any kind) in convenience variables. > > I haven't checked FSF sources in the last few months, > maybe things have improved. If so great. If not, how would this work? This is true. One problem at a time - numbers first. I have some ideas, but I won't have a chance to work on this until next weekend. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-12-08 12:30 ` Daniel Jacobowitz @ 2002-12-08 12:52 ` Doug Evans 0 siblings, 0 replies; 14+ messages in thread From: Doug Evans @ 2002-12-08 12:52 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: fnasser, gdb Daniel Jacobowitz writes: > > add-symbol-file takes a file name as the first argument and > > you can't store strings (of any kind) in convenience variables. > > > > I haven't checked FSF sources in the last few months, > > maybe things have improved. If so great. If not, how would this work? > > This is true. One problem at a time - numbers first. I have some > ideas, but I won't have a chance to work on this until next weekend. Well, ... If one is going to do a redesign of things one should at least think about all the known issues before doing any coding. [I'm sure there's no news there.] Do we at least know how we're going to handle strings, and what compatibleness with existing usage we're going to break? btw, while doing a redesign of the cli is laudable, the more I work with gdb's command structure the more I like its simplicity. I wouldn't mind regularizing the syntax of arguments such that one can know one can always use buildargv (or some such). And providing an sscanf-like routine that *_command fns can call would also be useful. Beyond that I dunno .... ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-11-20 6:13 ` Daniel Jacobowitz 2002-11-20 8:32 ` Andrew Cagney @ 2002-12-08 11:16 ` Doug Evans 2002-12-08 11:31 ` Richard Sharpe 1 sibling, 1 reply; 14+ messages in thread From: Doug Evans @ 2002-12-08 11:16 UTC (permalink / raw) To: ac131313; +Cc: gdb Andrew writes: >> The loop works, but add-symbol-file seems to be called without the >>> >>> convenience variables being expanded. >>> >>> Have it got that right? >>> >>> If so, what would be the first step to get them expanded? >> >> add-symbol-file takes constants, not expressions - so variables are not >> expanded. This should probably change but it's not clear how, given >> the parser... > > A quick/dirty hack would be: > > eval ..... Can someone point me to threads on `eval'? My poor eyes can't find one. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Processing of convenience variables for scripts ... 2002-12-08 11:16 ` Doug Evans @ 2002-12-08 11:31 ` Richard Sharpe 2002-12-08 12:08 ` eval [was Re: Processing of convenience variables for scripts ...] Doug Evans 0 siblings, 1 reply; 14+ messages in thread From: Richard Sharpe @ 2002-12-08 11:31 UTC (permalink / raw) To: Doug Evans; +Cc: ac131313, gdb On Sun, 8 Dec 2002, Doug Evans wrote: > Andrew writes: > >> The loop works, but add-symbol-file seems to be called without the > >>> > >>> convenience variables being expanded. > >>> > >>> Have it got that right? > >>> > >>> If so, what would be the first step to get them expanded? > >> > >> add-symbol-file takes constants, not expressions - so variables are not > >> expanded. This should probably change but it's not clear how, given > >> the parser... > > > > A quick/dirty hack would be: > > > > eval ..... > > Can someone point me to threads on `eval'? > My poor eyes can't find one. I think that the intent was that someone implement eval. I can't find an existing one. Maybe my eyes are bad as well. Regards ----- Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, sharpe[at]ethereal.com, http://www.richardsharpe.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* eval [was Re: Processing of convenience variables for scripts ...] 2002-12-08 11:31 ` Richard Sharpe @ 2002-12-08 12:08 ` Doug Evans 0 siblings, 0 replies; 14+ messages in thread From: Doug Evans @ 2002-12-08 12:08 UTC (permalink / raw) To: Richard Sharpe; +Cc: ac131313, fnasser, gdb Richard Sharpe writes: > On Sun, 8 Dec 2002, Doug Evans wrote: > > > Andrew writes: > > >> The loop works, but add-symbol-file seems to be called without the > > >>> > > >>> convenience variables being expanded. > > >>> > > >>> Have it got that right? > > >>> > > >>> If so, what would be the first step to get them expanded? > > >> > > >> add-symbol-file takes constants, not expressions - so variables are not > > >> expanded. This should probably change but it's not clear how, given > > >> the parser... > > > > > > A quick/dirty hack would be: > > > > > > eval ..... > > > > Can someone point me to threads on `eval'? > > My poor eyes can't find one. > > I think that the intent was that someone implement eval. I can't find an > existing one. Maybe my eyes are bad as well. I recall a message from Fernando (I think) refering to the existing threads on eval, so I was wondering where they were. What about a $()-like command akin to bash? Maybe spelled $`` (backquote also from bash and because $` is a syntax that doesn't collide with anything). It's very useful to be able to run a command and have the result be used in another command. For add-symbol-file, one might do add-symbol-file $`printf %s, $name` blah... $`` is useful regardless of how the cli is rewritten, though perhaps in this example it's more clumsy than just $name. OTOH, there's enormous flexibility. It does require commands that are used with it to properly send their output through something that can be captured in a string, but that's a good thing for them to do anyway. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2002-12-08 20:52 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-11-20 0:48 Processing of convenience variables for scripts Richard Sharpe 2002-11-20 6:13 ` Daniel Jacobowitz 2002-11-20 8:32 ` Andrew Cagney 2002-11-20 8:36 ` Daniel Jacobowitz 2002-11-20 9:28 ` Richard Sharpe 2002-11-20 10:36 ` Daniel Jacobowitz 2002-11-20 21:40 ` Eli Zaretskii 2002-12-05 16:52 ` Fernando Nasser 2002-12-08 11:36 ` Doug Evans 2002-12-08 12:30 ` Daniel Jacobowitz 2002-12-08 12:52 ` Doug Evans 2002-12-08 11:16 ` Doug Evans 2002-12-08 11:31 ` Richard Sharpe 2002-12-08 12:08 ` eval [was Re: Processing of convenience variables for scripts ...] Doug Evans
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox