diff --git a/Dockerfile b/Dockerfile index 1baed4a..87d8c62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -338,7 +338,9 @@ RUN /libiconv-$LIBICONV_VERSION/configure \ && make install WORKDIR /gdb -RUN sed -i 's/quiet = 0/quiet = 1/' /gdb-$GDB_VERSION/gdb/main.c \ +COPY src/gdb-*.patch $PREFIX/src/ +RUN cat $PREFIX/src/gdb-*.patch | patch -d/gdb-$GDB_VERSION -p1 \ + && sed -i 's/quiet = 0/quiet = 1/' /gdb-$GDB_VERSION/gdb/main.c \ && /gdb-$GDB_VERSION/configure \ --host=$ARCH \ --with-libexpat-prefix=/deps \ diff --git a/src/gdb-000-alternate-main.patch b/src/gdb-000-alternate-main.patch new file mode 100644 index 0000000..2abad4a --- /dev/null +++ b/src/gdb-000-alternate-main.patch @@ -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); + } +