Skip to content

Commit dfde0c9

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 5d0d7e8 commit dfde0c9

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
@@ -2582,6 +2582,28 @@ install: all
25822582
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
25832583
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
25842584
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
2585+
ifdef MSVC
2586+
$(INSTALL) compat/vcbuild/GEN.DEPS/bin/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
2587+
$(INSTALL) compat/vcbuild/GEN.DEPS/bin/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2588+
# We DO NOT install the individual foo.o.pdb files because they
2589+
# have already been rolled up into the exe's pdb file.
2590+
# We DO NOT have pdb files for the builtin commands (like git-status.exe)
2591+
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
2592+
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2593+
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2594+
$(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2595+
$(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2596+
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2597+
$(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2598+
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2599+
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2600+
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2601+
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2602+
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2603+
$(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2604+
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2605+
$(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2606+
endif
25852607
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
25862608
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
25872609
$(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
@@ -417,12 +417,16 @@ ifeq ($(uname_S),Windows)
417417
# Optionally enable memory leak reporting.
418418
# BASIC_CLFAGS += -DUSE_MSVC_CRTDBG
419419
BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
420+
# Always give "-Zi" to the compiler and "-debug" to linker (even in
421+
# release mode) to force a PDB to be generated (like RelWithDebInfo).
422+
BASIC_CFLAGS += -Zi
423+
BASIC_LDFLAGS += -debug
420424
ifndef DEBUG
421-
BASIC_CFLAGS += -GL -Os -MD
422-
BASIC_LDFLAGS += -LTCG
425+
BASIC_CFLAGS += -GL -Gy -Os -Oy- -MD -DNDEBUG
426+
BASIC_LDFLAGS += -release -LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:CV,FIXUP
423427
AR += -LTCG
424428
else
425-
BASIC_CFLAGS += -Zi -MDd -DDEBUG -D_DEBUG
429+
BASIC_CFLAGS += -MDd -DDEBUG -D_DEBUG
426430
endif
427431
X = .exe
428432

0 commit comments

Comments
 (0)