I am debugging a cygwin gcc compiled process that would be loaded from a native windows program via CreateProcess
. I would like to set a break point before main for example at mainCRTStartup
.
How to I attach to the process that is yet not loaded and set a break Point at mainCRTStartup
?
Note
If it matters, Its not the XY problem. I am analyzing a possible bug in Windows 2012 R2 and need to trace the entire command line passed from the invocation of the CreateProcess till the main entry point of the loaded process. Before I can approach MS, I would need to be certain on where the issue is.
Also I need to use gdb because WinDBG possibly cannot source debug a cygwin gcc compiled binary.
What have I tried
Using gflags, I tried to invoke gdb when ever the image loads, but then unfortunately, was greeted with a message "File Name too Long", and then invoking gdb without any active process
The problem with this approach is, gflags invokes the debugger with the image name followed by the command line parameter, where as gdb expects a PID or an image name without the command line parameter. Reference How to attach a process in gdb