2

Is it possible to store shell output into GDB variable in gdbinit?

Something like:

set solib-search-path=$(shell which gdb)+"..\project\lib"

1
  • The answer to your question is "yes". Commented Apr 5, 2012 at 2:21

1 Answer 1

0

If you have a new-ish version of GDB (I believe that means 7.x) with python support built, you could add a section like:

python
import subprocess
gdb.execute('set solib-search-path ' +
    subprocess.check_output('which gdb',shell=True).rstrip() +
    '../project/lib')
end

I can't claim it's not possible without using python, but it's the only way I know of to do it. [I also assumed you meant ../project/lib and not ..\project\lib, but that's an easy change...].

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I found another way here http://stackoverflow.com/questions/6885923/redirecting-storing-output-of-shell-into-gdb-variable

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.