From: Leslie on
Niklas Holsti wrote:

> Leslie wrote:
>> Niklas Holsti wrote:
>>
>>> gdb --args testtoken ' (name testtoken endchar \) <
>>>> testtoken.adb | (trace) count lines|cons '
>>
>> I get exactly the same result as before:
>> ==================================
>> gdb --args testtoken ' (name testtoken endchar \) <
>> testtoken.adb | (trace) count lines|cons '
> ...
>> This GDB was configured as "i586-suse-linux"...
>> testtoken: No such file or directory.
>
> Well, perhaps GDB is right and there is no such file?
>
> Looking more carefully at your original question, at the
> attached terminal session, it seems that your program is really
> named "testcmdline", not "testtoken":
>
Ack! You're right; I changed the name of the program between
times. But it does the same thing with the correct program
name:
================================
gdb --args testcmdline ' (name testtoken endchar \) <
testtoken.adb | (trace) count lines|cons '
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute
it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
(gdb)
===============================

Leslie

From: Leslie on
John B. Matthews wrote:

> In article <hhvlc7$nc8$1(a)news.albasani.net>,
> Leslie <jlturriff(a)centurytel.net> wrote:
>
>> Niklas Holsti wrote:
>>
>> > gdb --args testtoken ' (name testtoken endchar \) <
>> > > testtoken.adb | (trace) count lines|cons '
>>
>> I get exactly the same result as before:
>
> This older version of gdb lacks the --args feature, but `set
> args` and `show args` seem to work. Some of the tokens in your
> arg string appear to be shell operators and commands. You may
> have to evaluate the string in a shell and feed the result to
> args.
>
The single quotes should deactivate the "specialness" of those
operators. In any case, the entire string is being rejected,
not just parts of it, and no substitutions are made by shell.
However, I must say 'thank you very much,' because 'set args'
does the trick.

Thank you very much.

Leslie

From: Niklas Holsti on
Leslie wrote:
> Niklas Holsti wrote:
>
>> Leslie wrote:
>>> Niklas Holsti wrote:
>>>
>>>> gdb --args testtoken ' (name testtoken endchar \) <
>>>>> testtoken.adb | (trace) count lines|cons '
>>> I get exactly the same result as before:
>>> ==================================
>>> gdb --args testtoken ' (name testtoken endchar \) <
>>> testtoken.adb | (trace) count lines|cons '
>> ...
>>> This GDB was configured as "i586-suse-linux"...
>>> testtoken: No such file or directory.
>> Well, perhaps GDB is right and there is no such file?
>>
>> Looking more carefully at your original question, at the
>> attached terminal session, it seems that your program is really
>> named "testcmdline", not "testtoken":
>>
> Ack! You're right; I changed the name of the program between
> times. But it does the same thing with the correct program
> name:
> ================================
> gdb --args testcmdline ' (name testtoken endchar \) <
> testtoken.adb | (trace) count lines|cons '
> GNU gdb 6.8
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute
> it.
> There is NO WARRANTY, to the extent permitted by law. Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "i586-suse-linux"...
> (gdb)

You must also tell GDB to "run" the program at this point. So far, it
has only read the program file (testcmdline) but has not started to
execute the program. So type "run" to the "(gdb)" prompt.

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
From: John B. Matthews on
In article <hi03m6$fsl$1(a)news.albasani.net>,
Leslie <jlturriff(a)centurytel.net> wrote:

> John B. Matthews wrote:
>
> > In article <hhvlc7$nc8$1(a)news.albasani.net>,
> > Leslie <jlturriff(a)centurytel.net> wrote:
> >
> >> Niklas Holsti wrote:
> >>
> >> > gdb --args testtoken ' (name testtoken endchar \) <
> >> > > testtoken.adb | (trace) count lines|cons '
> >>
> >> I get exactly the same result as before:
> >
> > This older version of gdb lacks the --args feature,

Looking again, my gdb has an --args option; it just doesn't work. :-)

> > but `set args` and `show args` seem to work. Some of the tokens in
> > your arg string appear to be shell operators and commands. You may
> > have to evaluate the string in a shell and feed the result to args.
>
> The single quotes should deactivate the "specialness" of those
> operators. In any case, the entire string is being rejected,
> not just parts of it, and no substitutions are made by shell.

You're right about the quotes, but I was mistaken about shell expansion.
It seems gdb uses the environments $SHELL (or /bin/sh) to expand args:

<http://sourceware.org/gdb/current/onlinedocs/gdb/Arguments.html>

(gdb) set args $((7 * 6))
(gdb) r
Starting program: argtest $((7 * 6))
42

> However, I must say 'thank you very much,' because 'set args'
> does the trick.
>
> Thank you very much.

Excellent!

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>