Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active February 22, 2022 15:38
Show Gist options
  • Save coderofsalvation/e1376e4d2b29607431df to your computer and use it in GitHub Desktop.
Save coderofsalvation/e1376e4d2b29607431df to your computer and use it in GitHub Desktop.

Revisions

  1. coderofsalvation revised this gist Jun 24, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions export_process
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    # updates an environment variable of a running process
    # example: export_pid <variable=value> <pid>
    # updates an environment variable of a running process (needs sudo)
    # example: sudo export_pid <variable=value> <pid>

    export_process(){
    script=/tmp/.gdb.$2
    echo -e "attach $pid\ncall putenv (\"$1\")\ndetach\n" > $script
    gdb -x $script
    echo -e "attach $2\ncall putenv (\"$1\")\ndetach\n" > $script
    gdb -q -batch -x $script &>/dev/null
    rm $script
    }
  2. coderofsalvation created this gist Jun 24, 2015.
    9 changes: 9 additions & 0 deletions export_process
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # updates an environment variable of a running process
    # example: export_pid <variable=value> <pid>

    export_process(){
    script=/tmp/.gdb.$2
    echo -e "attach $pid\ncall putenv (\"$1\")\ndetach\n" > $script
    gdb -x $script
    rm $script
    }