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

后端 未结 4 1210
夕颜
夕颜 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 18:55

    If you don't want to involve python, then this could work?

    "show environment [varname] Print the value of environment variable varname to be given to your program when it starts. If you do not supply varname, print the names and values of all environment variables to be given to your program. You can abbreviate environment as env."

    ftp://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_19.html

    Maybe they could be used for conditions as well:

    https://www.adacore.com/gems/gem-119-gdb-scripting-part-1

提交回复
热议问题