This commit is contained in:
Zhentar 2019-01-24 23:26:10 -06:00 коммит произвёл Dan Thompson
Родитель 13ff6d3e67
Коммит 37f65c91c6
7 изменённых файлов: 121 добавлений и 107 удалений

Просмотреть файл

@ -1,13 +1,16 @@
# Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Users\zhent\Source\Repos\DbgShell codebase based on best match to current usage at 11/8/2018
# You can modify the rules from these initially generated values to suit your own policies
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]
[*]
#Core editorconfig formatting - indentation
#use soft tabs (spaces) for indentation
indent_style = space
#resharper alignment options
align_multiline_parameter = true
align_multiline_argument = true
[*.cs]
#Formatting - indentation options
#indent switch case contents.
@ -58,6 +61,17 @@ csharp_space_between_square_brackets = true
csharp_space_within_type_parameter_angles = true
csharp_space_within_type_argument_angles = true
csharp_space_within_sizeof_parentheses = true
csharp_space_within_typeof_parentheses = true
csharp_space_within_checked_parentheses = true
csharp_space_within_single_line_array_initializer_braces = true
csharp_blank_lines_after_block_statements = 0
csharp_blank_lines_around_field = 0
csharp_place_simple_anonymousmethod_on_single_line = false
csharp_anonymous_method_declaration_braces = next_line_shifted_2
#Formatting - wrapping options
#leave code block on single line

Просмотреть файл

@ -234,7 +234,7 @@ namespace MS.Dbg
SetLastError = true,
CharSet = CharSet.Unicode,
EntryPoint = "SymLoadModuleExW" )]
internal static unsafe extern ulong SymLoadModuleEx( IntPtr hProcess,
internal static extern ulong SymLoadModuleEx( IntPtr hProcess,
IntPtr hFile,
string ImageName,
string ModuleName,
@ -3720,15 +3720,16 @@ namespace MS.Dbg
}
} // end SymFromInlineContext_naked()
public static int SymLoadModule( WDebugClient debugClient, ulong moduleBaseAddress)
public static int SymLoadModule( WDebugClient debugClient, ulong moduleBaseAddress )
{
IntPtr hProc = _GetHProcForDebugClient( debugClient );
if( 0 == NativeMethods.SymLoadModuleEx( hProc, default, null, null, moduleBaseAddress, 0, default, 0 ))
{ //0 means no new module was loaded... but you don't know if that's because it was already loaded without checking the last error.
if( 0 == NativeMethods.SymLoadModuleEx( hProc, default, null, null, moduleBaseAddress, 0, default, 0 ) )
{
// 0 means no new module was loaded... but you don't know if that's because it was already loaded without checking the last error.
var err = Marshal.GetLastWin32Error();
if( err != 0 )
{
return (err | unchecked((int) 0x80070000));
return (err | unchecked( (int) 0x80070000 ));
}
}
return 0;

Просмотреть файл

@ -2132,11 +2132,11 @@ namespace MS.Dbg
CheckHr( m_debugSystemObjects.GetCurrentThreadTeb( out var nativeTebAddress ) );
CheckHr( m_debugControl.GetActualProcessorType( out IMAGE_FILE_MACHINE actualType ) );
CheckHr( m_debugControl.GetEffectiveProcessorType( out IMAGE_FILE_MACHINE effectiveType ) );
if(actualType != effectiveType)
if( actualType != effectiveType )
{
var tebType = Debugger.GetModuleTypeByName( GetNtdllModuleNative(), "_TEB" );
var wowtebOffset = 8192u; //It's been that for 15 years now, so seems like a safe enough default
if(tebType is DbgUdtTypeInfo udtType && udtType.Members.HasItemNamed( "WowTebOffset" ))
var wowtebOffset = 8192u; // It's been that for 15 years now, so seems like a safe enough default
if( tebType is DbgUdtTypeInfo udtType && udtType.Members.HasItemNamed( "WowTebOffset" ) )
{
var wowtebOffsetOffset = udtType.FindMemberOffset( "WowTebOffset" );
wowtebOffset = ReadMemAs< uint >( nativeTebAddress + wowtebOffsetOffset );
@ -3497,7 +3497,7 @@ namespace MS.Dbg
Util.Assert( 0 == Util.Strcmp_OI( "*", modName ) );
pattern = "*!" + pattern;
}
else if ( "nt" == modName )
else if( "nt" == modName )
{
var ntdllModule = GetNtdllModuleNative();
modName = ntdllModule.Name;
@ -3656,9 +3656,8 @@ namespace MS.Dbg
public DbgNamedTypeInfo GetModuleTypeByName( DbgModuleInfo module,
string typeName,
CancellationToken cancelToken = default)
CancellationToken cancelToken = default )
{
_EnsureSymbolsLoaded( module, cancelToken );
return ExecuteOnDbgEngThread( () =>
{

Просмотреть файл

@ -274,7 +274,7 @@ namespace MS.Dbg
public void DiscardCachedModuleInfo()
{
RefreshModuleInfo(); //Need to tell modules to dump their cache for anyone holding onto a reference
RefreshModuleInfo(); // Need to tell modules to dump their cache for anyone holding onto a reference
m_modules = null;
m_unloadedModules = null;
} // end DiscardCachedModuleInfo()

Просмотреть файл

@ -564,11 +564,11 @@ namespace MS.Dbg
{
if( (0 != (int) (Flags & (DEBUG_CSS.LOADS | DEBUG_CSS.UNLOADS))) )
{
//If we load symbols using DbgEng's Reload command, it will send
//us back an Argument of 0, and we'll be forced to throw away everything.
//But in at least some other cases it faithfully passes along the
//base address - we still don't know which target it is for, but it is
//at least for no more than one module.
// If we load symbols using DbgEng's Reload command, it will send
// us back an Argument of 0, and we'll be forced to throw away everything.
// But in at least some other cases it faithfully passes along the
// base address - we still don't know which target it is for, but it is
// at least for no more than one module.
m_debugger.DiscardCachedModuleInfo( Argument );
// TODO: BUGBUG: To do this right requires knowing the current