-
June 29th, 2013, 10:48 PM
#1
Debugging a C# program that launches a Cygwin application
Dear all,
I have a program whose output depends on launching tleap, a non-Windows program that I have compiled for/with Cygwin. The relevant code is as follows:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
using System.Threading;
namespace cyg_test
{
class Program
{
static void Main(string[] args)
{
string teLeap = "E:\\Cygwin\\home\\Danja\\Science\\amber11_surface\\bin\\teLeap.exe";
List<string> argus = new List<string>();
ProcessStartInfo run = new ProcessStartInfo();
run.FileName = teLeap;
argus.Add("-f");
argus.Add("/home/blah.sh");
Process MyProc = new Process();
run.Arguments = string.Join(" ", argus.ToArray());
using (Process process = Process.Start(run))
{} // will put code in brackets
Console.ReadLine();
}
When I execute this code by running my compiled program outside of the debugger, it works just fine. I get a "leap.log" file indicating that the program executed my blah.sh script. However, when I run the same program via the debugger, I get a popup window with the title "teLeap.exe - System Error" and contents "The program can't start because cygwin1.dll is missing from your computer."
I googled the problem and found the solution of setting the "PATH" environment variable to the Cygwin bin directory. After I did this I was able to run the program as described above, but it didn't fix the problem of running it through the debugger. I would really like to be able to do this because I have a lot of code downstream of this function that I'd like to debug.
Thanks a lot for any help,
Dan
Edit: I'm using Visual Studio 2012, .NET4.5
Last edited by Danja; June 30th, 2013 at 12:23 AM.
-
June 30th, 2013, 09:16 AM
#2
Re: Debugging a C# program that launches a Cygwin application
If the application you try to debug is built with something else than MSVC you can't debug it in MSVC (unless that other thing really is MSVC compatible). Or more correct, you might be able to debug without any symbols if it's a windows application but in this case it's not. Since it's a cygwin application you have to use gdb.
-
June 30th, 2013, 10:33 AM
#3
Re: Debugging a C# program that launches a Cygwin application
truyen sex dÃ*nh cho người đã trưởng thÃ*nh
chú ý: chuyên mục truyện người lớn chỉ dÃ*nh cho 18+ mới được vÃ*o
-
June 30th, 2013, 12:11 PM
#4
Re: Debugging a C# program that launches a Cygwin application
Originally Posted by S_M_A
If the application you try to debug is built with something else than MSVC you can't debug it in MSVC (unless that other thing really is MSVC compatible). Or more correct, you might be able to debug without any symbols if it's a windows application but in this case it's not. Since it's a cygwin application you have to use gdb.
I don't need to debug it though; I already know that it works. All I want is for it to run as normal when I call it from my code. Is this not possible as well?
-
July 1st, 2013, 03:57 AM
#5
Re: Debugging a C# program that launches a Cygwin application
If teLeap.exe successfully starts from a windows shell (cmd.exe) it should be possible to run it from the debugger as well. Have you restarted MSVC after updating the environment?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|