2

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

Something like:

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

bright
  • 137
  • 1
  • 3
  • 11

1 Answers1

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...].

FatalError
  • 52,695
  • 14
  • 99
  • 116
  • Thanks! I found another way here `http://stackoverflow.com/questions/6885923/redirecting-storing-output-of-shell-into-gdb-variable` – bright Apr 05 '12 at 08:23