about summary refs log tree commit diff
path: root/scripts/find-runtime-roots.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·31+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·31+0100
commit194e3374b89b8b2dec6296923877304bdb5c6ae2 (patch)
tree4d256ef2b61133dd309bafcd82710fd2f50c83f4 /scripts/find-runtime-roots.pl.in
parent769f66216504cd882ac7b6bdfa0dd1ff26f3efe5 (diff)
Scan /proc/<pid>/cmdline for GC roots
Diffstat (limited to 'scripts/find-runtime-roots.pl.in')
-rwxr-xr-xscripts/find-runtime-roots.pl.in12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/find-runtime-roots.pl.in b/scripts/find-runtime-roots.pl.in
index e1a2dde556b6..2e04a635e8fc 100755
--- a/scripts/find-runtime-roots.pl.in
+++ b/scripts/find-runtime-roots.pl.in
@@ -15,8 +15,6 @@ sub readProc {
 
         my $process = "/proc/$name";
 
-        #print STDERR "=== $process\n";
-
         my $target;
         print "$target\n" if $target = readlink "$process/exe";
         print "$target\n" if $target = readlink "$process/cwd";
@@ -38,11 +36,17 @@ sub readProc {
         }
 
         # Get all store paths that appear in the environment of this process.
+        my $re = "\Q$Nix::Config::storeDir\E\/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*";
         eval {
             my $env = Nix::Utils::readFile "$process/environ";
-            my @matches = $env =~ /\Q$Nix::Config::storeDir\E\/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*/g;
+            my @matches = $env =~ /$re/g;
             print "$_\n" foreach @matches;
-        }
+        };
+        eval {
+            my $cmdline = Nix::Utils::readFile "$process/cmdline";
+            my @matches = $cmdline =~ /$re/g;
+            print "$_\n" foreach @matches;
+        };
     }
 
     closedir DIR;