Re: Running GDB with args and variables

Christian Biesinger via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAPTJ0XH2Q1Fc-DQuSdpa-PBWZvkzy6BgZvzmxbXtpt9X4EdBgA@mail.gmail.com>
On Fri, Aug 27, 2021 at 2:29 PM Mahmood Naderan via Gdb
<[email protected]> wrote:
> I use the following command to run a program
>
> $ LD_PRELOAD=/home/mahmood/foo.so /home/mahmood/program/run /home/mahmood/p2/bin/p2 -config t.txt
>
> Now I want to use 'gdb --args' but the following command doesn't work.
>
>
> $ gdb --args LD_PRELOAD=/home/mahmood/foo.so /home/mahmood/program/run /home/mahmood/p2/bin/p2 -config t.txt
> ...
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> LD_PRELOAD=/home/mahmood/foo.so: No such file or directory.
> (gdb)
>
>
>
>
> The "No such file" error is weird because the file exists when I run 'ls' command.
>
> Any idea about that?

I would think the error comes from the fact that gdb is looking for a
file called "LD_PRELOAD=..." and there is no such file.

Maybe try: gdb --args env LD_PRELOAD=... foo

Christian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.