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

Improve DDR support to allow use of VS 2017 #2798

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -964,7 +963,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -1217,15 +1215,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1363,7 +1352,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1516,7 +1505,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -7215,16 +7203,15 @@ $as_echo X"$VS_CL_PATH" |
q
}
s/.*/./; q')
diasdk_dir="$vc_bin_dir/../../DIA SDK"
if test -f "$diasdk_dir/include/dia2.h"
DIASDK_HOME="$(cygpath -a -w "$diasdk_dir")"; then :
diasdk_dir="$vc_bin_dir/../../../DIA SDK"
if test -f "$diasdk_dir/include/dia2.h"; then :
DIASDK_HOME="$(cygpath -a -w "$diasdk_dir")"
fi
diasdk_dir1="$vc_bin_dir/../../DIA SDK"
diasdk_dir2="$vc_bin_dir/../../../DIA SDK"
diasdk_dir3="$vc_bin_dir/../../../../../../../DIA SDK"
if test -f "$diasdk_dir1/include/dia2.h"; then :
DIASDK_HOME="$(cygpath -a -w "$diasdk_dir1")"
elif test -f "$diasdk_dir2/include/dia2.h"; then :
DIASDK_HOME="$(cygpath -a -w "$diasdk_dir2")"
elif test -f "$diasdk_dir3/include/dia2.h"; then :
DIASDK_HOME="$(cygpath -a -w "$diasdk_dir3")"
fi
Expand Down
15 changes: 6 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,12 @@ AS_IF([test "$enable_DDR" = yes -a "$cross_compiling" != "yes"],
[
# this should yield .../VC/bin/cl.exe or .../VC/bin/amd64/cl.exe
vc_bin_dir=$(AS_DIRNAME(["$VS_CL_PATH"]))
diasdk_dir="$vc_bin_dir/../../DIA SDK"
AS_IF([test -f "$diasdk_dir/include/dia2.h"]
[DIASDK_HOME="$(cygpath -a -w "$diasdk_dir")"],
[
diasdk_dir="$vc_bin_dir/../../../DIA SDK"
AS_IF([test -f "$diasdk_dir/include/dia2.h"],
[DIASDK_HOME="$(cygpath -a -w "$diasdk_dir")"]
)
]
diasdk_dir1="$vc_bin_dir/../../DIA SDK"
diasdk_dir2="$vc_bin_dir/../../../DIA SDK"
diasdk_dir3="$vc_bin_dir/../../../../../../../DIA SDK"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For diasdk_dir3, please provide example absolute paths that are covered by this addition.

Copy link
Author

@ChengJin01 ChengJin01 Aug 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diasdk_dir3 is used to cover the case of VS2017 (works for both Professional and Community version). The reason is that the path to cl.exe has changed on VS2017.

Administrator@JCHTORWIN101 /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional
$ ls
 Common7      'DIA SDK'         JS         SDK           VB    VSSDK
 CoreCon       ImportProjects   Licenses  'Team Tools'   VC    Web
 DesignTools   JavaScript       MSBuild    TS            VC#   Xml

Administrator@JCHTORWIN101 /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional
$ find . -name cl.exe
./VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe
./VC/Tools/MSVC/14.14.26428/bin/Hostx64/x86/cl.exe
./VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
./VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe

e.g.
In VS2017 Professional, the path to DIA SDK: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\DIA SDK while vc_bin_dir is C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x64\cl.exe. So, we need to step backwards from the path to cl.exe by 7 levels to reach the DIA SDK directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation.

AS_IF([test -f "$diasdk_dir1/include/dia2.h"], [DIASDK_HOME="$(cygpath -a -w "$diasdk_dir1")"],
[test -f "$diasdk_dir2/include/dia2.h"], [DIASDK_HOME="$(cygpath -a -w "$diasdk_dir2")"],
[test -f "$diasdk_dir3/include/dia2.h"], [DIASDK_HOME="$(cygpath -a -w "$diasdk_dir3")"]
)
]
)
Expand Down
3 changes: 2 additions & 1 deletion ddr/lib/ddr-scanner/pdb/PdbScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ PdbScanner::loadDataFromPdb(const wchar_t *filename, IDiaDataSource **dataSource
HRESULT hr = CoCreateInstance(__uuidof(DiaSource), NULL, CLSCTX_INPROC_SERVER, __uuidof(IDiaDataSource), (void **)dataSource);
if (FAILED(hr)) {
ERRMSG("CoCreateInstance failed with HRESULT = %08lX", hr);
static const char * const libraries[] = { "MSDIA120", "MSDIA100", "MSDIA80", "MSDIA70", "MSDIA60" };
static const char * const libraries[] = { "MSDIA140", "MSDIA120", "MSDIA100", "MSDIA80", "MSDIA70", "MSDIA60" };
rc = DDR_RC_ERROR;
for (size_t i = 0; i < sizeof(libraries) / sizeof(*libraries); ++i) {
HMODULE hmodule = LoadLibrary(libraries[i]);
Expand Down Expand Up @@ -603,6 +603,7 @@ PdbScanner::setMemberOffset(IDiaSymbol *symbol, Field *newField)
break;
}
case LocIsStatic:
case LocIsConstant:
{
/* Get offset of static class members. */
newField->_isStatic = true;
Expand Down