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

F10 does not step into the entry point of an executable with mainCRTStartup() or WinMainCRTStartup() #61

Closed
zobermiller opened this issue Jan 18, 2024 · 2 comments

Comments

@zobermiller
Copy link

If I load an executable target into the debugger that has been built without the CRT main() or WinMain() entry points and instead was built with mainCRTStartup() or WinMainCRTStartup(), hitting F10 does not place me at the beginning of my entry point but instead somewhere inside ntdll.dll.

Here's a sample application:

#include <stdio.h>

int mainCRTStartup()
{
    int x = 5;
    int y = 10;

    printf("%d + %d = %d\n", x, y, x + y);
    return 0;
}

and build it with

cl /nologo /O2 /Zi /W3 /WX /GS- main.c /link /fixed /incremental:no /opt:icf /opt:ref /subsystem:console ucrt.lib

If I replace the mainCRTStartup() with main() and run the same command (excluding the ucrt.lib at the end), F10 will step directly into the beginning of main().

@ryanfleury
Copy link
Collaborator

WinMainCRTStartup should work, but the debugger was not previously looking for mainCRTStartup. Can you try pulling 25c31b0, building, and running again?

@zobermiller
Copy link
Author

Yes, that worked perfectly. Thank you, Ryan! And I'm sorry about the wrong information regarding WinMainCRTStartup(). I must've been testing something else and misconstrued it as that instead.

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

2 participants