Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Aleksey R.
kdlibcpp
Commits
0b69ac43
Commit
0b69ac43
authored
Mar 07, 2018
by
Aleksey R.
Browse files
Merge branch 'dev-1.0' into 'dev-1.0'
update See merge request
!1
parents
f42b8323
2f46b8a5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
275 additions
and
214 deletions
+275
-214
kdlib/include/kdlib/dbgtypedef.h
kdlib/include/kdlib/dbgtypedef.h
+212
-206
kdlib/include/kdlib/typeinfo.h
kdlib/include/kdlib/typeinfo.h
+1
-0
kdlib/source/net/nettype.h
kdlib/source/net/nettype.h
+4
-0
kdlib/source/typeinfoimp.h
kdlib/source/typeinfoimp.h
+47
-8
kdlib/tests/kdlibtest/typeinfotest.h
kdlib/tests/kdlibtest/typeinfotest.h
+11
-0
No files found.
kdlib/include/kdlib/dbgtypedef.h
View file @
0b69ac43
#pragma once
#include <string>
namespace
kdlib
{
///////////////////////////////////////////////////////////////////////////////
typedef
unsigned
long
PROCESS_ID
;
typedef
unsigned
long
PROCESS_DEBUG_ID
;
typedef
unsigned
long
THREAD_ID
;
typedef
unsigned
long
THREAD_DEBUG_ID
;
typedef
unsigned
long
SYSTEM_DEBUG_ID
;
typedef
unsigned
long
BREAKPOINT_ID
;
typedef
unsigned
long
long
MEMOFFSET_64
;
typedef
unsigned
long
MEMOFFSET_32
;
typedef
long
MEMOFFSET_REL
;
typedef
long
MEMDISPLACEMENT
;
typedef
unsigned
long
BITOFFSET
;
typedef
unsigned
long
ACCESS_TYPE
;
typedef
unsigned
long
long
EXTENSION_ID
;
typedef
unsigned
long
RELREG_ID
;
typedef
unsigned
long
long
SYMBOL_ID
;
enum
DebugCallbackResult
{
DebugCallbackProceed
=
0
,
DebugCallbackNoChange
=
1
,
DebugCallbackBreak
=
2
,
DebugCallbackMax
=
3
};
enum
ExecutionStatus
{
DebugStatusNoChange
,
DebugStatusGo
,
DebugStatusBreak
,
DebugStatusNoDebuggee
};
enum
BreakpointType
{
SoftwareBreakpoint
,
DataAccessBreakpoint
};
enum
CPUType
{
CPU_I386
=
0
,
CPU_AMD64
=
1
,
CPU_MAX
=
2
};
enum
CPURegType
{
RegInt8
,
RegInt16
,
RegInt32
,
RegInt64
,
RegFloat32
,
RegFloat64
,
RegFloat80
,
RegFloat128
,
RegVector64
,
RegVector128
};
enum
EventType
{
EventTypeNoEvent
,
EventTypeBreakpoint
,
EventTypeException
,
EventTypeCreateThread
,
EventTypeExitThread
,
EventTypeCreateProcess
,
EventTypeExitProcess
,
EventTypeLoadModule
,
EventTypeUnloadModule
,
EventTypeSystemError
,
EventTypeSessionStatus
,
EventTypeChangeDebuggeeState
,
EventTypeChangeEngineState
,
EventTypeChangeSymbolState
};
struct
SystemInfo
{
unsigned
long
majorVersion
;
unsigned
long
minorVersion
;
unsigned
long
servicePackNumber
;
unsigned
long
buildNumber
;
std
::
wstring
buildDescription
;
};
struct
SystemCrashInfo
{
unsigned
long
long
code
;
unsigned
long
paramterCount
;
unsigned
long
long
parameters
[
0x10
];
};
struct
ExceptionInfo
{
bool
firstChance
;
unsigned
long
exceptionCode
;
unsigned
long
exceptionFlags
;
MEMOFFSET_64
exceptionRecord
;
MEMOFFSET_64
exceptionAddress
;
PROCESS_DEBUG_ID
process
;
THREAD_DEBUG_ID
thread
;
unsigned
long
parameterCount
;
unsigned
long
long
parameters
[
0x10
];
};
struct
FixedFileInfo
{
unsigned
long
Signature
;
unsigned
long
StrucVersion
;
unsigned
long
FileVersionMS
;
unsigned
long
FileVersionLS
;
unsigned
long
ProductVersionMS
;
unsigned
long
ProductVersionLS
;
unsigned
long
FileFlagsMask
;
unsigned
long
FileFlags
;
unsigned
long
FileOS
;
unsigned
long
FileType
;
unsigned
long
FileSubtype
;
unsigned
long
FileDateMS
;
unsigned
long
FileDateLS
;
};
enum
FileFlag
{
FileFlagDebug
=
0x00000001
,
FileFlagPreRelease
=
0x00000002
,
FileFlagPatched
=
0x00000004
,
FileFlagPrivateBuild
=
0x00000008
,
FileFlagInfoInferred
=
0x00000010
,
FileFlagSpecialBuild
=
0x00000020
,
};
enum
MemoryProtect
{
PageNoAccess
=
0x00000001
,
PageReadOnly
=
0x00000002
,
PageReadWrite
=
0x00000004
,
PageWriteCopy
=
0x00000008
,
PageExecute
=
0x00000010
,
PageExecuteRead
=
0x00000020
,
PageExecuteReadWrite
=
0x00000040
,
PageExecuteWriteCopy
=
0x00000080
};
enum
ProcessExitReason
{
ProcessExit
,
ProcessTerminate
,
ProcessDetach
};
enum
ProcessDebugOptions
{
ProcessBreakOnStart
=
0x00000001
,
ProcessBreakOnStop
=
0x00000002
,
ProcessDebugChildren
=
0x00000004
,
ProcessNoDebugHeap
=
0x00000008
,
ProcessDebugDefault
=
ProcessBreakOnStart
};
typedef
unsigned
long
ProcessDebugFlags
;
struct
FrameDesc
{
MEMOFFSET_64
instructionOffset
;
MEMOFFSET_64
returnOffset
;
MEMOFFSET_64
frameOffset
;
MEMOFFSET_64
stackOffset
;
};
struct
SyntheticSymbol
{
MEMOFFSET_64
moduleBase
;
SYMBOL_ID
symbolId
;
};
enum
VarStorage
{
UnknownVar
,
MemoryVar
,
RegisterVar
};
struct
LiveProcessInfo
{
PROCESS_ID
pid
;
PROCESS_ID
parentPid
;
std
::
wstring
name
;
std
::
wstring
user
;
std
::
wstring
commandLine
;
};
enum
DebugOptions
{
InitialBreak
=
0x00000020
,
FinalBreak
=
0x00000040
,
PreferDml
=
0x00040000
};
typedef
unsigned
long
DebugOptionsSet
;
///////////////////////////////////////////////////////////////////////////////
}
// kdlib namespace end
#pragma once
#include <string>
namespace
kdlib
{
///////////////////////////////////////////////////////////////////////////////
typedef
unsigned
long
PROCESS_ID
;
typedef
unsigned
long
PROCESS_DEBUG_ID
;
typedef
unsigned
long
THREAD_ID
;
typedef
unsigned
long
THREAD_DEBUG_ID
;
typedef
unsigned
long
SYSTEM_DEBUG_ID
;
typedef
unsigned
long
BREAKPOINT_ID
;
typedef
unsigned
long
long
MEMOFFSET_64
;
typedef
unsigned
long
MEMOFFSET_32
;
typedef
long
MEMOFFSET_REL
;
typedef
long
MEMDISPLACEMENT
;
typedef
unsigned
long
BITOFFSET
;
typedef
unsigned
long
ACCESS_TYPE
;
typedef
unsigned
long
long
EXTENSION_ID
;
typedef
unsigned
long
RELREG_ID
;
typedef
unsigned
long
long
SYMBOL_ID
;
enum
DebugCallbackResult
{
DebugCallbackProceed
=
0
,
DebugCallbackNoChange
=
1
,
DebugCallbackBreak
=
2
,
DebugCallbackMax
=
3
};
enum
ExecutionStatus
{
DebugStatusNoChange
,
DebugStatusGo
,
DebugStatusBreak
,
DebugStatusNoDebuggee
};
enum
BreakpointType
{
SoftwareBreakpoint
,
DataAccessBreakpoint
};
enum
CPUType
{
CPU_I386
=
0
,
CPU_AMD64
=
1
,
CPU_MAX
=
2
};
enum
CPURegType
{
RegInt8
,
RegInt16
,
RegInt32
,
RegInt64
,
RegFloat32
,
RegFloat64
,
RegFloat80
,
RegFloat128
,
RegVector64
,
RegVector128
};
enum
EventType
{
EventTypeNoEvent
,
EventTypeBreakpoint
,
EventTypeException
,
EventTypeCreateThread
,
EventTypeExitThread
,
EventTypeCreateProcess
,
EventTypeExitProcess
,
EventTypeLoadModule
,
EventTypeUnloadModule
,
EventTypeSystemError
,
EventTypeSessionStatus
,
EventTypeChangeDebuggeeState
,
EventTypeChangeEngineState
,
EventTypeChangeSymbolState
};
struct
SystemInfo
{
unsigned
long
majorVersion
;
unsigned
long
minorVersion
;
unsigned
long
servicePackNumber
;
unsigned
long
buildNumber
;
std
::
wstring
buildDescription
;
};
struct
SystemCrashInfo
{
unsigned
long
long
code
;
unsigned
long
paramterCount
;
unsigned
long
long
parameters
[
0x10
];
};
struct
ExceptionInfo
{
bool
firstChance
;
unsigned
long
exceptionCode
;
unsigned
long
exceptionFlags
;
MEMOFFSET_64
exceptionRecord
;
MEMOFFSET_64
exceptionAddress
;
PROCESS_DEBUG_ID
process
;
THREAD_DEBUG_ID
thread
;
unsigned
long
parameterCount
;
unsigned
long
long
parameters
[
0x10
];
};
struct
FixedFileInfo
{
unsigned
long
Signature
;
unsigned
long
StrucVersion
;
unsigned
long
FileVersionMS
;
unsigned
long
FileVersionLS
;
unsigned
long
ProductVersionMS
;
unsigned
long
ProductVersionLS
;
unsigned
long
FileFlagsMask
;
unsigned
long
FileFlags
;
unsigned
long
FileOS
;
unsigned
long
FileType
;
unsigned
long
FileSubtype
;
unsigned
long
FileDateMS
;
unsigned
long
FileDateLS
;
};
enum
FileFlag
{
FileFlagDebug
=
0x00000001
,
FileFlagPreRelease
=
0x00000002
,
FileFlagPatched
=
0x00000004
,
FileFlagPrivateBuild
=
0x00000008
,
FileFlagInfoInferred
=
0x00000010
,
FileFlagSpecialBuild
=
0x00000020
,
};
enum
MemoryProtect
{
PageNoAccess
=
0x00000001
,
PageReadOnly
=
0x00000002
,
PageReadWrite
=
0x00000004
,
PageWriteCopy
=
0x00000008
,
PageExecute
=
0x00000010
,
PageExecuteRead
=
0x00000020
,
PageExecuteReadWrite
=
0x00000040
,
PageExecuteWriteCopy
=
0x00000080
};
enum
ProcessExitReason
{
ProcessExit
,
ProcessTerminate
,
ProcessDetach
};
enum
ProcessDebugOptions
{
ProcessBreakOnStart
=
0x00000001
,
ProcessBreakOnStop
=
0x00000002
,
ProcessDebugChildren
=
0x00000004
,
ProcessNoDebugHeap
=
0x00000008
,
ProcessDebugDefault
=
ProcessBreakOnStart
};
typedef
unsigned
long
ProcessDebugFlags
;
struct
FrameDesc
{
MEMOFFSET_64
instructionOffset
;
MEMOFFSET_64
returnOffset
;
MEMOFFSET_64
frameOffset
;
MEMOFFSET_64
stackOffset
;
};
struct
SyntheticSymbol
{
MEMOFFSET_64
moduleBase
;
SYMBOL_ID
symbolId
;
};
enum
VarStorage
{
UnknownVar
,
MemoryVar
,
RegisterVar
};
struct
LiveProcessInfo
{
PROCESS_ID
pid
;
PROCESS_ID
parentPid
;
std
::
wstring
name
;
std
::
wstring
user
;
std
::
wstring
commandLine
;
};
enum
DebugOptions
{
InitialBreak
=
0x00000020
,
FinalBreak
=
0x00000040
,
PreferDml
=
0x00040000
};
typedef
unsigned
long
DebugOptionsSet
;
enum
BreakpointAccess
{
Read
=
0x00000001
,
Write
=
0x00000002
,
Execute
=
0x00000004
};
///////////////////////////////////////////////////////////////////////////////
}
// kdlib namespace end
kdlib/include/kdlib/typeinfo.h
View file @
0b69ac43
...
...
@@ -46,6 +46,7 @@ public:
virtual
std
::
wstring
str
()
=
0
;
virtual
std
::
wstring
getName
()
=
0
;
virtual
std
::
wstring
getScopeName
()
=
0
;
virtual
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
splitName
()
=
0
;
virtual
size_t
getSize
()
=
0
;
...
...
kdlib/source/net/nettype.h
View file @
0b69ac43
...
...
@@ -31,6 +31,10 @@ protected:
NOT_IMPLEMENTED
();
}
virtual
std
::
wstring
getScopeName
()
{
NOT_IMPLEMENTED
();
}
virtual
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
splitName
()
{
NOT_IMPLEMENTED
();
}
...
...
kdlib/source/typeinfoimp.h
View file @
0b69ac43
...
...
@@ -41,6 +41,10 @@ protected:
NOT_IMPLEMENTED
();
}
virtual
std
::
wstring
getScopeName
()
{
throw
TypeException
(
getName
(),
L"type has no scope name"
);
}
virtual
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
splitName
()
{
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
getName
(),
std
::
wstring
());
}
...
...
@@ -306,6 +310,7 @@ protected:
}
};
///////////////////////////////////////////////////////////////////////////////
class
TypeInfoFields
:
public
TypeInfoImp
...
...
@@ -372,13 +377,30 @@ private:
///////////////////////////////////////////////////////////////////////////////
class
TypeInfoUdt
:
public
TypeInfoFields
class
SymbolFields
:
public
TypeInfoFields
{
public:
SymbolFields
(
SymbolPtr
&
symbol
)
:
TypeInfoFields
(
symbol
->
getName
()
),
m_symbol
(
symbol
)
{}
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
protected:
SymbolPtr
m_symbol
;
};
class
TypeInfoUdt
:
public
SymbolFields
{
public:
TypeInfoUdt
(
SymbolPtr
&
symbol
)
:
TypeInfoFields
(
symbol
->
getName
()
),
m_symbol
(
symbol
)
SymbolFields
(
symbol
)
{}
protected:
...
...
@@ -420,8 +442,6 @@ protected:
protected:
SymbolPtr
m_symbol
;
virtual
void
getFields
();
virtual
void
getVirtualDisplacement
(
const
std
::
wstring
&
fieldName
,
MEMOFFSET_32
&
virtualBasePtr
,
size_t
&
virtualDispIndex
,
size_t
&
virtualDispSize
);
...
...
@@ -442,13 +462,12 @@ protected:
///////////////////////////////////////////////////////////////////////////////
class
TypeInfoEnum
:
public
TypeInfo
Fields
class
TypeInfoEnum
:
public
Symbol
Fields
{
public:
TypeInfoEnum
(
SymbolPtr
&
symbol
)
:
TypeInfoFields
(
symbol
->
getName
()
),
m_symbol
(
symbol
)
SymbolFields
(
symbol
)
{}
virtual
std
::
wstring
str
();
...
...
@@ -567,6 +586,10 @@ protected:
return
getPtrSize
();
}
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
private:
SymbolPtr
m_symbol
;
...
...
@@ -729,6 +752,10 @@ public:
return
L"VTable"
;
}
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
virtual
size_t
getAlignReq
()
{
return
getPtrSizeBySymbol
(
m_symbol
);
}
...
...
@@ -804,6 +831,10 @@ protected:
virtual
TypeInfoPtr
getClassParent
();
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
private:
SymbolPtr
m_symbol
;
...
...
@@ -880,6 +911,10 @@ public:
m_symbol
=
symbol
;
}
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
protected:
SymbolPtr
m_symbol
;
...
...
@@ -959,6 +994,10 @@ public:
m_symbol
=
symbol
;
}
std
::
wstring
getScopeName
()
{
return
m_symbol
->
getScopeName
();
}
protected:
SymbolPtr
m_symbol
;
...
...
kdlib/tests/kdlibtest/typeinfotest.h
View file @
0b69ac43
...
...
@@ -580,4 +580,15 @@ TEST_F(TypeInfoTest, GetTypeProviderFromPdb)
EXPECT_EQ
(
L"structTest"
,
structType
->
getName
()
);
}
TEST_F
(
TypeInfoTest
,
GetScopeName
)
{
EXPECT_EQ
(
L"targetapp"
,
loadType
(
L"g_classChild"
)
->
getScopeName
()
);
EXPECT_EQ
(
L"targetapp"
,
loadTypedVar
(
L"CdeclFuncPtr"
)
->
getType
()
->
getScopeName
()
);
EXPECT_EQ
(
L"targetapp"
,
loadType
(
L"g_structTestPtr"
)
->
getScopeName
()
);
EXPECT_THROW
(
loadType
(
L"UInt4B"
)
->
getScopeName
(),
TypeException
);
EXPECT_THROW
(
loadType
(
L"Void"
)
->
getScopeName
(),
TypeException
);
EXPECT_THROW
(
loadType
(
L"Float*"
)
->
getScopeName
(),
TypeException
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment