-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach GDB about more Windows entry points
Windows programs have several conventional entry points depending on various circumstances. Upstream GDB is only aware of "main" and the "start" command behaves poorly or incorrectly otherwise.
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- a/gdb/symtab.c | ||
+++ b/gdb/symtab.c | ||
@@ -6300,6 +6300,23 @@ | ||
if (symbol_found_p) | ||
return; | ||
|
||
+ if (gdbarch_osabi (target_gdbarch ()) == GDB_OSABI_WINDOWS) | ||
+ { | ||
+ static const char *const mains[] = { | ||
+ "wmain", "WinMain", "wWinMain", "WinMainCRTStartup", "mainCRTStartup" | ||
+ }; | ||
+ for (const char *main : mains) | ||
+ { | ||
+ struct bound_minimal_symbol msym; | ||
+ msym = lookup_minimal_symbol (main, NULL, NULL); | ||
+ if (msym.minsym != NULL) | ||
+ { | ||
+ set_main_name (main, language_unknown); | ||
+ return; | ||
+ } | ||
+ } | ||
+ } | ||
+ | ||
set_main_name ("main", language_unknown); | ||
} | ||
|