How to access environment variables inside .gdbinit and inside gdb itself?

后端 未结 4 1196
夕颜
夕颜 2021-02-18 18:20

I am looking to set up the path for the source code when debugging with gdb. I chose to do that with a .gdbinit file.

Basically, it contains a command:

d         


        
4条回答
  •  粉色の甜心
    2021-02-18 19:01

    Nevermind, I found how to do it by using Python scripting.

    My .gdbinit file is now:

    python
    import os
    gdb.execute('directory' + os.environ['SOURCES'] + '/package_name/src')
    end
    
    show directories
    

提交回复
热议问题