Re: Running GDB with args and variables
Mahmood Naderan via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
Right. Both solutions work. Thanks. Regards, Mahmood On Monday, August 30, 2021, 6:13:11 PM GMT+2, Luke Drummond <[email protected]> wrote: Hi all On Mon Aug 30, 2021 at 4:56 PM BST, Christian Biesinger via Gdb wrote: > 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 > > 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 To avoid the confusion with the `env` fork/exec without worrying about `set follow-fork-mode child` the following might be better: gdb \ --init-eval-command="set environment LD_PRELOAD=/home/mahmood/foo.so" \ --args /home/mahmood/program/run /home/mahmood/p2/bin/p2 -config t.txt This commands gdb to set the environment in the child before the child is loaded All the Best Luke -- Codeplay Software Ltd. Company registered in England and Wales, number: 04567874 Registered office: Regent House, 316 Beulah Hill, London, SE19 3HF