Esempio n. 1
0
 public void Analyze()
 {
     try {
         using (ProcessStreams stream = processHandler.StartProcessAndReadWrite("gdb", "")) {
             Console.WriteLine("Starting gdb");
             Task <string> outReader = stream.Output.ReadToEndAsync();
             Task <string> errReader = stream.Error.ReadToEndAsync();
             SendCommandsToGdb(stream.Input);
             if (!outReader.Wait(TimeSpan.FromMinutes(2)))
             {
                 // 2 minutes is very long for gdb (usually finishes in a few seconds even for dumps with >>100 threads)
                 Console.WriteLine("GDB parsing timed out! Skipping GDB analysis.");
                 return;
             }
             string output = outReader.Result;
             errReader.Wait(TimeSpan.FromSeconds(5));
             string error = errReader.Result;
             Console.WriteLine("Parsing gdb output");
             AnalyzeGdbOutput(output, error);
             Console.WriteLine("Finished gdb parsing");
         }
     } catch (ProcessStartFailedException e) {
         Console.WriteLine($"Failed to start GDB! Skipping GDB analysis: {e.ToString()}");
         return;
     }
 }
Esempio n. 2
0
 public void Analyze()
 {
     try {
         using (ProcessStreams stream = processHandler.StartProcessAndReadWrite("gdb", "")) {
             Console.WriteLine("Starting gdb");
             WorkWithGdb(stream.Input);
             Console.WriteLine("Parsing gdb output");
             AnalyzeGdbOutput(stream.Output, stream.Error);
             Console.WriteLine("Finished gdb parsing");
         }
     } catch (ProcessStartFailedException e) {
         Console.WriteLine("Failed to start GDB: " + e.GetType().Name + " (" + e.Message + "). Skipping GDB analysis.");
         return;
     }
 }
 public void Analyze()
 {
     try {
         using (ProcessStreams stream = processHandler.StartProcessAndReadWrite("gdb", "")) {
             Task <string> outReader = stream.Output.ReadToEndAsync();
             Task <string> errReader = stream.Error.ReadToEndAsync();
             SendCommandsToGdb(stream.Input);
             if (!outReader.Wait(TimeSpan.FromMinutes(1)))
             {
                 Console.WriteLine("Retrieving shared library info from GDB timed out!");
                 return;
             }
             string output = outReader.Result;
             string error  = errReader.Result;
             AnalyzeGdbOutputAsync(output, error).Wait();
         }
     } catch (ProcessStartFailedException e) {
         Console.WriteLine($"Failed to start GDB: {e.ToString()}");
         return;
     }
 }