Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting target program crash #16

Open
martty opened this issue Jan 8, 2019 · 3 comments
Open

Troubleshooting target program crash #16

martty opened this issue Jan 8, 2019 · 3 comments

Comments

@martty
Copy link

martty commented Jan 8, 2019

Hey, thanks for this great library! I am having trouble making it work though.
Here is what I tried:

  • get the blink repo
  • build blink x64 Debug (Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27012.6 for x64)
  • create target directory & cd there
  • create test.cpp with:
#include <iostream>
void fn();
int main() {
	while (true) {
		fn();
	}
}

using std::cout; using std::endl;
void fn() {
	cout << "Hello World" << endl;
}
  • compile test.cpp in a VS console with cl.exe /Z7 /Od /MDd /nologo /EHsc /std:c++latest test.cpp

  • cd back to blink root

  • launch blink with test.exe (bin\x64\Debug\blink.exe target\test.exe) in VS console
    output:
    Launching in target application ...
    Entry point was written to address 000000013F1A0000
    Reading PE import directory ...
    Reading PE debug info directory ...
    Found program debug database: C:\dev\blink\target\test.pdb
    Found source file: c:\dev\blink\target\test.cpp
    Starting compiler process ...
    Started process with PID 31796
    Starting file system watcher for 'c:\dev\blink\target' ...

  • change output string in test.cpp to something else & save
    output:
    Detected modification to: c:\dev\blink\target\test.cpp
    Finished compiling "c:\dev\blink\target\test.obj" with code 0.
    Successfully linked object file into executable image.
    Detected modification to: c:\dev\blink\target\test.cpp
    The target application has exited with code 3221225501.

  • the test.exe program crashes

  • the additional change in blink was that I disabled commandline detection from the .obj file, as that didn't work, so the commandline used to build is the built-in (as described in Duplicate file modification notifications #13)

crosire added a commit that referenced this issue Jan 8, 2019
crosire added a commit that referenced this issue Jan 8, 2019
@crosire
Copy link
Owner

crosire commented Jan 8, 2019

Use /ZI instead of /Z7 for command-line detection. I'll look into the crash, seems to be some CRT state getting corrupted.

@Trass3r
Copy link

Trass3r commented Feb 4, 2019

Is /ZI required or could the implied /FC be enough?

@crosire
Copy link
Owner

crosire commented Feb 4, 2019

/FC has no impact on the debug data stored in the object files (it only affects display in the command-line output), and that's what blink needs to determine the compiler command-line. So for that to work /ZI is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants