Skip to content

Commit 0c88786

Browse files
jeffhostetlerdscho
authored andcommitted
msvc: release mode PDBs and library DLLs
Install required third-party DLLs next to EXEs. Build and install release mode PDBs for git executables allowing detailed stack traces in the event of crash. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent b6fd0a7 commit 0c88786

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,6 +2563,28 @@ install: all
25632563
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
25642564
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
25652565
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
2566+
ifdef MSVC
2567+
$(INSTALL) compat/vcbuild/GEN.DEPS/bin/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2568+
$(INSTALL) compat/vcbuild/GEN.DEPS/bin/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2569+
# We DO NOT install the individual foo.o.pdb files because they
2570+
# have already been rolled up into the exe's pdb file.
2571+
# We DO NOT have pdb files for the builtin commands (like git-status.exe)
2572+
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
2573+
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2574+
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2575+
$(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2576+
$(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2577+
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2578+
$(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2579+
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2580+
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2581+
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2582+
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2583+
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2584+
$(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2585+
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2586+
$(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2587+
endif
25662588
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
25672589
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
25682590
$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'

compat/vcbuild/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ openssl: insdir
106106
ZLIB_VER=1.2.8.8
107107
ZLIB_ROOT=$(PKGDIR)/zlib.v140.windesktop.msvcstl.dyn.rt-dyn.$(ZLIB_VER)
108108
ZLIB_INC=$(ZLIB_ROOT)/build/native/include
109-
ZLIB_LIB=$(ZLIB_ROOT)/lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/x64/Release
109+
ZLIB_LIB=$(ZLIB_ROOT)/lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/x64/RelWithDebInfo
110110

111111
zlib: insdir
112112
[ -d $(INST_INC)/zlib ] || mkdir $(INST_INC)/zlib
113113
cp -r $(ZLIB_INC)/* $(INST_INC)/zlib
114114
cp -r $(ZLIB_LIB)/*.lib $(INST_LIB)/
115115
cp -r $(ZLIB_LIB)/*.dll $(INST_BIN)/
116+
cp -r $(ZLIB_LIB)/*.pdb $(INST_BIN)/
116117

117118
##################################################################
118119
clean:

compat/vcbuild/scripts/clink.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
my $file_out = shift @ARGV;
2323
if ("$file_out" =~ /exe$/) {
2424
$is_linking = 1;
25+
# Create foo.exe and foo.pdb
2526
push(@args, "-OUT:$file_out");
2627
} else {
28+
# Create foo.o and foo.o.pdb
2729
push(@args, "-Fo$file_out");
30+
push(@args, "-Fd$file_out.pdb");
2831
}
2932
} elsif ("$arg" eq "-lz") {
3033
push(@args, "zlib.lib");
@@ -49,12 +52,10 @@
4952
}
5053
if ($is_linking) {
5154
push(@args, @lflags);
52-
# force PDB to be created.
53-
push(@args, "-debug");
5455
unshift(@args, "link.exe");
5556
} else {
5657
unshift(@args, "cl.exe");
5758
push(@args, @cflags);
5859
}
59-
#printf("**** @args\n");
60+
printf("**** @args\n\n\n");
6061
exit (system(@args) != 0);

config.mak.uname

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,16 @@ ifeq ($(uname_S),Windows)
418418
# Optionally enable memory leak reporting.
419419
# BASIC_CLFAGS += -DUSE_MSVC_CRTDBG
420420
BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
421+
# Always give "-Zi" to the compiler and "-debug" to linker (even in
422+
# release mode) to force a PDB to be generated (like RelWithDebInfo).
423+
BASIC_CFLAGS += -Zi
424+
BASIC_LDFLAGS += -debug
421425
ifndef DEBUG
422-
BASIC_CFLAGS += -GL -Os -MD
423-
BASIC_LDFLAGS += -LTCG
426+
BASIC_CFLAGS += -GL -Gy -Os -Oy- -MD -DNDEBUG
427+
BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
424428
AR += -LTCG
425429
else
426-
BASIC_CFLAGS += -Zi -MDd -DDEBUG -D_DEBUG
430+
BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
427431
endif
428432
X = .exe
429433

0 commit comments

Comments
 (0)