Commit dd9c6bb0 authored by Administrator's avatar Administrator

Merge branch 'vs2017-support' into 'dev-1.0'

Vs2017 support

See merge request !11
parents b4c87cee 9fa21ea2
......@@ -30,7 +30,7 @@ typedef std::list< SymbolOffset > SymbolOffsetList;
typedef std::list< std::wstring > TypeNameList;
class Module : private boost::noncopyable, public NumBehavior {
class Module : public NumConvertable, private boost::noncopyable {
public:
......
......@@ -70,7 +70,7 @@ TypedVarPtr loadFloatVar( float var );
TypedVarPtr loadDoubleVar( double var );
TypedVarPtr loadWCharVar( wchar_t var );
class TypedVar : public NumBehavior {
class TypedVar : public NumConvertable, private boost::noncopyable {
friend TypedVarPtr loadTypedVar( const SymbolPtr &symbol );
......@@ -88,6 +88,16 @@ class TypedVar : public NumBehavior {
public:
template <typename T>
operator T() {
return static_cast<T>(getValue());
}
template <typename T>
operator T() const {
return static_cast<T>(getValue());
}
virtual std::wstring str() = 0;
virtual VarStorage getStorage() const = 0;
virtual std::wstring getRegisterName() const = 0;
......@@ -112,7 +122,6 @@ public:
virtual TypedVarPtr getMethod( const std::wstring &name, const std::wstring& prototype = L"") = 0;
virtual TypedVarPtr getMethod( const std::wstring &name, TypeInfoPtr prototype) = 0;
virtual TypeInfoPtr getType() const = 0;
virtual NumVariant getValue() const = 0;
virtual void setValue(const NumVariant& value) = 0;
virtual std::wstring getStrValue() const = 0;
virtual void setStrValue(const std::wstring& value) = 0;
......@@ -136,9 +145,20 @@ protected:
///////////////////////////////////////////////////////////////////////////////
class TypedValue : public NumBehavior
class TypedValue
{
public:
operator NumVariant() {
return getValue();
}
operator NumVariant() const {
return getValue();
}
TypedValue();
TypedValue(const TypedVarPtr& var) : m_value(var){}
......@@ -294,13 +314,11 @@ private:
TypedVarPtr m_value;
};
inline
NumBehavior::operator TypedValue() {
return TypedValue( getValue() );
}
TypedValue callRaw(MEMOFFSET_64 addr, CallingConventionType callingConvention, const TypedValueList& arglst);
TypedValue evalExpr(const std::wstring& expr, const std::list< std::pair<std::wstring, TypedValue> >& scope = {});
///////////////////////////////////////////////////////////////////////////////
} // end kdlib namespace
......@@ -34,7 +34,7 @@ MEMOFFSET_64 getSymbolOffset( const std::wstring &name );
std::wstring findSymbol( MEMOFFSET_64 offset);
std::wstring findSymbol( MEMOFFSET_64 offset, MEMDISPLACEMENT &displacement );
class TypeInfo : private boost::noncopyable, public NumBehavior {
class TypeInfo : public NumConvertable, private boost::noncopyable {
friend TypeInfoPtr loadType( const std::wstring &symName );
friend TypeInfoPtr loadType( SymbolPtr &symbol );
......@@ -105,8 +105,6 @@ public:
virtual void getBaseClassVirtualDisplacement( const std::wstring &name, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize ) = 0;
virtual void getBaseClassVirtualDisplacement( size_t index, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize ) = 0;
virtual NumVariant getValue() const = 0;
virtual void getVirtualDisplacement( const std::wstring& fieldName, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize ) = 0;
virtual void getVirtualDisplacement( size_t fieldIndex, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize ) = 0;
......@@ -135,7 +133,7 @@ protected:
static bool isComplexType( const std::wstring &typeName );
static TypeInfoPtr getTypeInfoFromCache(const std::wstring &typeName );
static TypeInfoPtr getBaseTypeInfo( const std::wstring &typeName, size_t ptrSize );
static TypeInfoPtr getBaseTypeInfo( const std::wstring &typeName, size_t ptrSize = 0);
static TypeInfoPtr getBaseTypeInfo( SymbolPtr &symbolScope );
static TypeInfoPtr getComplexTypeInfo( const std::wstring &typeName, SymbolPtr &symbolScope );
......
This diff is collapsed.
......@@ -3,6 +3,7 @@
#include <vector>
#include <string>
#include <list>
#include <memory>
#include <atlcomcli.h>
#include <DbgEng.h>
......@@ -35,7 +36,7 @@ public:
private:
std::auto_ptr<T> m_impl;
std::unique_ptr<T> m_impl;
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -24,7 +24,9 @@ const DiaSymbol::ValueNameEntry DiaSymbol::basicTypeName[] = {
_DEF_BASIC_TYPE(Complex),
_DEF_BASIC_TYPE(Bit),
_DEF_BASIC_TYPE(BSTR),
_DEF_BASIC_TYPE(Hresult)
_DEF_BASIC_TYPE(Hresult),
_DEF_BASIC_TYPE(Char16),
_DEF_BASIC_TYPE(Char32)
};
#undef _DEF_BASIC_TYPE
......
......@@ -23,6 +23,8 @@ DEFINE_GUID(MSDIA11_CLASSGUID, 0x761d3bcd, 0x1304, 0x41d5, 0x94, 0xe8, 0xea, 0xc
DEFINE_GUID(MSDIA12_CLASSGUID, 0x3bfcea48, 0x620f, 0x4b6b, 0x81, 0xf7, 0xb9, 0xaf, 0x75, 0x45, 0x4c, 0x7d);
DEFINE_GUID(MSDIA14_CLASSGUID, 0xe6756135, 0x1e65, 0x4d17, 0x85, 0x76, 0x61, 0x07, 0x61, 0x39, 0x8c, 0x3c);
//////////////////////////////////////////////////////////////////////////////////
......@@ -55,6 +57,10 @@ static SymbolSessionPtr createSession(
if ( S_OK == hres )
break;
hres = dataSource.CoCreateInstance(__uuidof(DiaSourceAlt), NULL, CLSCTX_INPROC_SERVER);
if (S_OK == hres)
break;
hres = dataSource.CoCreateInstance(MSDIA12_CLASSGUID, NULL, CLSCTX_INPROC_SERVER);
if (S_OK == hres)
break;
......@@ -81,6 +87,14 @@ static SymbolSessionPtr createSession(
size_t pos = fileName.find_last_of(L'\\');
fileName.replace(pos, fileName.length() - pos, L"\\msdia140.dll");
hres = NoRegCoCreate(fileName.c_str(), MSDIA14_CLASSGUID, __uuidof(IDiaDataSource), (void**)&dataSource);
if (S_OK == hres)
break;
pos = fileName.find_last_of(L'\\');
fileName.replace(pos, fileName.length() - pos, L"\\msdia120.dll");
hres = NoRegCoCreate(fileName.c_str(), MSDIA12_CLASSGUID, __uuidof(IDiaDataSource), (void**)&dataSource);
......
......@@ -80,37 +80,6 @@
<ClCompile Include="win\liveprocess.cpp">
<Filter>win</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\win32\boost_thread.win32.thread.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\win32\boost_thread.win32.tss_dll.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\win32\boost_thread.win32.tss_pe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_thread.future.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_thread.tss_null.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_system.error_code.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\gregorian\boost_date_time.gregorian.date_generators.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\gregorian\boost_date_time.gregorian.gregorian_types.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\gregorian\boost_date_time.gregorian.greg_month.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\gregorian\boost_date_time.gregorian.greg_weekday.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\posix_time\boost_date_time.posix_time.posix_time_types.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_atomic.lockpool.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.cpp_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.cregex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.c_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.fileiter.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.icu.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.instances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.posix_api.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.regex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.regex_debug.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.regex_raw_buffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.regex_traits_defaults.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.static_mutex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.usinstances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.w32_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.wc_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.wide_posix_api.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_regex.winstances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_chrono.process_cpu_clocks.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_chrono.thread_clock.cpp" />
<ClCompile Include="clang\clang.cpp">
<Filter>clang</Filter>
</ClCompile>
......@@ -135,10 +104,42 @@
<ClCompile Include="net\netobject.cpp">
<Filter>net</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\boost_chrono.chrono.cpp" />
<ClCompile Include="win\tagged.cpp">
<Filter>win</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_atomic-src.lockpool.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_chrono-src.chrono.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_chrono-src.process_cpu_clocks.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_chrono-src.thread_clock.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\gregorian\boost_date_time-src.gregorian.date_generators.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\gregorian\boost_date_time-src.gregorian.gregorian_types.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\gregorian\boost_date_time-src.gregorian.greg_month.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\gregorian\boost_date_time-src.gregorian.greg_weekday.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\posix_time\boost_date_time-src.posix_time.posix_time_types.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.cpp_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.cregex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.c_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.fileiter.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.icu.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.instances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.posix_api.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.regex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.regex_debug.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.regex_raw_buffer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.regex_traits_defaults.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.static_mutex.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.usinstances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.w32_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.wc_regex_traits.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.wide_posix_api.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_regex-src.winstances.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_system-src.error_code.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\win32\boost_thread-src.win32.thread.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\win32\boost_thread-src.win32.thread_primitives.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\win32\boost_thread-src.win32.tss_dll.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\win32\boost_thread-src.win32.tss_pe.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_thread-src.future.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\lib\native\src\boost_thread-src.tss_null.cpp" />
<ClCompile Include="fnmatch.cpp">
<Filter>common</Filter>
</ClCompile>
......@@ -315,6 +316,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="packages.kdlib_vc120.config" />
<None Include="packages.config" />
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.67.0.0" targetFramework="native" />
<package id="boost_atomic-src" version="1.67.0.0" targetFramework="native" />
<package id="boost_chrono-src" version="1.67.0.0" targetFramework="native" />
<package id="boost_date_time-src" version="1.67.0.0" targetFramework="native" />
<package id="boost_regex-src" version="1.67.0.0" targetFramework="native" />
<package id="boost_system-src" version="1.67.0.0" targetFramework="native" />
<package id="boost_thread-src" version="1.67.0.0" targetFramework="native" />
<package id="clang-cmake" version="6.0.0.1" targetFramework="Native" />
<package id="llvm-cmake" version="6.0.0.1" targetFramework="Native" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.57.0.0" targetFramework="Native" />
<package id="boost_atomic" version="1.57.0.0" targetFramework="Native" />
<package id="boost_chrono" version="1.57.0.0" targetFramework="Native" />
<package id="boost_date_time" version="1.57.0.0" targetFramework="Native" />
<package id="boost_regex" version="1.57.0.0" targetFramework="Native" />
<package id="boost_system" version="1.57.0.0" targetFramework="Native" />
<package id="boost_thread" version="1.57.0.0" targetFramework="Native" />
<package id="clang-cmake" version="3.9.0.1" targetFramework="Native" />
<package id="llvm-cmake" version="3.9.0.1" targetFramework="Native" />
</packages>
\ No newline at end of file
......@@ -647,13 +647,13 @@ MEMOFFSET_64 StackFrameImpl::getOffset(unsigned long regRel, MEMOFFSET_REL relOf
switch( regRel )
{
case rriInstructionPointer:
return (MEMOFFSET_64)( m_ip + relOffset );
return (MEMOFFSET_64)( m_cpuContext->getIP() + relOffset );
case rriStackFrame:
return (MEMOFFSET_64)( m_fp + relOffset );
return (MEMOFFSET_64)( m_cpuContext->getFP() + relOffset );
case rriStackPointer:
return (MEMOFFSET_64)( m_sp + relOffset );
return (MEMOFFSET_64)( m_cpuContext->getSP() + relOffset );
}
throw DbgException( "unknown relative offset" );
......
......@@ -975,7 +975,7 @@ TypedVarPtr TypedVarUdt::getVirtualMethodRecursive(
name += methodName;
MEMOFFSET_64 thisValue = m_varData->getAddress();
MEMOFFSET_64 methodAddr = vtbl->getElement( methodOffset / vtblType->getPtrSize() )->asULongLong();
MEMOFFSET_64 methodAddr = vtbl->getElement(methodOffset / vtblType->getPtrSize())->getValue().asULongLong();
return TypedVarPtr( new TypedVarMethodBound(methodType, getMemoryAccessor(methodAddr, 0 ), name, thisValue ) );
}
......
......@@ -260,7 +260,7 @@ TypeInfoPtr loadType( const std::wstring &typeName )
throw TypeException(L"type name is empty");
if ( TypeInfo::isBaseType( typeName ) )
return TypeInfo::getBaseTypeInfo( typeName, ptrSize() );
return TypeInfo::getBaseTypeInfo( typeName );
splitSymName( typeName, moduleName, symName );
......@@ -552,7 +552,7 @@ bool TypeInfo::isComplexType( const std::wstring &typeName )
///////////////////////////////////////////////////////////////////////////////
TypeInfoPtr TypeInfo::getBaseTypeInfo( const std::wstring &typeName, size_t ptrSize )
TypeInfoPtr TypeInfo::getBaseTypeInfo( const std::wstring &typeName, size_t ptrSize )
{
if ( isComplexType( typeName ) )
return getComplexTypeInfo( typeName, SymbolPtr() );
......@@ -645,6 +645,14 @@ TypeInfoPtr TypeInfo::getBaseTypeInfo( SymbolPtr &symbol )
{
symName = L"Double";
}
else if (symName == L"Char16")
{
symName = L"UInt2B";
}
else if (symName == L"Char32")
{
symName = L"UInt4B";
}
return getBaseTypeInfo( symName, getPtrSizeBySymbol(symbol) );
}
......@@ -1868,19 +1876,19 @@ TypeInfoSymbolEnum::TypeInfoSymbolEnum(SymbolSessionPtr& symSession, const std::
m_index = 0;
SymbolPtr symScope = symSession->getSymbolScope();
size_t symCount = symScope->getChildCount();
for ( size_t index = 0; index < symCount; index++)
for (size_t index = 0; index < symCount; index++)
{
SymbolPtr sym = symScope->getChildByIndex(index);
if (!isTypeTag(sym->getSymTag()) )
if (!isTypeTag(sym->getSymTag()))
continue;
std::wstring symName = sym->getName();
if ( mask.empty() || fnmatch(mask, symName ) )
if (mask.empty() || fnmatch(mask, symName))
{
m_typeList.push_back( loadType(sym) );
m_typeList.push_back(loadType(sym));
}
}
}
......
......@@ -663,7 +663,7 @@ protected:
}
virtual size_t getPtrSize() {
return m_ptrSize;
return m_ptrSize != 0 ? m_ptrSize : kdlib::ptrSize();
}
virtual size_t getAlignReq() {
......
......@@ -110,7 +110,7 @@ public:
}
virtual MEMOFFSET_64 getIP() {
NOT_IMPLEMENTED();
return m_context.Rip;
}
virtual void setIP(MEMOFFSET_64 ip) {
......@@ -118,7 +118,7 @@ public:
}
virtual MEMOFFSET_64 getSP() {
NOT_IMPLEMENTED();
return m_context.Rsp;
}
virtual void setSP(MEMOFFSET_64 sp) {
......@@ -126,7 +126,7 @@ public:
}
virtual MEMOFFSET_64 getFP() {
NOT_IMPLEMENTED();
return m_context.Rbp;
}
virtual void setFP(MEMOFFSET_64 fp) {
......@@ -182,7 +182,7 @@ public:
}
virtual MEMOFFSET_64 getIP() {
NOT_IMPLEMENTED();
return m_context.Eip;
}
virtual void setIP(MEMOFFSET_64 ip) {
......@@ -190,7 +190,7 @@ public:
}
virtual MEMOFFSET_64 getSP() {
NOT_IMPLEMENTED();
return m_context.Esp;
}
virtual void setSP(MEMOFFSET_64 sp) {
......@@ -198,7 +198,7 @@ public:
}
virtual MEMOFFSET_64 getFP() {
NOT_IMPLEMENTED();
return m_context.Ebp;
}
virtual void setFP(MEMOFFSET_64 fp) {
......@@ -255,7 +255,7 @@ public:
}
virtual MEMOFFSET_64 getIP() {
NOT_IMPLEMENTED();
return m_context.Eip;
}
virtual void setIP(MEMOFFSET_64 ip) {
......@@ -263,7 +263,7 @@ public:
}
virtual MEMOFFSET_64 getSP() {
NOT_IMPLEMENTED();
return m_context.Esp;
}
virtual void setSP(MEMOFFSET_64 sp) {
......@@ -271,7 +271,7 @@ public:
}
virtual MEMOFFSET_64 getFP() {
NOT_IMPLEMENTED();
return m_context.Ebp;
}
virtual void setFP(MEMOFFSET_64 fp) {
......
#pragma once
#include <stdafx.h>
#include "kdlib/breakpoint.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/cpucontext.h"
......
#pragma once
#include <stdafx.h>
#include "gtest/gtest.h"
#include "kdlib/kdlib.h"
#include "kdlib/typedvar.h"
using namespace kdlib;
#include "procfixture.h"
......@@ -13,7 +13,7 @@ public:
CrtTest() : ProcessFixture( L"typedvartest" ) {}
};
TEST_F(CrtTest, malloc)
TEST_F(CrtTest, DISABLED_malloc)
{
kdlib::TypedVarPtr malloc;
kdlib::TypedVarPtr free;
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/disasm.h"
......
#pragma once
#include <stdafx.h>
#include "basefixture.h"
#include "eventhandlermock.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2007, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
//
// This file implements some commonly used cardinalities. More
// cardinalities can be defined by the user implementing the
// CardinalityInterface interface if necessary.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
#include <limits.h>
#include <ostream> // NOLINT
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"
namespace testing {
// To implement a cardinality Foo, define:
// 1. a class FooCardinality that implements the
// CardinalityInterface interface, and
// 2. a factory function that creates a Cardinality object from a
// const FooCardinality*.
//
// The two-level delegation design follows that of Matcher, providing
// consistency for extension developers. It also eases ownership
// management as Cardinality objects can now be copied like plain values.
// The implementation of a cardinality.
class CardinalityInterface {
public:
virtual ~CardinalityInterface() {}
// Conservative estimate on the lower/upper bound of the number of
// calls allowed.
virtual int ConservativeLowerBound() const { return 0; }
virtual int ConservativeUpperBound() const { return INT_MAX; }
// Returns true iff call_count calls will satisfy this cardinality.
virtual bool IsSatisfiedByCallCount(int call_count) const = 0;
// Returns true iff call_count calls will saturate this cardinality.
virtual bool IsSaturatedByCallCount(int call_count) const = 0;
// Describes self to an ostream.
virtual void DescribeTo(::std::ostream* os) const = 0;
};
// A Cardinality is a copyable and IMMUTABLE (except by assignment)
// object that specifies how many times a mock function is expected to
// be called. The implementation of Cardinality is just a linked_ptr
// to const CardinalityInterface, so copying is fairly cheap.
// Don't inherit from Cardinality!
class GTEST_API_ Cardinality {
public:
// Constructs a null cardinality. Needed for storing Cardinality
// objects in STL containers.
Cardinality() {}
// Constructs a Cardinality from its implementation.
explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
// Conservative estimate on the lower/upper bound of the number of
// calls allowed.
int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); }
int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); }
// Returns true iff call_count calls will satisfy this cardinality.
bool IsSatisfiedByCallCount(int call_count) const {
return impl_->IsSatisfiedByCallCount(call_count);
}
// Returns true iff call_count calls will saturate this cardinality.
bool IsSaturatedByCallCount(int call_count) const {
return impl_->IsSaturatedByCallCount(call_count);
}
// Returns true iff call_count calls will over-saturate this
// cardinality, i.e. exceed the maximum number of allowed calls.
bool IsOverSaturatedByCallCount(int call_count) const {
return impl_->IsSaturatedByCallCount(call_count) &&
!impl_->IsSatisfiedByCallCount(call_count);
}
// Describes self to an ostream
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
// Describes the given actual call count to an ostream.
static void DescribeActualCallCountTo(int actual_call_count,
::std::ostream* os);
private:
internal::linked_ptr<const CardinalityInterface> impl_;
};
// Creates a cardinality that allows at least n calls.
GTEST_API_ Cardinality AtLeast(int n);
// Creates a cardinality that allows at most n calls.
GTEST_API_ Cardinality AtMost(int n);
// Creates a cardinality that allows any number of calls.
GTEST_API_ Cardinality AnyNumber();
// Creates a cardinality that allows between min and max calls.