- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there.
I have a Fortran .exe which is run from a C++ .exe using the winapi CreateProcessA command. In order to debug the Fortran code I currently run the executable stand alone.
Q. Is it possible to debug the Fortran from the C++, perhaps stepping into the Fortran code from the CreateProcessA statement for example? If so could somebody please tell me how to implement this or point me to any appropriate material.
Thanks
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
forgot to mention: I am working on windows and using visual studio 2010
Update:
I have discovered I can hook up the Fortran.exe process using windows api calls and have taken the following route:
1) create the Fortran process using:
[cpp]
BOOL WINAPI CreateProcess(
_In_opt_ LPCTSTR lpApplicationName,
_Inout_opt_ LPTSTR lpCommandLine,
_In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
_In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
_In_ BOOL bInheritHandles,
_In_ DWORD dwCreationFlags,
_In_opt_ LPVOID lpEnvironment,
_In_opt_ LPCTSTR lpCurrentDirectory,
_In_ LPSTARTUPINFO lpStartupInfo,
_Out_ LPPROCESS_INFORMATION lpProcessInformation
);
[/cpp]
...process now running...
2) get process ID
[cpp]
id = lpProcessInformation.dwProcessId;
[/cpp]
3) use attach vs2010 debugger to process Id
[cpp]
std::ostringstream stream;
stream << "VsJITDebugger.exe -p ";
stream << id;
std::string debugCMD = stream.str();
system(debugCMD.c_str());
[/cpp]
...debugger attached to the Fortran process.
Ideally I would like to have the debugger ready in anticipation of the new process being created, rather than attaching after it has started.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
As soon as Win32 API function 'CreateProcess' creates a Fortran process ( from a C/C++ code ) you could use a Visual Studio feature 'Attach to Process...':
VS Menu -> 'Debug' -> 'Attach to Process...'
You could also get more technical details related to Fortran on a dedicated forum:
Forum: Intel® Visual Fortran Compiler for Windows*
Web-link: http://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows
Best regards,
Sergey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page