mirror of
https://github.com/reactos/reactosdbg.git
synced 2024-11-23 03:39:43 +00:00
A debugging shell for use with KDBG. Not perfect yet but it can display the
locals and stack trace at the place where reactos is stopped. svn path=/trunk/tools/reactosdbg/; revision=759
This commit is contained in:
commit
6030ecd415
475
DbgHelp/DbgHelp.cs
Normal file
475
DbgHelp/DbgHelp.cs
Normal file
@ -0,0 +1,475 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DbgHelpAPI
|
||||
{
|
||||
public enum SymOptionsFlags
|
||||
{
|
||||
SYMOPT_ALLOW_ABSOLUTE_SYMBOLS = 0x80,
|
||||
SYMOPT_ALLOW_ZERO_ADDRESS = 0x1000000,
|
||||
SYMOPT_AUTO_PUBLICS = 0x10000,
|
||||
SYMOPT_CASE_INSENSITIVE = 1,
|
||||
SYMOPT_DEBUG = -2147483648,
|
||||
SYMOPT_DEFERRED_LOADS = 4,
|
||||
SYMOPT_DISABLE_SYMSRV_AUTODETECT = 0x2000000,
|
||||
SYMOPT_EXACT_SYMBOLS = 0x400,
|
||||
SYMOPT_FAIL_CRITICAL_ERRORS = 0x200,
|
||||
SYMOPT_FAVOR_COMPRESSED = 0x800000,
|
||||
SYMOPT_FLAT_DIRECTORY = 0x400000,
|
||||
SYMOPT_IGNORE_CVREC = 0x80,
|
||||
SYMOPT_IGNORE_IMAGEDIR = 0x200000,
|
||||
SYMOPT_IGNORE_NT_SYMPATH = 0x1000,
|
||||
SYMOPT_INCLUDE_32BIT_MODULES = 0x2000,
|
||||
SYMOPT_LOAD_ANYTHING = 0x40,
|
||||
SYMOPT_LOAD_LINES = 0x10,
|
||||
SYMOPT_NO_CPP = 8,
|
||||
SYMOPT_NO_IMAGE_SEARCH = 0x20000,
|
||||
SYMOPT_NO_PROMPTS = 0x80000,
|
||||
SYMOPT_NO_PUBLICS = 0x8000,
|
||||
SYMOPT_NO_UNQUALIFIED_LOADS = 0x100,
|
||||
SYMOPT_OVERWRITE = 0x100000,
|
||||
SYMOPT_PUBLICS_ONLY = 0x4000,
|
||||
SYMOPT_SECURE = 0x40000,
|
||||
SYMOPT_UNDNAME = 2
|
||||
}
|
||||
|
||||
public enum SsigType
|
||||
{
|
||||
DBHHEADER_DEBUGDIRS = 1,
|
||||
DBHHEADER_CVMISC = 2
|
||||
}
|
||||
|
||||
public struct MODLOAD_DATA
|
||||
{
|
||||
public UInt32 ssize;
|
||||
public SsigType ssig;
|
||||
public IntPtr data;
|
||||
public UInt32 size;
|
||||
public UInt32 flags;
|
||||
}
|
||||
|
||||
public enum SymLoadModuleFlags
|
||||
{
|
||||
SLMFLAG_NO_SYMBOLS = 4,
|
||||
SLMFLAG_VIRTUAL = 1
|
||||
}
|
||||
|
||||
public struct IMAGEHLP_STACK_FRAME
|
||||
{
|
||||
public ulong InstructionOffset;
|
||||
ulong ReturnOffset;
|
||||
ulong FrameOffset;
|
||||
ulong StackOffset;
|
||||
ulong BackingStoreOffset;
|
||||
ulong FuncTableEntry;
|
||||
[MarshalAs(UnmanagedType.ByValArray,SizeConst=4)]
|
||||
ulong[] Params;
|
||||
[MarshalAs(UnmanagedType.ByValArray,SizeConst=5)]
|
||||
ulong[] Reserved;
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
bool Virtual;
|
||||
uint Reserved2;
|
||||
}
|
||||
|
||||
public enum SymInfoFlags
|
||||
{
|
||||
SYMFLAG_NONE = 0,
|
||||
SYMFLAG_CLR_TOKEN = 0x40000,
|
||||
SYMFLAG_CONSTANT = 0x100,
|
||||
SYMFLAG_EXPORT = 0x200,
|
||||
SYMFLAG_FORWARDER = 0x400,
|
||||
SYMFLAG_FRAMEREL = 0x20,
|
||||
SYMFLAG_FUNCTION = 0x800,
|
||||
SYMFLAG_ILREL = 0x10000,
|
||||
SYMFLAG_LOCAL = 0x80,
|
||||
SYMFLAG_METADATA = 0x20000,
|
||||
SYMFLAG_PARAMETER = 0x40,
|
||||
SYMFLAG_REGISTER = 8,
|
||||
SYMFLAG_REGREL = 0x10,
|
||||
SYMFLAG_SLOT = 0x8000,
|
||||
SYMFLAG_THUNK = 0x2000,
|
||||
SYMFLAG_TLSREL = 0x4000,
|
||||
SYMFLAG_VALUEPRESENT = 1,
|
||||
SYMFLAG_VIRTUAL = 0x1000
|
||||
}
|
||||
|
||||
public struct SYMBOL_INFO
|
||||
{
|
||||
public uint SizeOfStruct;
|
||||
public uint TypeIndex;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=2)]
|
||||
public ulong []Reserved;
|
||||
public uint Index;
|
||||
public uint Size;
|
||||
public ulong ModBase;
|
||||
public SymInfoFlags Flags;
|
||||
public ulong Value;
|
||||
public ulong Address;
|
||||
public uint Register;
|
||||
public uint Scope;
|
||||
public uint Tag;
|
||||
public uint NameLen;
|
||||
public uint MaxNameLen;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
|
||||
public string Name;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
SizeOfStruct = (uint)Marshal.SizeOf(this);
|
||||
MaxNameLen = 256;
|
||||
}
|
||||
}
|
||||
|
||||
public enum IMAGEHLP_SYMBOL_TYPE_INFO
|
||||
{
|
||||
TI_GET_SYMTAG,
|
||||
TI_GET_SYMNAME,
|
||||
TI_GET_LENGTH,
|
||||
TI_GET_TYPE,
|
||||
TI_GET_TYPEID,
|
||||
TI_GET_BASETYPE,
|
||||
TI_GET_ARRAYINDEXTYPEID,
|
||||
TI_FINDCHILDREN,
|
||||
TI_GET_DATAKIND,
|
||||
TI_GET_ADDRESSOFFSET,
|
||||
TI_GET_OFFSET,
|
||||
TI_GET_VALUE,
|
||||
TI_GET_COUNT,
|
||||
TI_GET_CHILDRENCOUNT,
|
||||
TI_GET_BITPOSITION,
|
||||
TI_GET_VIRTUALBASECLASS,
|
||||
TI_GET_VIRTUALTABLESHAPEID,
|
||||
TI_GET_VIRTUALBASEPOINTEROFFSET,
|
||||
TI_GET_CLASSPARENTID,
|
||||
TI_GET_NESTED,
|
||||
TI_GET_SYMINDEX,
|
||||
TI_GET_LEXICALPARENT,
|
||||
TI_GET_ADDRESS,
|
||||
TI_GET_THISADJUST,
|
||||
TI_GET_UDTKIND,
|
||||
TI_IS_EQUIV_TO,
|
||||
TI_GET_CALLING_CONVENTION,
|
||||
TI_IS_CLOSE_EQUIV_TO,
|
||||
TI_GTIEX_REQS_VALID,
|
||||
TI_GET_VIRTUALBASEOFFSET,
|
||||
TI_GET_VIRTUALBASEDISPINDEX,
|
||||
TI_GET_IS_REFERENCE,
|
||||
TI_GET_INDIRECTVIRTUALBASECLASS
|
||||
}
|
||||
|
||||
public struct IMAGEHLP_LINE64
|
||||
{
|
||||
public uint SizeOfStruct;
|
||||
public IntPtr Key;
|
||||
public uint LineNumber;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string FileName;
|
||||
public ulong Address;
|
||||
public void Initialize() { SizeOfStruct = (uint)Marshal.SizeOf(this); }
|
||||
}
|
||||
|
||||
public delegate bool SymEnumSymbolsProc(ref SYMBOL_INFO symInfo, uint SymbolSize, IntPtr contextZero);
|
||||
|
||||
public enum DesiredAccess
|
||||
{
|
||||
GENERIC_READ = -2147483648
|
||||
}
|
||||
|
||||
public enum ShareMode
|
||||
{
|
||||
FILE_SHARE_READ = 1
|
||||
}
|
||||
|
||||
public enum CreateDisposition
|
||||
{
|
||||
OPEN_EXISTING = 3
|
||||
}
|
||||
|
||||
public enum FlagsAndAttributes
|
||||
{
|
||||
FILE_ATTRIBUTE_NORMAL = 0x80
|
||||
}
|
||||
|
||||
class Kernel32
|
||||
{
|
||||
public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
|
||||
[DllImport("kernel32")]
|
||||
public extern static IntPtr CreateFile(string FileName, DesiredAccess da, ShareMode sm, IntPtr SecurityAttributesZero, CreateDisposition cd, FlagsAndAttributes fa, IntPtr TemplateFileZero);
|
||||
[DllImport("kernel32")]
|
||||
public extern static void CloseHandle(IntPtr handle);
|
||||
}
|
||||
|
||||
class DbgHelp
|
||||
{
|
||||
[DllImport("dbghelp")]
|
||||
public extern static SymOptionsFlags SymSetOptions(SymOptionsFlags flags);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static SymOptionsFlags SymGetOptions();
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymInitialize(IntPtr hProcess, string UserSearchPath, bool fInvadeProcess);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymSetSearchPath(IntPtr hProcess, string SearchPath);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymGetSearchPath(IntPtr hProcess, StringBuilder SearchPathResult, int SearchPathLength);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static long SymLoadModuleEx(IntPtr hProcess, IntPtr hFile, string ImageName, string ModuleName, ulong BaseOfDll, uint DllSize, IntPtr DataZero, SymLoadModuleFlags Flags);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymUnloadModule64(IntPtr hProcess, ulong BaseOfDll);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymSetContext(IntPtr hProcess, ref IMAGEHLP_STACK_FRAME StackFrame, IntPtr ContextIgnored);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymSetScopeFromAddr(IntPtr hProcess, ulong Address);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymFromAddr(IntPtr hProcess, ulong Address, IntPtr DisplacementUnused, ref SYMBOL_INFO Symbol);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymFromName(IntPtr hProcess, string Name, ref SYMBOL_INFO Symbol);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymGetScope(IntPtr hProcess, ulong BaseOfDll, uint Index, ref SYMBOL_INFO Symbol);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymGetTypeInfo(IntPtr hProcess, ulong ModBase, uint TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, ref byte[] Data);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymGetTypeFromName(IntPtr hProcess, ulong BaseOfDll, string Name, ref SYMBOL_INFO Symbol);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymGetLineFromAddr64(IntPtr hProcess, ulong Addr, out IntPtr Displacement, ref IMAGEHLP_LINE64 Line);
|
||||
[DllImport("dbghelp")]
|
||||
public extern static bool SymEnumSymbols(IntPtr hProcess, ulong BaseOfDll, string Mask, SymEnumSymbolsProc Callback, IntPtr ContextZero);
|
||||
}
|
||||
|
||||
public class Variable
|
||||
{
|
||||
public enum Register
|
||||
{
|
||||
CV_REG_NONE = 0,
|
||||
CV_REG_AL = 1,
|
||||
CV_REG_CL = 2,
|
||||
CV_REG_DL = 3,
|
||||
CV_REG_BL = 4,
|
||||
CV_REG_AH = 5,
|
||||
CV_REG_CH = 6,
|
||||
CV_REG_DH = 7,
|
||||
CV_REG_BH = 8,
|
||||
CV_REG_AX = 9,
|
||||
CV_REG_CX = 10,
|
||||
CV_REG_DX = 11,
|
||||
CV_REG_BX = 12,
|
||||
CV_REG_SP = 13,
|
||||
CV_REG_BP = 14,
|
||||
CV_REG_SI = 15,
|
||||
CV_REG_DI = 16,
|
||||
CV_REG_EAX = 17,
|
||||
CV_REG_ECX = 18,
|
||||
CV_REG_EDX = 19,
|
||||
CV_REG_EBX = 20,
|
||||
CV_REG_ESP = 21,
|
||||
CV_REG_EBP = 22,
|
||||
CV_REG_ESI = 23,
|
||||
CV_REG_EDI = 24,
|
||||
CV_REG_ES = 25,
|
||||
CV_REG_CS = 26,
|
||||
CV_REG_SS = 27,
|
||||
CV_REG_DS = 28,
|
||||
CV_REG_FS = 29,
|
||||
CV_REG_GS = 30,
|
||||
CV_REG_IP = 31,
|
||||
CV_REG_FLAGS = 32,
|
||||
CV_REG_EIP = 33,
|
||||
CV_REG_EFLAGS = 34,
|
||||
|
||||
/* <pcode> */
|
||||
CV_REG_TEMP = 40,
|
||||
CV_REG_TEMPH = 41,
|
||||
CV_REG_QUOTE = 42,
|
||||
CV_REG_PCDR3 = 43, /* this includes PCDR4 to PCDR7 */
|
||||
CV_REG_CR0 = 80, /* this includes CR1 to CR4 */
|
||||
CV_REG_DR0 = 90, /* this includes DR1 to DR7 */
|
||||
/* </pcode> */
|
||||
|
||||
CV_REG_GDTR = 110,
|
||||
CV_REG_GDTL = 111,
|
||||
CV_REG_IDTR = 112,
|
||||
CV_REG_IDTL = 113,
|
||||
CV_REG_LDTR = 114,
|
||||
CV_REG_TR = 115,
|
||||
|
||||
CV_REG_PSEUDO1 = 116, /* this includes Pseudo02 to Pseuso09 */
|
||||
CV_REG_ST0 = 128, /* this includes ST1 to ST7 */
|
||||
CV_REG_CTRL = 136,
|
||||
CV_REG_STAT = 137,
|
||||
CV_REG_TAG = 138,
|
||||
CV_REG_FPIP = 139,
|
||||
CV_REG_FPCS = 140,
|
||||
CV_REG_FPDO = 141,
|
||||
CV_REG_FPDS = 142,
|
||||
CV_REG_ISEM = 143,
|
||||
CV_REG_FPEIP = 144,
|
||||
CV_REG_FPEDO = 145,
|
||||
CV_REG_MM0 = 146, /* this includes MM1 to MM7 */
|
||||
CV_REG_XMM0 = 154, /* this includes XMM1 to XMM7 */
|
||||
CV_REG_XMM00 = 162,
|
||||
CV_REG_XMM0L = 194, /* this includes XMM1L to XMM7L */
|
||||
CV_REG_XMM0H = 202, /* this includes XMM1H to XMM7H */
|
||||
CV_REG_MXCSR = 211,
|
||||
CV_REG_EDXEAX = 212,
|
||||
CV_REG_EMM0L = 220,
|
||||
CV_REG_EMM0H = 228,
|
||||
CV_REG_MM00 = 236,
|
||||
CV_REG_MM01 = 237,
|
||||
CV_REG_MM10 = 238,
|
||||
CV_REG_MM11 = 239,
|
||||
CV_REG_MM20 = 240,
|
||||
CV_REG_MM21 = 241,
|
||||
CV_REG_MM30 = 242,
|
||||
CV_REG_MM31 = 243,
|
||||
CV_REG_MM40 = 244,
|
||||
CV_REG_MM41 = 245,
|
||||
CV_REG_MM50 = 246,
|
||||
CV_REG_MM51 = 247,
|
||||
CV_REG_MM60 = 248,
|
||||
CV_REG_MM61 = 249,
|
||||
CV_REG_MM70 = 250,
|
||||
CV_REG_MM71 = 251
|
||||
};
|
||||
public string Name;
|
||||
public Register Reg;
|
||||
public int Offset, Size;
|
||||
public bool Local, Parameter, Regval, Regrel;
|
||||
}
|
||||
|
||||
public class SymbolContext
|
||||
{
|
||||
IntPtr hProcess;
|
||||
static Random mRandom = new Random();
|
||||
static FileMap mFileMap = new FileMap();
|
||||
string mReactosOutputPath = "output-i386", mReactosSourcePath = ".";
|
||||
public string ReactosOutputPath
|
||||
{
|
||||
get { return mReactosOutputPath; }
|
||||
set
|
||||
{
|
||||
mReactosOutputPath = value;
|
||||
mFileMap.Directories = new string[] { mReactosOutputPath };
|
||||
mFileMap.Scan();
|
||||
LoadModules();
|
||||
}
|
||||
}
|
||||
public string ReactosSourcePath
|
||||
{
|
||||
get { return mReactosSourcePath; }
|
||||
set
|
||||
{
|
||||
mReactosSourcePath = value;
|
||||
}
|
||||
}
|
||||
Dictionary<string, ulong> mLoadedModules = new Dictionary<string,ulong>();
|
||||
|
||||
static SymbolContext()
|
||||
{
|
||||
DbgHelp.SymSetOptions(SymOptionsFlags.SYMOPT_LOAD_LINES);
|
||||
}
|
||||
|
||||
public SymbolContext()
|
||||
{
|
||||
hProcess = new IntPtr(mRandom.Next() + 1);
|
||||
}
|
||||
public void Initialize()
|
||||
{
|
||||
DbgHelp.SymInitialize(hProcess, null, false);
|
||||
mFileMap.Directories = new string[] { mReactosOutputPath };
|
||||
}
|
||||
public void SetModuleAddress(string module, ulong addr)
|
||||
{
|
||||
if (mLoadedModules.ContainsKey(module))
|
||||
{
|
||||
DbgHelp.SymUnloadModule64(hProcess, mLoadedModules[module]);
|
||||
}
|
||||
mLoadedModules[module] = addr;
|
||||
LoadModule(module, addr);
|
||||
}
|
||||
public void LoadModule(string module, ulong addr)
|
||||
{
|
||||
string realPath = mFileMap.GetFilePathFromShortName((Path.GetFileNameWithoutExtension(module) + ".nostrip").ToUpper());
|
||||
if (realPath != null)
|
||||
{
|
||||
long loadResult = DbgHelp.SymLoadModuleEx
|
||||
(hProcess,
|
||||
IntPtr.Zero,
|
||||
realPath,
|
||||
null,
|
||||
addr,
|
||||
0,
|
||||
IntPtr.Zero,
|
||||
0);
|
||||
}
|
||||
}
|
||||
public void LoadModules()
|
||||
{
|
||||
foreach (string module in mLoadedModules.Keys)
|
||||
DbgHelp.SymUnloadModule64(hProcess, mLoadedModules[module]);
|
||||
}
|
||||
|
||||
public KeyValuePair<string, int> GetFileAndLine(ulong addr)
|
||||
{
|
||||
IntPtr displacement = new IntPtr();
|
||||
IMAGEHLP_LINE64 lineNumberIdent = new IMAGEHLP_LINE64();
|
||||
lineNumberIdent.Initialize();
|
||||
if (DbgHelp.SymGetLineFromAddr64
|
||||
(hProcess, addr, out displacement, ref lineNumberIdent))
|
||||
{
|
||||
Console.Out.WriteLine("Got File and Line for addr " + addr + ": " + lineNumberIdent.FileName.ToString() + ":" + lineNumberIdent.LineNumber);
|
||||
return new KeyValuePair<string, int>(lineNumberIdent.FileName.ToString(), (int)lineNumberIdent.LineNumber);
|
||||
}
|
||||
return new KeyValuePair<string, int>("unknown", 0);
|
||||
}
|
||||
|
||||
Variable MakeVarFromSym(SYMBOL_INFO symInfo)
|
||||
{
|
||||
Variable v = new Variable();
|
||||
v.Local = (symInfo.Flags & SymInfoFlags.SYMFLAG_LOCAL) != SymInfoFlags.SYMFLAG_NONE;
|
||||
v.Parameter = (symInfo.Flags & SymInfoFlags.SYMFLAG_PARAMETER) != SymInfoFlags.SYMFLAG_NONE;
|
||||
v.Regval = (symInfo.Flags & SymInfoFlags.SYMFLAG_REGISTER) != SymInfoFlags.SYMFLAG_NONE;
|
||||
v.Regrel = (symInfo.Flags & SymInfoFlags.SYMFLAG_REGREL) != SymInfoFlags.SYMFLAG_NONE;
|
||||
v.Reg = (Variable.Register)symInfo.Register;
|
||||
v.Offset = (int)symInfo.Address;
|
||||
v.Size = (int)symInfo.Size;
|
||||
v.Name = symInfo.Name;
|
||||
return v;
|
||||
}
|
||||
|
||||
List<Variable> mVariables = new List<Variable>();
|
||||
bool EnumLocals(ref SYMBOL_INFO symInfo, uint symSize, IntPtr contextZero)
|
||||
{
|
||||
Variable var = MakeVarFromSym(symInfo);
|
||||
if (var != null)
|
||||
mVariables.Add(var);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<Variable> GetLocals(ulong addr)
|
||||
{
|
||||
lock (mVariables)
|
||||
{
|
||||
mVariables.Clear();
|
||||
IMAGEHLP_STACK_FRAME stackFrame = new IMAGEHLP_STACK_FRAME();
|
||||
stackFrame.InstructionOffset = addr;
|
||||
// Always succeeds
|
||||
DbgHelp.SymSetContext(hProcess, ref stackFrame, IntPtr.Zero);
|
||||
DbgHelp.SymEnumSymbols(hProcess, 0, null, EnumLocals, IntPtr.Zero);
|
||||
return new List<Variable>(mVariables);
|
||||
}
|
||||
}
|
||||
|
||||
public Variable GetNamedVar(string name, ulong addr)
|
||||
{
|
||||
SYMBOL_INFO symInfo = new SYMBOL_INFO();
|
||||
symInfo.Initialize();
|
||||
if (DbgHelp.SymFromName(hProcess, name, ref symInfo))
|
||||
return MakeVarFromSym(symInfo);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
60
DbgHelp/DbgHelp.csproj
Normal file
60
DbgHelp/DbgHelp.csproj
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DbgHelpAPI</RootNamespace>
|
||||
<AssemblyName>DbgHelp.NET</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DbgHelp.cs" />
|
||||
<Compile Include="filemap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
DbgHelp/Properties/AssemblyInfo.cs
Normal file
36
DbgHelp/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DbgHelp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DbgHelp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("57c04d47-195b-446d-9587-aab81c574154")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
96
DbgHelp/filemap.cs
Normal file
96
DbgHelp/filemap.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DbgHelpAPI
|
||||
{
|
||||
public class FileMap
|
||||
{
|
||||
string []mDirectories = new string [] { "output-i386" };
|
||||
Dictionary<string, List<string>> mFileByShortName = new Dictionary<string, List<string>>();
|
||||
|
||||
public string GetFilePathFromShortName(string shortname)
|
||||
{
|
||||
List<string> possibleMatches;
|
||||
if (mFileByShortName.TryGetValue(shortname.ToLower(), out possibleMatches) &&
|
||||
possibleMatches.Count > 0)
|
||||
{
|
||||
return possibleMatches[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public string []Directories
|
||||
{
|
||||
get
|
||||
{
|
||||
return mDirectories;
|
||||
}
|
||||
set
|
||||
{
|
||||
mDirectories = value;
|
||||
Scan();
|
||||
}
|
||||
}
|
||||
|
||||
public FileMap()
|
||||
{
|
||||
Scan();
|
||||
}
|
||||
|
||||
// Returns the directories that were scanned
|
||||
public string []Scan()
|
||||
{
|
||||
mFileByShortName.Clear();
|
||||
|
||||
List<string> directoriesScanned = new List<string>();
|
||||
|
||||
foreach (string dir in mDirectories)
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(dir))
|
||||
Scan(dir);
|
||||
directoriesScanned.Add(dir);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
return directoriesScanned.ToArray();
|
||||
}
|
||||
|
||||
void RecordFileNamePossibility(string name, string fullpath)
|
||||
{
|
||||
List<string> possibilities;
|
||||
if (mFileByShortName.TryGetValue(name, out possibilities))
|
||||
possibilities.Add(fullpath);
|
||||
else
|
||||
mFileByShortName[name.ToLower()] = new List<string>(new string [] { fullpath });
|
||||
}
|
||||
|
||||
void RecordFileName(string name)
|
||||
{
|
||||
string shortfname = Path.GetFileName(name);
|
||||
string shortnoext = Path.GetFileNameWithoutExtension(name);
|
||||
RecordFileNamePossibility(shortfname, name);
|
||||
RecordFileNamePossibility(shortnoext, name);
|
||||
}
|
||||
|
||||
void Scan(string root)
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(root))
|
||||
RecordFileName(file);
|
||||
|
||||
foreach (string dir in Directory.GetDirectories(root))
|
||||
{
|
||||
try
|
||||
{
|
||||
Scan(dir);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
DebugProtocol/Breakpoint.cs
Normal file
36
DebugProtocol/Breakpoint.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
public class Breakpoint
|
||||
{
|
||||
public enum BPType { Software, Hardware, WriteWatch, ReadWatch, AccessWatch };
|
||||
public readonly BPType BreakpointType;
|
||||
public readonly long Address;
|
||||
public readonly int Length;
|
||||
public Breakpoint(BPType type, long addr, int len)
|
||||
{
|
||||
BreakpointType = type;
|
||||
Address = addr;
|
||||
Length = len;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (int)(((int)BreakpointType) ^ Address ^ (Length << 28));
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
Breakpoint otherbp = other as Breakpoint;
|
||||
if (otherbp == null) return false;
|
||||
return
|
||||
(otherbp.BreakpointType == BreakpointType) &&
|
||||
(otherbp.Address == Address) &&
|
||||
(otherbp.Length == Length);
|
||||
}
|
||||
}
|
||||
}
|
274
DebugProtocol/DebugConnection.cs
Normal file
274
DebugProtocol/DebugConnection.cs
Normal file
@ -0,0 +1,274 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using AbstractPipe;
|
||||
using DebugProtocol;
|
||||
using KDBGProtocol;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
public class DebugConnectedEventArgs : EventArgs
|
||||
{
|
||||
public DebugConnectedEventArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void DebugConnectedEventHandler(object sender, DebugConnectedEventArgs args);
|
||||
|
||||
public class DebugConnectionModeChangedEventArgs : EventArgs
|
||||
{
|
||||
public readonly DebugConnection.Mode Mode;
|
||||
public DebugConnectionModeChangedEventArgs(DebugConnection.Mode mode)
|
||||
{
|
||||
Mode = mode;
|
||||
}
|
||||
}
|
||||
public delegate void DebugConnectionModeChangedEventHandler(object sender, DebugConnectionModeChangedEventArgs args);
|
||||
|
||||
public class DebugRegisterChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly Registers Registers;
|
||||
public DebugRegisterChangeEventArgs(Registers regs)
|
||||
{
|
||||
Registers = regs;
|
||||
}
|
||||
}
|
||||
public delegate void DebugRegisterChangeEventHandler(object sender, DebugRegisterChangeEventArgs args);
|
||||
|
||||
public class DebugRunningChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly bool Running;
|
||||
public DebugRunningChangeEventArgs(bool running) { Running = running; }
|
||||
}
|
||||
public delegate void DebugRunningChangeEventHandler(object sender, DebugRunningChangeEventArgs args);
|
||||
|
||||
public class DebugModuleChangedEventArgs : EventArgs
|
||||
{
|
||||
public readonly uint ModuleAddr;
|
||||
public readonly string ModuleName;
|
||||
public DebugModuleChangedEventArgs(uint moduleAddr, string moduleName)
|
||||
{
|
||||
ModuleAddr = moduleAddr;
|
||||
ModuleName = moduleName;
|
||||
}
|
||||
}
|
||||
public delegate void DebugModuleChangedEventHandler(object sender, DebugModuleChangedEventArgs args);
|
||||
|
||||
public class DebugRawTrafficEventArgs : EventArgs
|
||||
{
|
||||
public readonly string Data;
|
||||
public DebugRawTrafficEventArgs(string data) { Data = data; }
|
||||
}
|
||||
public delegate void DebugRawTrafficEventHandler(object sender, DebugRawTrafficEventArgs args);
|
||||
|
||||
public class DebugConnection
|
||||
{
|
||||
#region Primary State
|
||||
public enum Mode { ClosedMode, SocketMode }
|
||||
public Mode ConnectionMode
|
||||
{
|
||||
get { return mConnectionMode; }
|
||||
set
|
||||
{
|
||||
mConnectionMode = value;
|
||||
if (DebugConnectionModeChangedEvent != null)
|
||||
DebugConnectionModeChangedEvent(this, new DebugConnectionModeChangedEventArgs(value));
|
||||
}
|
||||
}
|
||||
public bool mRunning = true;
|
||||
public bool Running
|
||||
{
|
||||
get { return mRunning; }
|
||||
set
|
||||
{
|
||||
mRunning = value;
|
||||
if (DebugRunningChangeEvent != null)
|
||||
DebugRunningChangeEvent(this, new DebugRunningChangeEventArgs(value));
|
||||
}
|
||||
}
|
||||
KDBG mKdb;
|
||||
Registers mRegisters = new Registers();
|
||||
public IDebugProtocol Debugger { get { return mKdb; } }
|
||||
Pipe mMedium;
|
||||
Mode mConnectionMode;
|
||||
List<WeakReference> mMemoryReaders = new List<WeakReference>();
|
||||
#endregion
|
||||
|
||||
#region Socket Mode State
|
||||
int mRemotePort;
|
||||
Socket mSocket;
|
||||
SocketAsyncEventArgs mAsyncConnect;
|
||||
AsyncCallback mDnsLookup;
|
||||
IAsyncResult mDnsAsyncResult;
|
||||
#endregion
|
||||
|
||||
public event DebugRegisterChangeEventHandler DebugRegisterChangeEvent;
|
||||
public event DebugConnectedEventHandler DebugConnectionConnectedEvent;
|
||||
public event DebugConnectionModeChangedEventHandler DebugConnectionModeChangedEvent;
|
||||
public event DebugRunningChangeEventHandler DebugRunningChangeEvent;
|
||||
public event DebugModuleChangedEventHandler DebugModuleChangedEvent;
|
||||
public event DebugRawTrafficEventHandler DebugRawTrafficEvent;
|
||||
|
||||
public DebugConnection()
|
||||
{
|
||||
}
|
||||
|
||||
void DnsLookupResult(IAsyncResult result)
|
||||
{
|
||||
if (result.IsCompleted)
|
||||
{
|
||||
IPHostEntry entry = Dns.EndGetHostEntry(mDnsAsyncResult);
|
||||
if (entry.AddressList.Length > 0)
|
||||
{
|
||||
int i;
|
||||
// Check for an ipv4 target
|
||||
for (i = 0; i < entry.AddressList.Length; i++)
|
||||
if (entry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
|
||||
break;
|
||||
// Otherwise just fall back to the first one
|
||||
if (i == entry.AddressList.Length) i = 0;
|
||||
mAsyncConnect.RemoteEndPoint = new IPEndPoint(entry.AddressList[i], mRemotePort);
|
||||
mSocket.ConnectAsync(mAsyncConnect);
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(string host, int port)
|
||||
{
|
||||
Close();
|
||||
mRemotePort = port;
|
||||
ConnectionMode = Mode.SocketMode;
|
||||
mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
mAsyncConnect = new SocketAsyncEventArgs();
|
||||
mAsyncConnect.UserToken = this;
|
||||
mAsyncConnect.Completed += SocketConnectCompleted;
|
||||
mDnsLookup = new AsyncCallback(DnsLookupResult);
|
||||
mDnsAsyncResult = Dns.BeginGetHostEntry(host, mDnsLookup, this);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
switch (ConnectionMode)
|
||||
{
|
||||
case Mode.SocketMode:
|
||||
mSocket.Close();
|
||||
mSocket = null;
|
||||
break;
|
||||
}
|
||||
|
||||
mMedium = null;
|
||||
if (mKdb != null)
|
||||
mKdb.Close();
|
||||
mKdb = null;
|
||||
ConnectionMode = Mode.ClosedMode;
|
||||
}
|
||||
|
||||
void MediumError(object sender, PipeErrorEventArgs args)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void SocketConnectCompleted(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
if (mAsyncConnect.SocketError == SocketError.Success)
|
||||
{
|
||||
mMedium = new SocketPipe(mSocket);
|
||||
mMedium.PipeErrorEvent += MediumError;
|
||||
mMedium.PipeReceiveEvent += PipeReceiveEvent;
|
||||
mKdb = new KDBG(mMedium);
|
||||
mKdb.RegisterChangeEvent += RegisterChangeEvent;
|
||||
mKdb.ModuleListEvent += ModuleListEvent;
|
||||
mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
|
||||
Running = true;
|
||||
if (DebugConnectionConnectedEvent != null)
|
||||
DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
|
||||
}
|
||||
else
|
||||
Close();
|
||||
}
|
||||
|
||||
void MemoryUpdateEvent(object sender, MemoryUpdateEventArgs args)
|
||||
{
|
||||
List<WeakReference> deadStreams = new List<WeakReference>();
|
||||
|
||||
lock (mMemoryReaders)
|
||||
{
|
||||
foreach (WeakReference memStreamRef in mMemoryReaders)
|
||||
{
|
||||
DebugMemoryStream memStream = memStreamRef.Target as DebugMemoryStream;
|
||||
|
||||
if (memStream == null)
|
||||
{
|
||||
deadStreams.Add(memStreamRef);
|
||||
continue;
|
||||
}
|
||||
|
||||
memStream.Update(args.Address, args.Memory);
|
||||
}
|
||||
|
||||
foreach (WeakReference deadref in deadStreams)
|
||||
mMemoryReaders.Remove(deadref);
|
||||
}
|
||||
}
|
||||
|
||||
void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
|
||||
{
|
||||
if (DebugRawTrafficEvent != null)
|
||||
DebugRawTrafficEvent(this, new DebugRawTrafficEventArgs(args.Received));
|
||||
}
|
||||
|
||||
void ModuleListEvent(object sender, ModuleListEventArgs args)
|
||||
{
|
||||
if (DebugModuleChangedEvent != null)
|
||||
DebugModuleChangedEvent(this, new DebugModuleChangedEventArgs((uint)args.Address, args.Module));
|
||||
}
|
||||
|
||||
void RegisterChangeEvent(object sender, RegisterChangeEventArgs args)
|
||||
{
|
||||
args.Registers.CopyTo(mRegisters.RegisterSet);
|
||||
Running = false;
|
||||
if (DebugRegisterChangeEvent != null)
|
||||
DebugRegisterChangeEvent(this, new DebugRegisterChangeEventArgs(mRegisters));
|
||||
}
|
||||
|
||||
public void Break()
|
||||
{
|
||||
if (mKdb != null)
|
||||
mKdb.Break();
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
Running = true;
|
||||
if (mKdb != null) mKdb.Step();
|
||||
Running = false;
|
||||
}
|
||||
|
||||
public void Go()
|
||||
{
|
||||
if (mKdb != null)
|
||||
{
|
||||
mKdb.Go(0);
|
||||
Running = true;
|
||||
}
|
||||
}
|
||||
|
||||
public DebugMemoryStream NewMemoryStream()
|
||||
{
|
||||
lock (mMemoryReaders)
|
||||
{
|
||||
DebugMemoryStream dms = new DebugMemoryStream(this);
|
||||
mMemoryReaders.Add(new WeakReference(dms));
|
||||
return dms;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
DebugProtocol/DebugControlAttribute.cs
Normal file
11
DebugProtocol/DebugControlAttribute.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class DebugControlAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
181
DebugProtocol/DebugMemoryStream.cs
Normal file
181
DebugProtocol/DebugMemoryStream.cs
Normal file
@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
public class DebugMemoryStream : Stream
|
||||
{
|
||||
DebugConnection mConnection;
|
||||
ulong mReadAddr;
|
||||
int mCopyOffset, mCopyCount;
|
||||
byte[] mReadBuffer;
|
||||
long[] mBytesReceived;
|
||||
EventWaitHandle mReadComplete = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return 1L << 32; }
|
||||
}
|
||||
|
||||
long mPosition;
|
||||
public override long Position
|
||||
{
|
||||
get { return mPosition; }
|
||||
set { mPosition = value; }
|
||||
}
|
||||
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Seek(long position, SeekOrigin origin)
|
||||
{
|
||||
long prev = mPosition;
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
mPosition = position;
|
||||
break;
|
||||
|
||||
case SeekOrigin.Current:
|
||||
mPosition += position;
|
||||
break;
|
||||
|
||||
case SeekOrigin.End:
|
||||
mPosition = ((1L << 32) - position) & ((1L << 32) - 1);
|
||||
break;
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
public override void SetLength(long len) { }
|
||||
|
||||
int RoundUp(int count, int factor)
|
||||
{
|
||||
return (count + (factor - 1)) & ~(factor - 1);
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
mReadAddr = (ulong)mPosition;
|
||||
mBytesReceived = new long[RoundUp(count, 64) / 64];
|
||||
SetBits(count, RoundUp(count, 64));
|
||||
mCopyOffset = offset;
|
||||
mCopyCount = count;
|
||||
mReadBuffer = buffer;
|
||||
mConnection.Debugger.GetMemoryUpdate(mReadAddr, count);
|
||||
}
|
||||
mReadComplete.WaitOne();
|
||||
lock (this)
|
||||
{
|
||||
mBytesReceived = null;
|
||||
return mCopyCount == 0 ? -1 : mCopyCount;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
}
|
||||
|
||||
void SetBits(int start, int end)
|
||||
{
|
||||
int longOfStart = start >> 6, longOfEnd = (end - 1) >> 6;
|
||||
if (longOfStart == longOfEnd)
|
||||
{
|
||||
end -= start & ~63;
|
||||
start &= 63;
|
||||
long mask = ~((1L << start) - 1);
|
||||
mask &= end == 64 ? -1 : ((1L << end) - 1);
|
||||
mBytesReceived[longOfStart] |= mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
int nextStart = (start + 64) & ~63;
|
||||
SetBits(start, nextStart);
|
||||
while (nextStart >> 6 != longOfEnd)
|
||||
{
|
||||
start = nextStart;
|
||||
nextStart = start + 64;
|
||||
SetBits(start, nextStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadComplete()
|
||||
{
|
||||
foreach (long l in mBytesReceived) if (l != -1) return false;
|
||||
if (mCopyCount > 0) mPosition += mCopyCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Update(ulong Address, byte[] Memory)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (mBytesReceived == null) return;
|
||||
if (Address >= mReadAddr)
|
||||
{
|
||||
long diff = (long)(Address - mReadAddr);
|
||||
|
||||
if (Memory == null)
|
||||
{
|
||||
if (diff >= mCopyCount) return;
|
||||
SetBits((int)diff, mCopyCount);
|
||||
mCopyCount = Math.Min(mCopyCount, (int)diff);
|
||||
}
|
||||
else
|
||||
{
|
||||
long toCopy = Math.Min(Memory.Length, mCopyCount - diff);
|
||||
if (toCopy <= 0 || diff >= mCopyCount) return;
|
||||
|
||||
Array.Copy(Memory, 0, mReadBuffer, mCopyOffset + diff, toCopy);
|
||||
SetBits(mCopyOffset + (int)diff, (int)(mCopyOffset + diff + toCopy));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
long diff = (long)(mReadAddr - Address);
|
||||
|
||||
if (Memory == null)
|
||||
{
|
||||
if (diff >= 4096) return;
|
||||
mCopyCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
long toCopy = Math.Min(mReadBuffer.Length - mCopyOffset, Math.Min(mCopyCount - diff, Memory.Length));
|
||||
if (toCopy <= 0 || diff >= Memory.Length) return;
|
||||
|
||||
Array.Copy(Memory, (int)diff, mReadBuffer, mCopyOffset, (int)toCopy);
|
||||
SetBits(0, (int)toCopy);
|
||||
}
|
||||
}
|
||||
if (ReadComplete()) mReadComplete.Set();
|
||||
}
|
||||
}
|
||||
|
||||
public DebugMemoryStream(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
}
|
||||
}
|
||||
}
|
70
DebugProtocol/DebugProtocol.csproj
Normal file
70
DebugProtocol/DebugProtocol.csproj
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{76A02C1D-4B11-4D43-966E-E5C053870D65}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DebugProtocol</RootNamespace>
|
||||
<AssemblyName>DebugProtocol</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Breakpoint.cs" />
|
||||
<Compile Include="DebugConnection.cs" />
|
||||
<Compile Include="DebugMemoryStream.cs" />
|
||||
<Compile Include="IDebugProtocol.cs" />
|
||||
<Compile Include="KDBG.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Registers.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Pipe\Pipe.csproj">
|
||||
<Project>{F943218A-0A5E-436E-A7A4-475F37F45FA8}</Project>
|
||||
<Name>Pipe</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
99
DebugProtocol/IDebugProtocol.cs
Normal file
99
DebugProtocol/IDebugProtocol.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
#region Event defs
|
||||
public class ConsoleOutputEventArgs : EventArgs
|
||||
{
|
||||
public readonly string Line;
|
||||
public ConsoleOutputEventArgs(string line)
|
||||
{
|
||||
Line = line;
|
||||
}
|
||||
}
|
||||
public delegate void ConsoleOutputEventHandler(object sender, ConsoleOutputEventArgs args);
|
||||
|
||||
public class RegisterChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly List<ulong> Registers;
|
||||
public RegisterChangeEventArgs(IEnumerable<ulong> registers)
|
||||
{
|
||||
Registers = new List<ulong>(registers);
|
||||
}
|
||||
}
|
||||
public delegate void RegisterChangeEventHandler(object sender, RegisterChangeEventArgs args);
|
||||
|
||||
public class SignalDeliveredEventArgs : EventArgs
|
||||
{
|
||||
public readonly int Signal;
|
||||
public SignalDeliveredEventArgs(int sig)
|
||||
{
|
||||
Signal = sig;
|
||||
}
|
||||
}
|
||||
public delegate void SignalDeliveredEventHandler(object sender, SignalDeliveredEventArgs args);
|
||||
|
||||
public class RemoteGDBErrorArgs : EventArgs
|
||||
{
|
||||
public readonly int Error;
|
||||
public RemoteGDBErrorArgs(int error)
|
||||
{
|
||||
Error = error;
|
||||
}
|
||||
}
|
||||
public delegate void RemoteGDBErrorHandler(object sender, RemoteGDBErrorArgs args);
|
||||
|
||||
public class MemoryUpdateEventArgs : EventArgs
|
||||
{
|
||||
public readonly ulong Address;
|
||||
public readonly byte[] Memory;
|
||||
public MemoryUpdateEventArgs(ulong address, byte[] memory)
|
||||
{
|
||||
Address = address;
|
||||
Memory = memory;
|
||||
}
|
||||
}
|
||||
public delegate void MemoryUpdateEventHandler(object sender, MemoryUpdateEventArgs args);
|
||||
|
||||
public class ModuleListEventArgs : EventArgs
|
||||
{
|
||||
public readonly ulong Address;
|
||||
public readonly string Module;
|
||||
public ModuleListEventArgs(string module, ulong address)
|
||||
{
|
||||
Module = module;
|
||||
Address = address;
|
||||
}
|
||||
}
|
||||
public delegate void ModuleListEventHandler(object sender, ModuleListEventArgs args);
|
||||
#endregion
|
||||
|
||||
public interface IDebugProtocol
|
||||
{
|
||||
void SetBreakpoint(Breakpoint bp);
|
||||
void RemoveBreakpoint(Breakpoint bp);
|
||||
|
||||
event ConsoleOutputEventHandler ConsoleOutputEvent;
|
||||
event RegisterChangeEventHandler RegisterChangeEvent;
|
||||
event SignalDeliveredEventHandler SignalDeliveredEvent;
|
||||
event RemoteGDBErrorHandler RemoteGDBError;
|
||||
event MemoryUpdateEventHandler MemoryUpdateEvent;
|
||||
event ModuleListEventHandler ModuleListEvent;
|
||||
|
||||
void GetRegisterUpdate();
|
||||
void GetModuleUpdate();
|
||||
void GetMemoryUpdate(ulong address, int len);
|
||||
void WriteMemory(ulong address, byte[] buf);
|
||||
void Step();
|
||||
void Next();
|
||||
void Break();
|
||||
void Go(ulong address);
|
||||
|
||||
void Write(string wr);
|
||||
|
||||
void Close();
|
||||
}
|
||||
}
|
318
DebugProtocol/KDBG.cs
Normal file
318
DebugProtocol/KDBG.cs
Normal file
@ -0,0 +1,318 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
using AbstractPipe;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace KDBGProtocol
|
||||
{
|
||||
public class KDBG : IDebugProtocol
|
||||
{
|
||||
bool mRunning = true;
|
||||
Pipe mConnection;
|
||||
List<string> mCommandBuffer = new List<string>();
|
||||
Dictionary<string, ulong> mModuleList = new Dictionary<string, ulong>();
|
||||
ulong []mRegisters = new ulong[32];
|
||||
|
||||
public KDBG(Pipe connection)
|
||||
{
|
||||
mConnection = connection;
|
||||
mConnection.PipeReceiveEvent += PipeReceiveEvent;
|
||||
mConnection.PipeErrorEvent += PipeErrorEvent;
|
||||
}
|
||||
|
||||
void PipeErrorEvent(object sender, PipeErrorEventArgs args)
|
||||
{
|
||||
}
|
||||
|
||||
static Regex mMemoryRowUpdate = new Regex("<(?<addr>[^>]+)>: (?<row>[0-9a-fA-F? ]*)");
|
||||
static Regex mModuleOffset = new Regex("(?<modname>[^:]+):(?<offset>[0-9a-fA-f]+).*");
|
||||
static Regex mModuleUpdate = new Regex("(?<base>[0-9a-fA-F]+) (?<size>[0-9a-fA-F]+) (?<modname>\\w+\\.\\w+)");
|
||||
static Regex mRegLineCS_EIP = new Regex("CS:EIP 0x(?<cs>[0-9a-fA-F]+):0x(?<eip>[0-9a-fA-F]+).*");
|
||||
static Regex mRegLineSS_ESP = new Regex("SS:ESP 0x(?<ss>[0-9a-fA-F]+):0x(?<esp>[0-9a-fA-F]+).*");
|
||||
static Regex mRegLineEAX_EBX = new Regex("EAX 0x(?<eax>[0-9a-fA-F]+)[ \t]+EBX 0x(?<ebx>[0-9a-fA-F]+).*");
|
||||
static Regex mRegLineECX_EDX = new Regex("ECX 0x(?<ecx>[0-9a-fA-F]+)[ \t]+EDX 0x(?<edx>[0-9a-fA-F]+).*");
|
||||
static Regex mRegLineEBP = new Regex("EBP 0x(?<ebp>[0-9a-fA-F]+).*");
|
||||
static Regex mRegLineEFLAGS = new Regex("EFLAGS 0x(?<eflags>[0-9a-fA-F]+).*");
|
||||
static Regex mSregLine = new Regex("[CDEFGS]S 0x(?<seg>[0-9a-fA-F]+).*");
|
||||
|
||||
StringBuilder mInputBuffer = new StringBuilder();
|
||||
int usedInput;
|
||||
|
||||
void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
|
||||
{
|
||||
bool tookText = false;
|
||||
string inbufStr;
|
||||
int promptIdx;
|
||||
|
||||
mInputBuffer.Append(args.Received);
|
||||
|
||||
if (mInputBuffer.ToString().Substring(usedInput).Contains("key to continue"))
|
||||
{
|
||||
mConnection.Write("\r");
|
||||
usedInput = mInputBuffer.Length;
|
||||
}
|
||||
|
||||
while ((promptIdx = (inbufStr = mInputBuffer.ToString()).IndexOf("kdb:> ")) != -1)
|
||||
{
|
||||
string pretext = inbufStr.Substring(0, promptIdx);
|
||||
string[] theInput = pretext.Split(new char[] { '\n' });
|
||||
int remove = pretext.Length + "kdb:> ".Length;
|
||||
|
||||
mInputBuffer.Remove(0, remove);
|
||||
usedInput = Math.Max(0, usedInput - remove);
|
||||
|
||||
if (!tookText)
|
||||
{
|
||||
if (mRunning)
|
||||
{
|
||||
mRunning = false;
|
||||
GetRegisterUpdate();
|
||||
}
|
||||
tookText = true;
|
||||
}
|
||||
|
||||
foreach (string line in theInput)
|
||||
{
|
||||
string cleanedLine = line.Trim();
|
||||
try
|
||||
{
|
||||
if (cleanedLine.StartsWith("Entered debugger on "))
|
||||
{
|
||||
GetRegisterUpdate();
|
||||
GetModuleUpdate();
|
||||
continue;
|
||||
}
|
||||
|
||||
Match memoryMatch = mMemoryRowUpdate.Match(cleanedLine);
|
||||
if (memoryMatch.Success)
|
||||
{
|
||||
string addrStr = memoryMatch.Groups["addr"].ToString();
|
||||
Match modOffset = mModuleOffset.Match(addrStr);
|
||||
ulong updateAddress;
|
||||
if (modOffset.Success)
|
||||
{
|
||||
string modname = modOffset.Groups["modname"].ToString();
|
||||
ulong offset = ulong.Parse(modOffset.Groups["offset"].ToString(), NumberStyles.HexNumber);
|
||||
ulong modbase;
|
||||
if (mModuleList.TryGetValue(modname.ToUpper(), out modbase))
|
||||
updateAddress = modbase + offset;
|
||||
else
|
||||
continue; // Couldn't resolve the address of the named module ...
|
||||
}
|
||||
else
|
||||
{
|
||||
updateAddress = ulong.Parse(addrStr, NumberStyles.HexNumber);
|
||||
}
|
||||
string[] memWords = memoryMatch.Groups["row"].ToString().Split(new char[] { ' ' });
|
||||
byte []updateBytes = new byte[4 * memWords.Length];
|
||||
int ctr = 0;
|
||||
foreach (string word in memWords)
|
||||
{
|
||||
if (word[0] == '?')
|
||||
{
|
||||
if (MemoryUpdateEvent != null)
|
||||
MemoryUpdateEvent(this, new MemoryUpdateEventArgs((updateAddress & ~0xfffUL), null));
|
||||
}
|
||||
else
|
||||
{
|
||||
int wordParsed = int.Parse(word, NumberStyles.HexNumber);
|
||||
int curCtr = ctr;
|
||||
for (ctr = curCtr; ctr < curCtr + 4; ctr++)
|
||||
{
|
||||
updateBytes[ctr] = (byte)(wordParsed & 0xff);
|
||||
wordParsed >>= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MemoryUpdateEvent != null)
|
||||
MemoryUpdateEvent(this, new MemoryUpdateEventArgs(updateAddress, updateBytes));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Match moduleMatch = mModuleUpdate.Match(cleanedLine);
|
||||
if (moduleMatch.Success)
|
||||
{
|
||||
ulong baseAddress = ulong.Parse(moduleMatch.Groups["base"].ToString(), NumberStyles.HexNumber);
|
||||
uint moduleSize = uint.Parse(moduleMatch.Groups["size"].ToString(), NumberStyles.HexNumber);
|
||||
string moduleName = moduleMatch.Groups["modname"].ToString();
|
||||
mModuleList[moduleName.ToUpper()] = baseAddress;
|
||||
if (ModuleListEvent != null)
|
||||
ModuleListEvent(this, new ModuleListEventArgs(moduleName, baseAddress));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Match csEipMatch = mRegLineCS_EIP.Match(cleanedLine);
|
||||
if (csEipMatch.Success)
|
||||
{
|
||||
uint cs = uint.Parse(csEipMatch.Groups["cs"].ToString(), NumberStyles.HexNumber);
|
||||
ulong eip = ulong.Parse(csEipMatch.Groups["eip"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[8] = eip;
|
||||
mRegisters[10] = cs;
|
||||
continue;
|
||||
}
|
||||
|
||||
Match ssEspMatch = mRegLineSS_ESP.Match(cleanedLine);
|
||||
if (ssEspMatch.Success)
|
||||
{
|
||||
uint ss = uint.Parse(ssEspMatch.Groups["ss"].ToString(), NumberStyles.HexNumber);
|
||||
ulong esp = ulong.Parse(ssEspMatch.Groups["esp"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[4] = esp;
|
||||
mRegisters[15] = ss;
|
||||
}
|
||||
|
||||
Match eaxEbxMatch = mRegLineEAX_EBX.Match(cleanedLine);
|
||||
if (eaxEbxMatch.Success)
|
||||
{
|
||||
ulong eax = ulong.Parse(eaxEbxMatch.Groups["eax"].ToString(), NumberStyles.HexNumber);
|
||||
ulong ebx = ulong.Parse(eaxEbxMatch.Groups["ebx"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[0] = eax;
|
||||
mRegisters[3] = ebx;
|
||||
continue;
|
||||
}
|
||||
|
||||
Match ecxEdxMatch = mRegLineECX_EDX.Match(cleanedLine);
|
||||
if (ecxEdxMatch.Success)
|
||||
{
|
||||
ulong ecx = ulong.Parse(ecxEdxMatch.Groups["ecx"].ToString(), NumberStyles.HexNumber);
|
||||
ulong edx = ulong.Parse(ecxEdxMatch.Groups["edx"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[1] = ecx;
|
||||
mRegisters[2] = edx;
|
||||
continue;
|
||||
}
|
||||
|
||||
Match ebpMatch = mRegLineEBP.Match(cleanedLine);
|
||||
if (ebpMatch.Success)
|
||||
{
|
||||
ulong ebp = ulong.Parse(ebpMatch.Groups["ebp"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[5] = ebp;
|
||||
continue;
|
||||
}
|
||||
|
||||
Match eflagsMatch = mRegLineEFLAGS.Match(cleanedLine);
|
||||
if (eflagsMatch.Success)
|
||||
{
|
||||
ulong eflags = ulong.Parse(eflagsMatch.Groups["eflags"].ToString(), NumberStyles.HexNumber);
|
||||
mRegisters[9] = eflags;
|
||||
if (RegisterChangeEvent != null)
|
||||
RegisterChangeEvent(this, new RegisterChangeEventArgs(mRegisters));
|
||||
continue;
|
||||
}
|
||||
|
||||
Match sregMatch = mSregLine.Match(cleanedLine);
|
||||
if (sregMatch.Success)
|
||||
{
|
||||
char []segmap = new char[] { 'C','D','E','F','G','S' };
|
||||
uint sreg = uint.Parse(sregMatch.Groups["seg"].ToString(), NumberStyles.HexNumber);
|
||||
int findSeg;
|
||||
for (findSeg = 0; findSeg < segmap.Length; findSeg++)
|
||||
{
|
||||
if (segmap[findSeg] == cleanedLine[0])
|
||||
{
|
||||
mRegisters[10 + findSeg] = sreg;
|
||||
if (segmap[findSeg] == 'S' && RegisterChangeEvent != null)
|
||||
RegisterChangeEvent(this, new RegisterChangeEventArgs(mRegisters));
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} catch (Exception) { /* Error line ... we'll ignore it for now */ }
|
||||
}
|
||||
}
|
||||
|
||||
if (tookText)
|
||||
{
|
||||
lock (mCommandBuffer)
|
||||
{
|
||||
if (mCommandBuffer.Count > 0)
|
||||
{
|
||||
string firstCommand = mCommandBuffer[0];
|
||||
mCommandBuffer.RemoveAt(0);
|
||||
mConnection.Write(firstCommand + "\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBreakpoint(Breakpoint bp)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveBreakpoint(Breakpoint bp)
|
||||
{
|
||||
}
|
||||
|
||||
public event ConsoleOutputEventHandler ConsoleOutputEvent;
|
||||
public event RegisterChangeEventHandler RegisterChangeEvent;
|
||||
public event SignalDeliveredEventHandler SignalDeliveredEvent;
|
||||
public event RemoteGDBErrorHandler RemoteGDBError;
|
||||
public event MemoryUpdateEventHandler MemoryUpdateEvent;
|
||||
public event ModuleListEventHandler ModuleListEvent;
|
||||
|
||||
public void GetRegisterUpdate()
|
||||
{
|
||||
QueueCommand("regs");
|
||||
QueueCommand("sregs");
|
||||
}
|
||||
|
||||
public void GetModuleUpdate()
|
||||
{
|
||||
QueueCommand("mod");
|
||||
}
|
||||
|
||||
public void GetMemoryUpdate(ulong address, int len)
|
||||
{
|
||||
QueueCommand(string.Format("x 0x{0:X} L {1}", address, len));
|
||||
}
|
||||
|
||||
public void WriteMemory(ulong address, byte[] buf)
|
||||
{
|
||||
}
|
||||
|
||||
public void QueueCommand(string command)
|
||||
{
|
||||
lock (mCommandBuffer)
|
||||
{
|
||||
mCommandBuffer.Add(command);
|
||||
if (mCommandBuffer.Count == 1)
|
||||
mConnection.Write(command + "\r");
|
||||
}
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
QueueCommand("step");
|
||||
GetRegisterUpdate();
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
QueueCommand("next");
|
||||
GetRegisterUpdate();
|
||||
}
|
||||
|
||||
public void Break()
|
||||
{
|
||||
mConnection.Write("\r");
|
||||
GetRegisterUpdate();
|
||||
}
|
||||
|
||||
public void Go(ulong address)
|
||||
{
|
||||
mRunning = true;
|
||||
QueueCommand("cont");
|
||||
}
|
||||
|
||||
public void Write(string wr) { mConnection.Write(wr); }
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
19
DebugProtocol/MemoryBlock.cs
Normal file
19
DebugProtocol/MemoryBlock.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
public class MemoryBlock
|
||||
{
|
||||
public readonly long Address;
|
||||
public readonly byte[] Block;
|
||||
static int mMemoryBlockSize = 256;
|
||||
public MemoryBlock(long address)
|
||||
{
|
||||
Address = address;
|
||||
Block = new byte[mMemoryBlockSize];
|
||||
}
|
||||
}
|
||||
}
|
36
DebugProtocol/Properties/AssemblyInfo.cs
Normal file
36
DebugProtocol/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DebugProtocol")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DebugProtocol")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("47790402-dacc-4e5c-b956-cc1205eadaab")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
29
DebugProtocol/Registers.cs
Normal file
29
DebugProtocol/Registers.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DebugProtocol
|
||||
{
|
||||
public class Registers
|
||||
{
|
||||
public ulong Eax { get { return RegisterSet[0]; } set { RegisterSet[0] = value; } }
|
||||
public ulong Ecx { get { return RegisterSet[1]; } set { RegisterSet[1] = value; } }
|
||||
public ulong Edx { get { return RegisterSet[2]; } set { RegisterSet[2] = value; } }
|
||||
public ulong Ebx { get { return RegisterSet[3]; } set { RegisterSet[3] = value; } }
|
||||
public ulong Esp { get { return RegisterSet[4]; } set { RegisterSet[4] = value; } }
|
||||
public ulong Ebp { get { return RegisterSet[5]; } set { RegisterSet[5] = value; } }
|
||||
public ulong Esi { get { return RegisterSet[6]; } set { RegisterSet[6] = value; } }
|
||||
public ulong Edi { get { return RegisterSet[7]; } set { RegisterSet[7] = value; } }
|
||||
public ulong Eip { get { return RegisterSet[8]; } set { RegisterSet[8] = value; } }
|
||||
public ulong Eflags { get { return RegisterSet[9]; } set { RegisterSet[9] = value; } }
|
||||
public ulong Cs { get { return RegisterSet[10]; } set { RegisterSet[10] = value; } }
|
||||
public ulong Ds { get { return RegisterSet[11]; } set { RegisterSet[11] = value; } }
|
||||
public ulong Es { get { return RegisterSet[12]; } set { RegisterSet[12] = value; } }
|
||||
public ulong Fs { get { return RegisterSet[13]; } set { RegisterSet[13] = value; } }
|
||||
public ulong Gs { get { return RegisterSet[14]; } set { RegisterSet[14] = value; } }
|
||||
public ulong Ss { get { return RegisterSet[15]; } set { RegisterSet[15] = value; } }
|
||||
public ulong[] RegisterSet = new ulong[32];
|
||||
}
|
||||
}
|
60
Pipe/Pipe.csproj
Normal file
60
Pipe/Pipe.csproj
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F943218A-0A5E-436E-A7A4-475F37F45FA8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Pipe</RootNamespace>
|
||||
<AssemblyName>Pipe</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="pipe.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="socketpipe.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
Pipe/Properties/AssemblyInfo.cs
Normal file
36
Pipe/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Pipe")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Pipe")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("829e9727-eae7-4365-866a-7079b2a5ef6c")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
34
Pipe/pipe.cs
Normal file
34
Pipe/pipe.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AbstractPipe
|
||||
{
|
||||
public class PipeReceiveEventArgs
|
||||
{
|
||||
public readonly string Received;
|
||||
public PipeReceiveEventArgs(string received)
|
||||
{
|
||||
Received = received;
|
||||
}
|
||||
}
|
||||
public delegate void PipeReceiveEventHandler(object sender, PipeReceiveEventArgs args);
|
||||
|
||||
public class PipeErrorEventArgs
|
||||
{
|
||||
public readonly string ErrorDesc;
|
||||
public PipeErrorEventArgs(string error)
|
||||
{
|
||||
ErrorDesc = error;
|
||||
}
|
||||
}
|
||||
public delegate void PipeErrorEventHandler(object sender, PipeErrorEventArgs args);
|
||||
|
||||
public interface Pipe
|
||||
{
|
||||
event PipeReceiveEventHandler PipeReceiveEvent;
|
||||
event PipeErrorEventHandler PipeErrorEvent;
|
||||
bool Write(string output);
|
||||
}
|
||||
}
|
75
Pipe/socketpipe.cs
Normal file
75
Pipe/socketpipe.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace AbstractPipe
|
||||
{
|
||||
public class SocketPipe : Pipe
|
||||
{
|
||||
Socket mSocket;
|
||||
byte []mBuf = new byte[4096];
|
||||
IAsyncResult mResult;
|
||||
|
||||
public event PipeReceiveEventHandler PipeReceiveEvent;
|
||||
public event PipeErrorEventHandler PipeErrorEvent;
|
||||
|
||||
public bool Write(string output)
|
||||
{
|
||||
if (mSocket == null) return false;
|
||||
try
|
||||
{
|
||||
byte[] outbuf = UTF8Encoding.UTF8.GetBytes(output);
|
||||
int off = 0, res;
|
||||
do
|
||||
{
|
||||
res = mSocket.Send(outbuf, off, outbuf.Length - off, SocketFlags.None);
|
||||
if (res > 0)
|
||||
off += res;
|
||||
}
|
||||
while (off < outbuf.Length && res != -1);
|
||||
return off == outbuf.Length;
|
||||
}
|
||||
catch (System.Net.Sockets.SocketException se)
|
||||
{
|
||||
mSocket.Close();
|
||||
if (PipeErrorEvent != null)
|
||||
PipeErrorEvent.Invoke(this, new PipeErrorEventArgs(se.Message));
|
||||
return false;
|
||||
}
|
||||
catch (Exception) { return false; }
|
||||
}
|
||||
|
||||
public void TriggerReadable(IAsyncResult result)
|
||||
{
|
||||
try
|
||||
{
|
||||
int bytes = mSocket.EndReceive(result);
|
||||
string datastr = UTF8Encoding.UTF8.GetString(mBuf, 0, bytes);
|
||||
if (PipeReceiveEvent != null)
|
||||
PipeReceiveEvent.Invoke(this, new PipeReceiveEventArgs(datastr));
|
||||
do
|
||||
{
|
||||
mResult = mSocket.BeginReceive
|
||||
(mBuf, 0, mBuf.Length, SocketFlags.None, TriggerReadable, this);
|
||||
} while (mResult.CompletedSynchronously);
|
||||
|
||||
}
|
||||
catch (System.Net.Sockets.SocketException se)
|
||||
{
|
||||
mSocket.Close();
|
||||
if (PipeErrorEvent != null)
|
||||
PipeErrorEvent.Invoke(this, new PipeErrorEventArgs(se.Message));
|
||||
}
|
||||
}
|
||||
|
||||
public SocketPipe(Socket socket)
|
||||
{
|
||||
mSocket = socket;
|
||||
do
|
||||
{
|
||||
mResult = mSocket.BeginReceive
|
||||
(mBuf, 0, mBuf.Length, SocketFlags.None, TriggerReadable, this);
|
||||
} while (mResult.CompletedSynchronously);
|
||||
}
|
||||
}
|
||||
}
|
38
ReactosDBG.sln
Normal file
38
ReactosDBG.sln
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosDBG", "RosDBG\RosDBG.csproj", "{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebugProtocol", "DebugProtocol\DebugProtocol.csproj", "{76A02C1D-4B11-4D43-966E-E5C053870D65}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pipe", "Pipe\Pipe.csproj", "{F943218A-0A5E-436E-A7A4-475F37F45FA8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbgHelp", "DbgHelp\DbgHelp.csproj", "{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{76A02C1D-4B11-4D43-966E-E5C053870D65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{76A02C1D-4B11-4D43-966E-E5C053870D65}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{76A02C1D-4B11-4D43-966E-E5C053870D65}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{76A02C1D-4B11-4D43-966E-E5C053870D65}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F943218A-0A5E-436E-A7A4-475F37F45FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F943218A-0A5E-436E-A7A4-475F37F45FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F943218A-0A5E-436E-A7A4-475F37F45FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F943218A-0A5E-436E-A7A4-475F37F45FA8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
61
RosDBG/BackTrace.Designer.cs
generated
Normal file
61
RosDBG/BackTrace.Designer.cs
generated
Normal file
@ -0,0 +1,61 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class BackTrace
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.StackFrames = new System.Windows.Forms.ListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// StackFrames
|
||||
//
|
||||
this.StackFrames.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.StackFrames.FormattingEnabled = true;
|
||||
this.StackFrames.Location = new System.Drawing.Point(0, 0);
|
||||
this.StackFrames.Name = "StackFrames";
|
||||
this.StackFrames.Size = new System.Drawing.Size(257, 264);
|
||||
this.StackFrames.TabIndex = 0;
|
||||
this.StackFrames.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.StackFrames_MouseDoubleClick);
|
||||
this.StackFrames.SelectedIndexChanged += new System.EventHandler(this.StackFrames_SelectedIndexChanged);
|
||||
//
|
||||
// BackTrace
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.StackFrames);
|
||||
this.Name = "BackTrace";
|
||||
this.Size = new System.Drawing.Size(257, 265);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox StackFrames;
|
||||
|
||||
}
|
||||
}
|
147
RosDBG/BackTrace.cs
Normal file
147
RosDBG/BackTrace.cs
Normal file
@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using DbgHelpAPI;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl, BuildAtStartup]
|
||||
public partial class BackTrace : UserControl, IUseDebugConnection, IUseSymbols, IUseShell
|
||||
{
|
||||
DebugConnection mConnection;
|
||||
SymbolContext mSymbols;
|
||||
IShell mShell;
|
||||
ulong mSelectedAddr;
|
||||
ulong mCurrentEbp, mCurrentEip, mChaseEbpValue;
|
||||
bool mRunning = true, mInProgress;
|
||||
List<ulong> mStackFramesToAdd = new List<ulong>();
|
||||
|
||||
public BackTrace()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetShell(IShell shell)
|
||||
{
|
||||
mShell = shell;
|
||||
UpdateBackTrace();
|
||||
}
|
||||
|
||||
void DumpStackFrames()
|
||||
{
|
||||
lock (mStackFramesToAdd)
|
||||
{
|
||||
foreach (ulong addr in mStackFramesToAdd)
|
||||
{
|
||||
KeyValuePair<string, int> sourceLine = mSymbols.GetFileAndLine(addr);
|
||||
if (sourceLine.Key != "unknown")
|
||||
StackFrames.Items.Add(string.Format("{0:X8} {1}:{2}", addr, sourceLine.Key, sourceLine.Value));
|
||||
else
|
||||
StackFrames.Items.Add(string.Format("{0:X8} ?", addr));
|
||||
}
|
||||
mStackFramesToAdd.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void TraceOneFrame(object dummy)
|
||||
{
|
||||
DebugMemoryStream mem = mConnection.NewMemoryStream();
|
||||
BinaryReader rdr = new BinaryReader(mem);
|
||||
try
|
||||
{
|
||||
mem.Seek((long)mChaseEbpValue, SeekOrigin.Begin);
|
||||
ulong chaseEbpValue = rdr.ReadUInt32();
|
||||
ulong returnAddr = rdr.ReadUInt32();
|
||||
lock (mStackFramesToAdd)
|
||||
{
|
||||
mStackFramesToAdd.Add(returnAddr);
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "DumpStackFrames"));
|
||||
if (chaseEbpValue != 0 && chaseEbpValue > mChaseEbpValue)
|
||||
{
|
||||
mChaseEbpValue = chaseEbpValue;
|
||||
ThreadPool.QueueUserWorkItem(TraceOneFrame);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
mInProgress = false;
|
||||
}
|
||||
|
||||
void PerformBacktrace()
|
||||
{
|
||||
mInProgress = true;
|
||||
StackFrames.Items.Clear();
|
||||
mChaseEbpValue = mCurrentEbp;
|
||||
lock (mStackFramesToAdd)
|
||||
{
|
||||
mStackFramesToAdd.Add(mCurrentEip);
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "DumpStackFrames"));
|
||||
ThreadPool.QueueUserWorkItem(TraceOneFrame);
|
||||
}
|
||||
|
||||
public void UpdateBackTrace()
|
||||
{
|
||||
if (!(mConnection == null || mSymbols == null || mShell == null || mRunning || mInProgress))
|
||||
{
|
||||
mInProgress = true;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "PerformBacktrace"));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
mConnection.DebugRegisterChangeEvent += DebugRegisterChangeEvent;
|
||||
mConnection.DebugRunningChangeEvent += DebugRunningChangeEvent;
|
||||
mConnection.DebugModuleChangedEvent += DebugModuleChangedEvent;
|
||||
UpdateBackTrace();
|
||||
}
|
||||
|
||||
void DebugModuleChangedEvent(object sender, DebugModuleChangedEventArgs args)
|
||||
{
|
||||
UpdateBackTrace();
|
||||
}
|
||||
|
||||
void DebugRegisterChangeEvent(object sender, DebugRegisterChangeEventArgs args)
|
||||
{
|
||||
mCurrentEip = args.Registers.Eip;
|
||||
mCurrentEbp = args.Registers.Ebp;
|
||||
UpdateBackTrace();
|
||||
}
|
||||
|
||||
void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
|
||||
{
|
||||
mRunning = args.Running;
|
||||
}
|
||||
|
||||
public void SetSymbolProvider(SymbolContext context)
|
||||
{
|
||||
mSymbols = context;
|
||||
UpdateBackTrace();
|
||||
}
|
||||
|
||||
private void StackFrames_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string []parsedEntry = ((string)StackFrames.SelectedItem).Split(new char [] {' '});
|
||||
mSelectedAddr = ulong.Parse(parsedEntry[0], NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
private void StackFrames_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
mShell.FocusAddress(mSelectedAddr);
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/BackTrace.resx
Normal file
120
RosDBG/BackTrace.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
263
RosDBG/DebugConnection.cs
Normal file
263
RosDBG/DebugConnection.cs
Normal file
@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using AbstractPipe;
|
||||
using DebugProtocol;
|
||||
using KDBGProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class DebugConnectedEventArgs : EventArgs
|
||||
{
|
||||
public DebugConnectedEventArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void DebugConnectedEventHandler(object sender, DebugConnectedEventArgs args);
|
||||
|
||||
public class DebugConnectionModeChangedEventArgs : EventArgs
|
||||
{
|
||||
public readonly DebugConnection.Mode Mode;
|
||||
public DebugConnectionModeChangedEventArgs(DebugConnection.Mode mode)
|
||||
{
|
||||
Mode = mode;
|
||||
}
|
||||
}
|
||||
public delegate void DebugConnectionModeChangedEventHandler(object sender, DebugConnectionModeChangedEventArgs args);
|
||||
|
||||
public class DebugRegisterChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly Registers Registers;
|
||||
public DebugRegisterChangeEventArgs(Registers regs)
|
||||
{
|
||||
Registers = regs;
|
||||
}
|
||||
}
|
||||
public delegate void DebugRegisterChangeEventHandler(object sender, DebugRegisterChangeEventArgs args);
|
||||
|
||||
public class DebugRunningChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly bool Running;
|
||||
public DebugRunningChangeEventArgs(bool running) { Running = running; }
|
||||
}
|
||||
public delegate void DebugRunningChangeEventHandler(object sender, DebugRunningChangeEventArgs args);
|
||||
|
||||
public class DebugModuleChangedEventArgs : EventArgs
|
||||
{
|
||||
public readonly uint ModuleAddr;
|
||||
public readonly string ModuleName;
|
||||
public DebugModuleChangedEventArgs(uint moduleAddr, string moduleName)
|
||||
{
|
||||
ModuleAddr = moduleAddr;
|
||||
ModuleName = moduleName;
|
||||
}
|
||||
}
|
||||
public delegate void DebugModuleChangedEventHandler(object sender, DebugModuleChangedEventArgs args);
|
||||
|
||||
public class DebugRawTrafficEventArgs : EventArgs
|
||||
{
|
||||
public readonly string Data;
|
||||
public DebugRawTrafficEventArgs(string data) { Data = data; }
|
||||
}
|
||||
public delegate void DebugRawTrafficEventHandler(object sender, DebugRawTrafficEventArgs args);
|
||||
|
||||
public class DebugConnection
|
||||
{
|
||||
#region Primary State
|
||||
public enum Mode { ClosedMode, SocketMode }
|
||||
public Mode ConnectionMode
|
||||
{
|
||||
get { return mConnectionMode; }
|
||||
set
|
||||
{
|
||||
mConnectionMode = value;
|
||||
if (DebugConnectionModeChangedEvent != null)
|
||||
DebugConnectionModeChangedEvent(this, new DebugConnectionModeChangedEventArgs(value));
|
||||
}
|
||||
}
|
||||
public bool mRunning = true;
|
||||
public bool Running
|
||||
{
|
||||
get { return mRunning; }
|
||||
set
|
||||
{
|
||||
mRunning = value;
|
||||
if (DebugRunningChangeEvent != null)
|
||||
DebugRunningChangeEvent(this, new DebugRunningChangeEventArgs(value));
|
||||
}
|
||||
}
|
||||
KDBG mKdb;
|
||||
Registers mRegisters = new Registers();
|
||||
public IDebugProtocol Debugger { get { return mKdb; } }
|
||||
Pipe mMedium;
|
||||
Mode mConnectionMode;
|
||||
List<WeakReference> mMemoryReaders = new List<WeakReference>();
|
||||
#endregion
|
||||
|
||||
#region Socket Mode State
|
||||
int mRemotePort;
|
||||
Socket mSocket;
|
||||
SocketAsyncEventArgs mAsyncConnect;
|
||||
AsyncCallback mDnsLookup;
|
||||
IAsyncResult mDnsAsyncResult;
|
||||
#endregion
|
||||
|
||||
public event DebugRegisterChangeEventHandler DebugRegisterChangeEvent;
|
||||
public event DebugConnectedEventHandler DebugConnectionConnectedEvent;
|
||||
public event DebugConnectionModeChangedEventHandler DebugConnectionModeChangedEvent;
|
||||
public event DebugRunningChangeEventHandler DebugRunningChangeEvent;
|
||||
public event DebugModuleChangedEventHandler DebugModuleChangedEvent;
|
||||
public event DebugRawTrafficEventHandler DebugRawTrafficEvent;
|
||||
|
||||
public DebugConnection()
|
||||
{
|
||||
}
|
||||
|
||||
void DnsLookupResult(IAsyncResult result)
|
||||
{
|
||||
if (result.IsCompleted)
|
||||
{
|
||||
IPHostEntry entry = Dns.EndGetHostEntry(mDnsAsyncResult);
|
||||
if (entry.AddressList.Length > 0)
|
||||
{
|
||||
int i;
|
||||
// Check for an ipv4 target
|
||||
for (i = 0; i < entry.AddressList.Length; i++)
|
||||
if (entry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
|
||||
break;
|
||||
// Otherwise just fall back to the first one
|
||||
if (i == entry.AddressList.Length) i = 0;
|
||||
mAsyncConnect.RemoteEndPoint = new IPEndPoint(entry.AddressList[i], mRemotePort);
|
||||
mSocket.ConnectAsync(mAsyncConnect);
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(string host, int port)
|
||||
{
|
||||
Close();
|
||||
mRemotePort = port;
|
||||
ConnectionMode = Mode.SocketMode;
|
||||
mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
mAsyncConnect = new SocketAsyncEventArgs();
|
||||
mAsyncConnect.UserToken = this;
|
||||
mAsyncConnect.Completed += SocketConnectCompleted;
|
||||
mDnsLookup = new AsyncCallback(DnsLookupResult);
|
||||
mDnsAsyncResult = Dns.BeginGetHostEntry(host, mDnsLookup, this);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
switch (ConnectionMode)
|
||||
{
|
||||
case Mode.SocketMode:
|
||||
mSocket.Close();
|
||||
mSocket = null;
|
||||
break;
|
||||
}
|
||||
|
||||
mMedium = null;
|
||||
if (mKdb != null)
|
||||
mKdb.Close();
|
||||
mKdb = null;
|
||||
ConnectionMode = Mode.ClosedMode;
|
||||
}
|
||||
|
||||
void MediumError(object sender, PipeErrorEventArgs args)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void SocketConnectCompleted(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
if (mAsyncConnect.SocketError == SocketError.Success)
|
||||
{
|
||||
mMedium = new SocketPipe(mSocket);
|
||||
mMedium.PipeErrorEvent += MediumError;
|
||||
mMedium.PipeReceiveEvent += PipeReceiveEvent;
|
||||
mKdb = new KDBG(mMedium);
|
||||
mKdb.RegisterChangeEvent += RegisterChangeEvent;
|
||||
mKdb.ModuleListEvent += ModuleListEvent;
|
||||
mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
|
||||
Running = true;
|
||||
if (DebugConnectionConnectedEvent != null)
|
||||
DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
|
||||
}
|
||||
else
|
||||
Close();
|
||||
}
|
||||
|
||||
void MemoryUpdateEvent(object sender, MemoryUpdateEventArgs args)
|
||||
{
|
||||
List<WeakReference> deadStreams = new List<WeakReference>();
|
||||
|
||||
foreach (WeakReference memStreamRef in mMemoryReaders)
|
||||
{
|
||||
DebugMemoryStream memStream = memStreamRef.Target as DebugMemoryStream;
|
||||
|
||||
if (memStream == null)
|
||||
{
|
||||
deadStreams.Add(memStreamRef);
|
||||
continue;
|
||||
}
|
||||
|
||||
memStream.Update(args.Address, args.Memory);
|
||||
}
|
||||
}
|
||||
|
||||
void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
|
||||
{
|
||||
if (DebugRawTrafficEvent != null)
|
||||
DebugRawTrafficEvent(this, new DebugRawTrafficEventArgs(args.Received));
|
||||
}
|
||||
|
||||
void ModuleListEvent(object sender, ModuleListEventArgs args)
|
||||
{
|
||||
if (DebugModuleChangedEvent != null)
|
||||
DebugModuleChangedEvent(this, new DebugModuleChangedEventArgs((uint)args.Address, args.Module));
|
||||
}
|
||||
|
||||
void RegisterChangeEvent(object sender, RegisterChangeEventArgs args)
|
||||
{
|
||||
args.Registers.CopyTo(mRegisters.RegisterSet);
|
||||
Running = false;
|
||||
if (DebugRegisterChangeEvent != null)
|
||||
DebugRegisterChangeEvent(this, new DebugRegisterChangeEventArgs(mRegisters));
|
||||
}
|
||||
|
||||
public void Break()
|
||||
{
|
||||
if (mKdb != null)
|
||||
mKdb.Break();
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
Running = true;
|
||||
if (mKdb != null) mKdb.Step();
|
||||
Running = false;
|
||||
}
|
||||
|
||||
public void Go()
|
||||
{
|
||||
if (mKdb != null)
|
||||
{
|
||||
mKdb.Go(0);
|
||||
Running = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void NewMemoryStream(ulong baseAddr, int len)
|
||||
{
|
||||
mKdb.GetMemoryUpdate(baseAddr, len);
|
||||
}
|
||||
}
|
||||
}
|
15
RosDBG/DebugControlAttribute.cs
Normal file
15
RosDBG/DebugControlAttribute.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class DebugControlAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
public class BuildAtStartupAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
24
RosDBG/DebugInfoFile.cs
Normal file
24
RosDBG/DebugInfoFile.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class DebugInfoFile
|
||||
{
|
||||
BinaryReader mTheFile;
|
||||
public DebugInfoFile(BinaryReader reader)
|
||||
{
|
||||
mTheFile = reader;
|
||||
}
|
||||
|
||||
Int32 mImageBase;
|
||||
public Int32 ImageBase
|
||||
{
|
||||
get { return mImageBase; }
|
||||
set { mImageBase = value; }
|
||||
}
|
||||
}
|
||||
}
|
149
RosDBG/DebugMemoryStream.cs
Normal file
149
RosDBG/DebugMemoryStream.cs
Normal file
@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class DebugMemoryStream : Stream
|
||||
{
|
||||
DebugConnection mConnection;
|
||||
ulong mReadAddr;
|
||||
int mCopyOffset, mCopyCount;
|
||||
byte[] mReadBuffer;
|
||||
long[] mBytesReceived;
|
||||
EventWaitHandle mReadComplete = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return 1L << 32; }
|
||||
}
|
||||
|
||||
long mPosition;
|
||||
public override long Position
|
||||
{
|
||||
get { return mPosition; }
|
||||
set { mPosition = value; }
|
||||
}
|
||||
|
||||
public override void Flush() { }
|
||||
|
||||
public override long Seek(long position, SeekOrigin origin)
|
||||
{
|
||||
long prev = mPosition;
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
mPosition = position;
|
||||
break;
|
||||
|
||||
case SeekOrigin.Current:
|
||||
mPosition += position;
|
||||
break;
|
||||
|
||||
case SeekOrigin.End:
|
||||
mPosition = ((1L << 32) - position) & ((1L << 32) - 1);
|
||||
break;
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
public override void SetLength(long len) { }
|
||||
|
||||
int RoundUp(int count, int factor)
|
||||
{
|
||||
return (count + (factor - 1)) & (~factor - 1);
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
mReadAddr = (ulong)mPosition;
|
||||
mBytesReceived = new long[RoundUp(count, 64) / 64];
|
||||
SetBits(count, RoundUp(count, 64));
|
||||
mCopyOffset = offset;
|
||||
mCopyCount = count;
|
||||
mReadBuffer = buffer;
|
||||
mConnection.RequestMemory(mReadAddr, count);
|
||||
mReadComplete.WaitOne();
|
||||
return mCopyCount;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
}
|
||||
|
||||
void SetBits(int start, int end)
|
||||
{
|
||||
int longOfStart = start >> 6, longOfEnd = (end - 1) >> 6;
|
||||
if (longOfStart == longOfEnd)
|
||||
{
|
||||
start &= 63;
|
||||
end &= 63;
|
||||
mBytesReceived[longOfStart] |= -1 & ~((1L << start) - 1) & ((1L << end) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nextStart = (start + 64) & ~63;
|
||||
SetBits(start, nextStart);
|
||||
while (nextStart >> 6 != longOfEnd)
|
||||
{
|
||||
start = nextStart;
|
||||
nextStart = start + 64;
|
||||
SetBits(start, nextStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadComplete()
|
||||
{
|
||||
foreach (long l in mBytesReceived) if (l != -1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Update(ulong Address, byte[] Memory)
|
||||
{
|
||||
if (Address >= mReadAddr && Address < mReadAddr + (ulong)mCopyCount)
|
||||
{
|
||||
if (Memory == null)
|
||||
{
|
||||
int newCount = Math.Min((int)mCopyCount, (int)(Address - mReadAddr));
|
||||
SetBits(newCount, mCopyCount);
|
||||
mCopyCount = newCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bytesOffset = (int)(Address - (ulong)mPosition);
|
||||
int bytesCount = (int)Math.Min(mPosition + mCopyCount - (long)Address, Memory.Length);
|
||||
Array.Copy(Memory, 0, mReadBuffer, mCopyOffset, bytesCount);
|
||||
SetBits(bytesOffset, bytesOffset + bytesCount);
|
||||
if (ReadComplete()) mReadComplete.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DebugMemoryStream(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
}
|
||||
}
|
||||
}
|
26
RosDBG/HighLevelInteraction.cs
Normal file
26
RosDBG/HighLevelInteraction.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class BytesEventArgs : EventArgs
|
||||
{
|
||||
byte []mBytes;
|
||||
public byte []Bytes { get { return mBytes; } }
|
||||
public BytesEventArgs(byte []bytes)
|
||||
{
|
||||
mBytes = bytes;
|
||||
}
|
||||
}
|
||||
public interface BidirectionalChannel
|
||||
{
|
||||
}
|
||||
|
||||
public class HighLevelInteraction
|
||||
{
|
||||
|
||||
}
|
||||
}
|
116
RosDBG/HostWindow.Designer.cs
generated
Normal file
116
RosDBG/HostWindow.Designer.cs
generated
Normal file
@ -0,0 +1,116 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class HostWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ContentSplitter = new System.Windows.Forms.SplitContainer();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.redockToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ContentSplitter.Panel1.SuspendLayout();
|
||||
this.ContentSplitter.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ContentSplitter
|
||||
//
|
||||
this.ContentSplitter.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ContentSplitter.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.ContentSplitter.IsSplitterFixed = true;
|
||||
this.ContentSplitter.Location = new System.Drawing.Point(0, 0);
|
||||
this.ContentSplitter.Name = "ContentSplitter";
|
||||
this.ContentSplitter.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// ContentSplitter.Panel1
|
||||
//
|
||||
this.ContentSplitter.Panel1.Controls.Add(this.menuStrip1);
|
||||
this.ContentSplitter.Size = new System.Drawing.Size(292, 273);
|
||||
this.ContentSplitter.SplitterDistance = 25;
|
||||
this.ContentSplitter.TabIndex = 0;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.windowToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// windowToolStripMenuItem
|
||||
//
|
||||
this.windowToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.redockToolStripMenuItem,
|
||||
this.closeToolStripMenuItem});
|
||||
this.windowToolStripMenuItem.Name = "windowToolStripMenuItem";
|
||||
this.windowToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
|
||||
this.windowToolStripMenuItem.Text = "Window";
|
||||
//
|
||||
// redockToolStripMenuItem
|
||||
//
|
||||
this.redockToolStripMenuItem.Name = "redockToolStripMenuItem";
|
||||
this.redockToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.redockToolStripMenuItem.Text = "Redock";
|
||||
this.redockToolStripMenuItem.Click += new System.EventHandler(this.redockToolStripMenuItem_Click);
|
||||
//
|
||||
// closeToolStripMenuItem
|
||||
//
|
||||
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
||||
this.closeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.closeToolStripMenuItem.Text = "Close";
|
||||
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
|
||||
//
|
||||
// HostWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(292, 273);
|
||||
this.Controls.Add(this.ContentSplitter);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "HostWindow";
|
||||
this.Text = "HostWindow";
|
||||
this.ContentSplitter.Panel1.ResumeLayout(false);
|
||||
this.ContentSplitter.Panel1.PerformLayout();
|
||||
this.ContentSplitter.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer ContentSplitter;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem redockToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
|
||||
}
|
||||
}
|
60
RosDBG/HostWindow.cs
Normal file
60
RosDBG/HostWindow.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public partial class HostWindow : Form
|
||||
{
|
||||
public HostWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public delegate void RedockControlEventHandler(object sender, RedockControlEventArgs args);
|
||||
public event RedockControlEventHandler RedockControlEvent;
|
||||
|
||||
public Control Content
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ContentSplitter.Panel2.Controls.Count > 0)
|
||||
return ContentSplitter.Panel2.Controls[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
ContentSplitter.Panel2.Controls.Clear();
|
||||
if (value != null)
|
||||
ContentSplitter.Panel2.Controls.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void redockToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
RedockControlEventArgs args = new RedockControlEventArgs(Content);
|
||||
Content = null;
|
||||
if (RedockControlEvent != null)
|
||||
RedockControlEvent(this, args);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class RedockControlEventArgs : EventArgs
|
||||
{
|
||||
Control mControl;
|
||||
public Control Control { get { return mControl; } }
|
||||
public RedockControlEventArgs(Control ctrl) { mControl = ctrl; }
|
||||
}
|
||||
}
|
123
RosDBG/HostWindow.resx
Normal file
123
RosDBG/HostWindow.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
17
RosDBG/IShell.cs
Normal file
17
RosDBG/IShell.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public interface IShell
|
||||
{
|
||||
void FocusAddress(ulong address);
|
||||
}
|
||||
|
||||
public interface IUseShell
|
||||
{
|
||||
void SetShell(IShell shell);
|
||||
}
|
||||
}
|
13
RosDBG/IUseDebugConnection.cs
Normal file
13
RosDBG/IUseDebugConnection.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public interface IUseDebugConnection
|
||||
{
|
||||
void SetDebugConnection(DebugConnection conn);
|
||||
}
|
||||
}
|
13
RosDBG/IUseSymbols.cs
Normal file
13
RosDBG/IUseSymbols.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DbgHelpAPI;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public interface IUseSymbols
|
||||
{
|
||||
void SetSymbolProvider(SymbolContext symcon);
|
||||
}
|
||||
}
|
64
RosDBG/Locals.Designer.cs
generated
Normal file
64
RosDBG/Locals.Designer.cs
generated
Normal file
@ -0,0 +1,64 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class Locals
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.LocalDataGrid = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LocalDataGrid)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// LocalDataGrid
|
||||
//
|
||||
this.LocalDataGrid.AllowUserToAddRows = false;
|
||||
this.LocalDataGrid.AllowUserToDeleteRows = false;
|
||||
this.LocalDataGrid.AutoGenerateColumns = true;
|
||||
this.LocalDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.LocalDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.LocalDataGrid.Location = new System.Drawing.Point(0, 0);
|
||||
this.LocalDataGrid.Name = "LocalDataGrid";
|
||||
this.LocalDataGrid.ReadOnly = true;
|
||||
this.LocalDataGrid.Size = new System.Drawing.Size(428, 257);
|
||||
this.LocalDataGrid.TabIndex = 0;
|
||||
//
|
||||
// Locals
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.LocalDataGrid);
|
||||
this.Name = "Locals";
|
||||
this.Size = new System.Drawing.Size(428, 257);
|
||||
((System.ComponentModel.ISupportInitialize)(this.LocalDataGrid)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView LocalDataGrid;
|
||||
}
|
||||
}
|
286
RosDBG/Locals.cs
Normal file
286
RosDBG/Locals.cs
Normal file
@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using DebugProtocol;
|
||||
using DbgHelpAPI;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl, BuildAtStartup]
|
||||
public partial class Locals : UserControl, IUseDebugConnection, IUseSymbols, IUseShell
|
||||
{
|
||||
class DisplayValue
|
||||
{
|
||||
DebugConnection mConnection;
|
||||
Registers mRegisters;
|
||||
Variable mVariable;
|
||||
BinaryReader mReader;
|
||||
|
||||
string mName;
|
||||
public string Name
|
||||
{
|
||||
get { return mName; }
|
||||
}
|
||||
|
||||
ulong GetRegisterValue(Variable.Register reg)
|
||||
{
|
||||
ulong result;
|
||||
|
||||
switch (reg)
|
||||
{
|
||||
case Variable.Register.CV_REG_AL:
|
||||
case Variable.Register.CV_REG_AH:
|
||||
case Variable.Register.CV_REG_AX:
|
||||
case Variable.Register.CV_REG_EAX:
|
||||
result = mRegisters.Eax;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_CL:
|
||||
case Variable.Register.CV_REG_CH:
|
||||
case Variable.Register.CV_REG_CX:
|
||||
case Variable.Register.CV_REG_ECX:
|
||||
result = mRegisters.Ecx;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_DL:
|
||||
case Variable.Register.CV_REG_DH:
|
||||
case Variable.Register.CV_REG_DX:
|
||||
case Variable.Register.CV_REG_EDX:
|
||||
result = mRegisters.Edx;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_BL:
|
||||
case Variable.Register.CV_REG_BH:
|
||||
case Variable.Register.CV_REG_BX:
|
||||
case Variable.Register.CV_REG_EBX:
|
||||
result = mRegisters.Ebx;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_SP:
|
||||
case Variable.Register.CV_REG_ESP:
|
||||
result = mRegisters.Esp;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_BP:
|
||||
case Variable.Register.CV_REG_EBP:
|
||||
result = mRegisters.Ebp;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_SI:
|
||||
case Variable.Register.CV_REG_ESI:
|
||||
result = mRegisters.Esi;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_DI:
|
||||
case Variable.Register.CV_REG_EDI:
|
||||
result = mRegisters.Edi;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_ES:
|
||||
result = mRegisters.Es;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_CS:
|
||||
result = mRegisters.Cs;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_SS:
|
||||
result = mRegisters.Ss;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_DS:
|
||||
result = mRegisters.Ds;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_FS:
|
||||
result = mRegisters.Fs;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_GS:
|
||||
result = mRegisters.Gs;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_IP:
|
||||
case Variable.Register.CV_REG_EIP:
|
||||
result = mRegisters.Eip;
|
||||
break;
|
||||
|
||||
case Variable.Register.CV_REG_FLAGS:
|
||||
case Variable.Register.CV_REG_EFLAGS:
|
||||
result = mRegisters.Eflags;
|
||||
break;
|
||||
|
||||
default:
|
||||
Trace.Assert(false);
|
||||
return mRegisters.Eax;
|
||||
}
|
||||
|
||||
switch (reg)
|
||||
{
|
||||
case Variable.Register.CV_REG_AL:
|
||||
case Variable.Register.CV_REG_CL:
|
||||
case Variable.Register.CV_REG_DL:
|
||||
case Variable.Register.CV_REG_BL:
|
||||
return result & 0xff;
|
||||
|
||||
case Variable.Register.CV_REG_AH:
|
||||
case Variable.Register.CV_REG_CH:
|
||||
case Variable.Register.CV_REG_DH:
|
||||
case Variable.Register.CV_REG_BH:
|
||||
return (result >> 8) & 0xff;
|
||||
|
||||
case Variable.Register.CV_REG_AX:
|
||||
case Variable.Register.CV_REG_CX:
|
||||
case Variable.Register.CV_REG_DX:
|
||||
case Variable.Register.CV_REG_BX:
|
||||
case Variable.Register.CV_REG_SP:
|
||||
case Variable.Register.CV_REG_BP:
|
||||
case Variable.Register.CV_REG_SI:
|
||||
case Variable.Register.CV_REG_DI:
|
||||
case Variable.Register.CV_REG_ES:
|
||||
case Variable.Register.CV_REG_CS:
|
||||
case Variable.Register.CV_REG_SS:
|
||||
return result & 0xffff;
|
||||
|
||||
default:
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
string mValue;
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayValue(DebugConnection conn, Registers reg, Variable var)
|
||||
{
|
||||
mName = var.Name;
|
||||
mConnection = conn;
|
||||
mRegisters = reg;
|
||||
mVariable = var;
|
||||
mReader = new BinaryReader(mConnection.NewMemoryStream());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ulong regVal;
|
||||
byte[] buf = new byte[mVariable.Size];
|
||||
|
||||
if (mVariable.Regval)
|
||||
{
|
||||
regVal = GetRegisterValue(mVariable.Reg);
|
||||
sb.Append(string.Format("{0:X}", regVal));
|
||||
mValue = sb.ToString();
|
||||
return;
|
||||
}
|
||||
else if (mVariable.Regrel)
|
||||
{
|
||||
regVal = GetRegisterValue(mVariable.Reg);
|
||||
mReader.BaseStream.Seek((long)regVal + mVariable.Offset, SeekOrigin.Begin);
|
||||
mReader.Read(buf, 0, buf.Length);
|
||||
}
|
||||
else if (mVariable.Local || mVariable.Parameter)
|
||||
{
|
||||
mReader.BaseStream.Seek(mVariable.Offset, SeekOrigin.Begin);
|
||||
mReader.Read(buf, 0, buf.Length);
|
||||
}
|
||||
if (buf.Length == 4)
|
||||
{
|
||||
sb.Append(string.Format("{3:X2}{2:X2}{1:X2}{0:X2}",
|
||||
buf[0], buf[1], buf[2], buf[3]));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (byte b in buf)
|
||||
sb.Append(string.Format("{0:X2} ", (int)b));
|
||||
}
|
||||
mValue = sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, Variable> mVariables = new Dictionary<string, Variable>();
|
||||
|
||||
public Locals()
|
||||
{
|
||||
InitializeComponent();
|
||||
LocalDataGrid.DataSource = mDisplaySet;
|
||||
}
|
||||
|
||||
Registers mRegisters;
|
||||
DebugConnection mConnection;
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
mConnection.DebugRegisterChangeEvent += DebugRegisterChangeEvent;
|
||||
mConnection.DebugRunningChangeEvent += DebugRunningChangeEvent;
|
||||
mConnection.DebugModuleChangedEvent += DebugModuleChangedEvent;
|
||||
}
|
||||
|
||||
Dictionary<string, DisplayValue> mDisplaySet = new Dictionary<string, DisplayValue>();
|
||||
|
||||
void UpdateGrid()
|
||||
{
|
||||
LocalDataGrid.DataSource = new List<DisplayValue>(mDisplaySet.Values);
|
||||
}
|
||||
|
||||
void ResolveVariable(object var)
|
||||
{
|
||||
Variable v = (Variable)var;
|
||||
DisplayValue dispVal = new DisplayValue(mConnection, mRegisters, v);
|
||||
lock (mDisplaySet)
|
||||
{
|
||||
mDisplaySet[dispVal.Name] = dispVal;
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "UpdateGrid"));
|
||||
}
|
||||
|
||||
void UpdateLocals()
|
||||
{
|
||||
if (mRegisters != null)
|
||||
{
|
||||
List<Variable> vars = mSymbols.GetLocals(mRegisters.Eip);
|
||||
foreach (Variable var in vars)
|
||||
ThreadPool.QueueUserWorkItem(ResolveVariable, var);
|
||||
}
|
||||
}
|
||||
|
||||
void DebugModuleChangedEvent(object sender, DebugModuleChangedEventArgs args)
|
||||
{
|
||||
UpdateLocals();
|
||||
}
|
||||
|
||||
void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
|
||||
{
|
||||
UpdateLocals();
|
||||
}
|
||||
|
||||
void DebugRegisterChangeEvent(object sender, DebugRegisterChangeEventArgs args)
|
||||
{
|
||||
mRegisters = args.Registers;
|
||||
UpdateLocals();
|
||||
}
|
||||
|
||||
IShell mShell;
|
||||
public void SetShell(IShell shell)
|
||||
{
|
||||
mShell = shell;
|
||||
}
|
||||
|
||||
SymbolContext mSymbols;
|
||||
public void SetSymbolProvider(SymbolContext symbols)
|
||||
{
|
||||
mSymbols = symbols;
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/Locals.resx
Normal file
120
RosDBG/Locals.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
383
RosDBG/MainWindow.Designer.cs
generated
Normal file
383
RosDBG/MainWindow.Designer.cs
generated
Normal file
@ -0,0 +1,383 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class MainWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openSourceFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addSymbolFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.symbolDirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.connectSerialToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.connectPipeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.connectTCPIPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pasteToInteractionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.memoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.continueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bugcheckToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.breakToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stepToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.breakHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.breakpointClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.followListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NewWindowItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.detachCurrentTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.closeCurrentTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.WorkTabs = new System.Windows.Forms.TabControl();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.RunStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.IsSplitterFixed = true;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.menuStrip1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(529, 416);
|
||||
this.splitContainer1.SplitterDistance = 26;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.editToolStripMenuItem,
|
||||
this.debugToolStripMenuItem,
|
||||
this.windowToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(529, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.openSourceFileToolStripMenuItem,
|
||||
this.addSymbolFileToolStripMenuItem,
|
||||
this.symbolDirectoryToolStripMenuItem,
|
||||
this.connectSerialToolStripMenuItem,
|
||||
this.connectPipeToolStripMenuItem,
|
||||
this.connectTCPIPToolStripMenuItem,
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// openSourceFileToolStripMenuItem
|
||||
//
|
||||
this.openSourceFileToolStripMenuItem.Name = "openSourceFileToolStripMenuItem";
|
||||
this.openSourceFileToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.openSourceFileToolStripMenuItem.Text = "Open Source File ...";
|
||||
//
|
||||
// addSymbolFileToolStripMenuItem
|
||||
//
|
||||
this.addSymbolFileToolStripMenuItem.Name = "addSymbolFileToolStripMenuItem";
|
||||
this.addSymbolFileToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.addSymbolFileToolStripMenuItem.Text = "Add Symbol File ...";
|
||||
//
|
||||
// symbolDirectoryToolStripMenuItem
|
||||
//
|
||||
this.symbolDirectoryToolStripMenuItem.Name = "symbolDirectoryToolStripMenuItem";
|
||||
this.symbolDirectoryToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.symbolDirectoryToolStripMenuItem.Text = "Symbol Path ...";
|
||||
//
|
||||
// connectSerialToolStripMenuItem
|
||||
//
|
||||
this.connectSerialToolStripMenuItem.Name = "connectSerialToolStripMenuItem";
|
||||
this.connectSerialToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.connectSerialToolStripMenuItem.Text = "Connect Serial ...";
|
||||
//
|
||||
// connectPipeToolStripMenuItem
|
||||
//
|
||||
this.connectPipeToolStripMenuItem.Name = "connectPipeToolStripMenuItem";
|
||||
this.connectPipeToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.connectPipeToolStripMenuItem.Text = "Connect Pipe ...";
|
||||
//
|
||||
// connectTCPIPToolStripMenuItem
|
||||
//
|
||||
this.connectTCPIPToolStripMenuItem.Name = "connectTCPIPToolStripMenuItem";
|
||||
this.connectTCPIPToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.connectTCPIPToolStripMenuItem.Text = "Connect TCP/IP ...";
|
||||
this.connectTCPIPToolStripMenuItem.Click += new System.EventHandler(this.connectTCPIPToolStripMenuItem_Click);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.copyToolStripMenuItem,
|
||||
this.pasteToInteractionToolStripMenuItem,
|
||||
this.memoryToolStripMenuItem});
|
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||
this.editToolStripMenuItem.Text = "Edit";
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
//
|
||||
// pasteToInteractionToolStripMenuItem
|
||||
//
|
||||
this.pasteToInteractionToolStripMenuItem.Name = "pasteToInteractionToolStripMenuItem";
|
||||
this.pasteToInteractionToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||
this.pasteToInteractionToolStripMenuItem.Text = "Paste to Interaction";
|
||||
//
|
||||
// memoryToolStripMenuItem
|
||||
//
|
||||
this.memoryToolStripMenuItem.Name = "memoryToolStripMenuItem";
|
||||
this.memoryToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||
this.memoryToolStripMenuItem.Text = "Memory at Clipboard";
|
||||
//
|
||||
// debugToolStripMenuItem
|
||||
//
|
||||
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.continueToolStripMenuItem,
|
||||
this.bugcheckToolStripMenuItem,
|
||||
this.breakToolStripMenuItem,
|
||||
this.stepToolStripMenuItem,
|
||||
this.breakHereToolStripMenuItem,
|
||||
this.breakpointClipboardToolStripMenuItem,
|
||||
this.followListToolStripMenuItem});
|
||||
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
|
||||
this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||
this.debugToolStripMenuItem.Text = "Debug";
|
||||
//
|
||||
// continueToolStripMenuItem
|
||||
//
|
||||
this.continueToolStripMenuItem.Name = "continueToolStripMenuItem";
|
||||
this.continueToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.continueToolStripMenuItem.Text = "Continue";
|
||||
this.continueToolStripMenuItem.Click += new System.EventHandler(this.continueToolStripMenuItem_Click);
|
||||
//
|
||||
// bugcheckToolStripMenuItem
|
||||
//
|
||||
this.bugcheckToolStripMenuItem.Name = "bugcheckToolStripMenuItem";
|
||||
this.bugcheckToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.bugcheckToolStripMenuItem.Text = "Bugcheck";
|
||||
//
|
||||
// breakToolStripMenuItem
|
||||
//
|
||||
this.breakToolStripMenuItem.Name = "breakToolStripMenuItem";
|
||||
this.breakToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.breakToolStripMenuItem.Text = "Break";
|
||||
this.breakToolStripMenuItem.Click += new System.EventHandler(this.breakToolStripMenuItem_Click);
|
||||
//
|
||||
// stepToolStripMenuItem
|
||||
//
|
||||
this.stepToolStripMenuItem.Name = "stepToolStripMenuItem";
|
||||
this.stepToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.stepToolStripMenuItem.Text = "Step";
|
||||
this.stepToolStripMenuItem.Click += new System.EventHandler(this.stepToolStripMenuItem_Click);
|
||||
//
|
||||
// breakHereToolStripMenuItem
|
||||
//
|
||||
this.breakHereToolStripMenuItem.Name = "breakHereToolStripMenuItem";
|
||||
this.breakHereToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.breakHereToolStripMenuItem.Text = "Breakpoint Here";
|
||||
//
|
||||
// breakpointClipboardToolStripMenuItem
|
||||
//
|
||||
this.breakpointClipboardToolStripMenuItem.Name = "breakpointClipboardToolStripMenuItem";
|
||||
this.breakpointClipboardToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.breakpointClipboardToolStripMenuItem.Text = "Breakpoint Clipboard";
|
||||
//
|
||||
// followListToolStripMenuItem
|
||||
//
|
||||
this.followListToolStripMenuItem.Name = "followListToolStripMenuItem";
|
||||
this.followListToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.followListToolStripMenuItem.Text = "Follow List";
|
||||
//
|
||||
// windowToolStripMenuItem
|
||||
//
|
||||
this.windowToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.NewWindowItem,
|
||||
this.detachCurrentTabToolStripMenuItem,
|
||||
this.closeCurrentTabToolStripMenuItem});
|
||||
this.windowToolStripMenuItem.Name = "windowToolStripMenuItem";
|
||||
this.windowToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
|
||||
this.windowToolStripMenuItem.Text = "Window";
|
||||
//
|
||||
// NewWindowItem
|
||||
//
|
||||
this.NewWindowItem.Name = "NewWindowItem";
|
||||
this.NewWindowItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.NewWindowItem.Text = "New";
|
||||
//
|
||||
// detachCurrentTabToolStripMenuItem
|
||||
//
|
||||
this.detachCurrentTabToolStripMenuItem.Name = "detachCurrentTabToolStripMenuItem";
|
||||
this.detachCurrentTabToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.detachCurrentTabToolStripMenuItem.Text = "Detach Current Tab";
|
||||
this.detachCurrentTabToolStripMenuItem.Click += new System.EventHandler(this.detachCurrentTabToolStripMenuItem_Click);
|
||||
//
|
||||
// closeCurrentTabToolStripMenuItem
|
||||
//
|
||||
this.closeCurrentTabToolStripMenuItem.Name = "closeCurrentTabToolStripMenuItem";
|
||||
this.closeCurrentTabToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.closeCurrentTabToolStripMenuItem.Text = "Close Current Tab";
|
||||
this.closeCurrentTabToolStripMenuItem.Click += new System.EventHandler(this.closeCurrentTabToolStripMenuItem_Click);
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer2.IsSplitterFixed = true;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.WorkTabs);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.statusStrip1);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(529, 386);
|
||||
this.splitContainer2.SplitterDistance = 357;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// WorkTabs
|
||||
//
|
||||
this.WorkTabs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.WorkTabs.Location = new System.Drawing.Point(0, 0);
|
||||
this.WorkTabs.Name = "WorkTabs";
|
||||
this.WorkTabs.SelectedIndex = 0;
|
||||
this.WorkTabs.Size = new System.Drawing.Size(529, 357);
|
||||
this.WorkTabs.TabIndex = 1;
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.RunStatus});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 3);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(529, 22);
|
||||
this.statusStrip1.TabIndex = 0;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// RunStatus
|
||||
//
|
||||
this.RunStatus.Name = "RunStatus";
|
||||
this.RunStatus.Size = new System.Drawing.Size(0, 17);
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(529, 416);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "MainWindow";
|
||||
this.Text = "ReactOS Debug Shell";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.PerformLayout();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem NewWindowItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem detachCurrentTabToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem closeCurrentTabToolStripMenuItem;
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private System.Windows.Forms.TabControl WorkTabs;
|
||||
private System.Windows.Forms.ToolStripMenuItem continueToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bugcheckToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem openSourceFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem addSymbolFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem symbolDirectoryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem connectSerialToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem connectPipeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem connectTCPIPToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem stepToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem breakHereToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem breakpointClipboardToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem followListToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pasteToInteractionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem memoryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem breakToolStripMenuItem;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel RunStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
255
RosDBG/MainWindow.cs
Normal file
255
RosDBG/MainWindow.cs
Normal file
@ -0,0 +1,255 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using DebugProtocol;
|
||||
using KDBGProtocol;
|
||||
using DbgHelpAPI;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public delegate void NoParamsDelegate();
|
||||
|
||||
public partial class MainWindow : Form, IShell
|
||||
{
|
||||
bool mRunning;
|
||||
DebugConnection.Mode mConnectionMode;
|
||||
ulong mCurrentEip;
|
||||
string mSourceRoot = ".", mCurrentFile;
|
||||
int mCurrentLine;
|
||||
DebugConnection mConnection = new DebugConnection();
|
||||
SymbolContext mSymbolContext;
|
||||
Dictionary<uint, Module> mModules = new Dictionary<uint, Module>();
|
||||
Dictionary<string, SourceView> mSourceFiles = new Dictionary<string, SourceView>();
|
||||
|
||||
public DebugConnection DebugConnection
|
||||
{
|
||||
get { return mConnection; }
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
mSymbolContext = new SymbolContext();
|
||||
RegisterSubwindows(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
|
||||
void Rehighlight(SourceView vw)
|
||||
{
|
||||
vw.ClearHighlight();
|
||||
vw.AddHighlight(mCurrentLine, Color.SteelBlue, Color.White);
|
||||
vw.ScrollTo(mCurrentLine);
|
||||
}
|
||||
|
||||
void TryToDisplaySource()
|
||||
{
|
||||
if (mCurrentFile == null || mCurrentFile == "unknown") return;
|
||||
string finalFileName = Path.Combine(mSourceRoot, mCurrentFile);
|
||||
SourceView theSourceView;
|
||||
if (File.Exists(finalFileName))
|
||||
{
|
||||
if (mSourceFiles.TryGetValue(finalFileName, out theSourceView))
|
||||
Rehighlight(theSourceView);
|
||||
else
|
||||
{
|
||||
theSourceView = new SourceView();
|
||||
mSourceFiles[finalFileName] = theSourceView;
|
||||
AddTab(theSourceView);
|
||||
theSourceView.SourceFile = finalFileName;
|
||||
Rehighlight(theSourceView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FocusAddress(ulong eipToFocus)
|
||||
{
|
||||
KeyValuePair<string, int> fileline = mSymbolContext.GetFileAndLine(eipToFocus);
|
||||
mCurrentFile = fileline.Key;
|
||||
mCurrentLine = fileline.Value;
|
||||
TryToDisplaySource();
|
||||
}
|
||||
|
||||
void ComposeTitleString()
|
||||
{
|
||||
FocusAddress(mCurrentEip);
|
||||
RunStatus.Text = "ConnectionMode: " + mConnectionMode + " - Running: " + mRunning + " - Source Location: " + mCurrentFile + ":" + mCurrentLine;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
mSymbolContext.Initialize();
|
||||
mConnection.DebugConnectionModeChangedEvent += DebugConnectionModeChangedEvent;
|
||||
mConnection.DebugRunningChangeEvent += DebugRunningChangeEvent;
|
||||
mConnection.DebugRegisterChangeEvent += DebugRegisterChangeEvent;
|
||||
mConnection.DebugModuleChangedEvent += DebugModuleChangedEvent;
|
||||
ComposeTitleString();
|
||||
mSymbolContext.ReactosOutputPath = ".\\output-i386";
|
||||
}
|
||||
|
||||
void DebugModuleChangedEvent(object sender, DebugModuleChangedEventArgs args)
|
||||
{
|
||||
Module themod;
|
||||
if (!mModules.TryGetValue(args.ModuleAddr, out themod) ||
|
||||
themod.ShortName != args.ModuleName.ToLower())
|
||||
{
|
||||
mModules[args.ModuleAddr] = new Module(args.ModuleAddr, args.ModuleName);
|
||||
mSymbolContext.LoadModule(args.ModuleName, args.ModuleAddr);
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "ComposeTitleString"));
|
||||
}
|
||||
|
||||
void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
|
||||
{
|
||||
mRunning = args.Running;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "ComposeTitleString"));
|
||||
}
|
||||
|
||||
void DebugConnectionModeChangedEvent(object sender, DebugConnectionModeChangedEventArgs args)
|
||||
{
|
||||
mConnectionMode = args.Mode;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "ComposeTitleString"));
|
||||
}
|
||||
|
||||
void DebugRegisterChangeEvent(object sender, DebugRegisterChangeEventArgs args)
|
||||
{
|
||||
mCurrentEip = args.Registers.Eip;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "ComposeTitleString"));
|
||||
}
|
||||
|
||||
public void RegisterSubwindows(Assembly a)
|
||||
{
|
||||
foreach (Type t in a.GetTypes())
|
||||
{
|
||||
object[] debugAttribute = t.GetCustomAttributes(typeof(DebugControlAttribute), false);
|
||||
if (debugAttribute.Length > 0)
|
||||
{
|
||||
Type x = t;
|
||||
EventHandler create =
|
||||
delegate(object sender, EventArgs args)
|
||||
{
|
||||
Control ctrl = (Control)x.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
IUseDebugConnection usedbg = ctrl as IUseDebugConnection;
|
||||
if (usedbg != null)
|
||||
usedbg.SetDebugConnection(mConnection);
|
||||
IUseSymbols usesym = ctrl as IUseSymbols;
|
||||
if (usesym != null)
|
||||
usesym.SetSymbolProvider(mSymbolContext);
|
||||
IUseShell useshell = ctrl as IUseShell;
|
||||
if (useshell != null)
|
||||
useshell.SetShell(this);
|
||||
AddTab(ctrl);
|
||||
};
|
||||
NewWindowItem.DropDownItems.Add(t.Name, null, create);
|
||||
|
||||
object[] buildNow = t.GetCustomAttributes(typeof(BuildAtStartupAttribute), false);
|
||||
if (buildNow.Length > 0)
|
||||
create(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTab(Control ctrl)
|
||||
{
|
||||
SuspendLayout();
|
||||
TabPage tp = new TabPage(ctrl.Text);
|
||||
tp.Controls.Add(ctrl);
|
||||
tp.Text = ctrl.GetType().Name;
|
||||
ctrl.Dock = DockStyle.Fill;
|
||||
WorkTabs.Controls.Add(tp);
|
||||
ResumeLayout();
|
||||
}
|
||||
|
||||
public Control RemoveCurrentTab()
|
||||
{
|
||||
TabPage tp = (TabPage)WorkTabs.SelectedTab;
|
||||
if (tp == null || tp.Controls.Count < 1) return null;
|
||||
Control current = tp.Controls[0];
|
||||
WorkTabs.Controls.Remove(tp);
|
||||
return current;
|
||||
}
|
||||
|
||||
private void closeCurrentTabToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Control ctrl = RemoveCurrentTab();
|
||||
if (ctrl != null) ctrl.Dispose();
|
||||
}
|
||||
|
||||
private void detachCurrentTabToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Control ctrl = RemoveCurrentTab();
|
||||
if (ctrl != null)
|
||||
{
|
||||
HostWindow hw = new HostWindow();
|
||||
hw.Content = ctrl;
|
||||
hw.RedockControlEvent += RedockControlEventFired;
|
||||
hw.Show();
|
||||
}
|
||||
}
|
||||
|
||||
void RedockControlEventFired(object sender, RedockControlEventArgs args)
|
||||
{
|
||||
AddTab(args.Control);
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
// Fixup various editing tools ...
|
||||
private void Interaction_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == 13)
|
||||
{
|
||||
TextBox tb = (TextBox)sender;
|
||||
e.Handled = true;
|
||||
string command = tb.Text;
|
||||
tb.Text = "";
|
||||
if (InteractiveInputEvent != null)
|
||||
InteractiveInputEvent(sender, new InteractiveInputEventArgs(this, command));
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void InteractiveInputEventHandler(object sender, InteractiveInputEventArgs args);
|
||||
public event InteractiveInputEventHandler InteractiveInputEvent;
|
||||
|
||||
private void connectTCPIPToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
TCPTargetSelect targetSelect = new TCPTargetSelect();
|
||||
if (targetSelect.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
mConnection.Close();
|
||||
mConnection.Start(targetSelect.Host, targetSelect.Port);
|
||||
}
|
||||
}
|
||||
|
||||
private void breakToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
mConnection.Break();
|
||||
}
|
||||
|
||||
private void stepToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
mConnection.Step();
|
||||
}
|
||||
|
||||
private void continueToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
mConnection.Go();
|
||||
}
|
||||
}
|
||||
|
||||
public class InteractiveInputEventArgs : EventArgs
|
||||
{
|
||||
string mCommand;
|
||||
public string Command { get { return mCommand; } }
|
||||
public InteractiveInputEventArgs(object sender, string cmd) { mCommand = cmd; }
|
||||
}
|
||||
}
|
126
RosDBG/MainWindow.resx
Normal file
126
RosDBG/MainWindow.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
</root>
|
128
RosDBG/MemoryWindow.Designer.cs
generated
Normal file
128
RosDBG/MemoryWindow.Designer.cs
generated
Normal file
@ -0,0 +1,128 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class MemoryWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.MemoryAddress = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.MemoryView = new System.Windows.Forms.ListView();
|
||||
this.MemoryDataColumn = new System.Windows.Forms.ColumnHeader();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.MemoryAddress);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.MemoryView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(409, 341);
|
||||
this.splitContainer1.SplitterDistance = 25;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// MemoryAddress
|
||||
//
|
||||
this.MemoryAddress.Location = new System.Drawing.Point(54, 3);
|
||||
this.MemoryAddress.Name = "MemoryAddress";
|
||||
this.MemoryAddress.Size = new System.Drawing.Size(152, 20);
|
||||
this.MemoryAddress.TabIndex = 1;
|
||||
this.MemoryAddress.TextChanged += new System.EventHandler(this.MemoryAddress_TextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(45, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Address";
|
||||
//
|
||||
// MemoryView
|
||||
//
|
||||
this.MemoryView.AutoArrange = false;
|
||||
this.MemoryView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.MemoryDataColumn});
|
||||
this.MemoryView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MemoryView.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.MemoryView.FullRowSelect = true;
|
||||
this.MemoryView.GridLines = true;
|
||||
this.MemoryView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.MemoryView.LabelEdit = true;
|
||||
this.MemoryView.LabelWrap = false;
|
||||
this.MemoryView.Location = new System.Drawing.Point(0, 0);
|
||||
this.MemoryView.MultiSelect = false;
|
||||
this.MemoryView.Name = "MemoryView";
|
||||
this.MemoryView.Size = new System.Drawing.Size(409, 312);
|
||||
this.MemoryView.TabIndex = 0;
|
||||
this.MemoryView.UseCompatibleStateImageBehavior = false;
|
||||
this.MemoryView.View = System.Windows.Forms.View.Details;
|
||||
this.MemoryView.VirtualListSize = 4096;
|
||||
this.MemoryView.VirtualMode = true;
|
||||
this.MemoryView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.MemoryView_RetrieveVirtualItem);
|
||||
//
|
||||
// MemoryDataColumn
|
||||
//
|
||||
this.MemoryDataColumn.Text = "Memory Data";
|
||||
this.MemoryDataColumn.Width = 1000;
|
||||
//
|
||||
// MemoryWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "MemoryWindow";
|
||||
this.Size = new System.Drawing.Size(409, 341);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox MemoryAddress;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListView MemoryView;
|
||||
private System.Windows.Forms.ColumnHeader MemoryDataColumn;
|
||||
}
|
||||
}
|
117
RosDBG/MemoryWindow.cs
Normal file
117
RosDBG/MemoryWindow.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl]
|
||||
public partial class MemoryWindow : UserControl, IUseDebugConnection
|
||||
{
|
||||
ulong mAddress;
|
||||
DebugConnection mConnection;
|
||||
bool mRunning = true;
|
||||
Dictionary<ulong, ListViewItem> mStoredBytes = new Dictionary<ulong, ListViewItem>();
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
conn.DebugRunningChangeEvent += DebugRunningChangeEvent;
|
||||
mRunning = conn.Running;
|
||||
}
|
||||
|
||||
void UpdateMemoryWindow()
|
||||
{
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "RefreshView"));
|
||||
}
|
||||
|
||||
void RefreshView()
|
||||
{
|
||||
MemoryView.EnsureVisible(0);
|
||||
MemoryView.Refresh();
|
||||
}
|
||||
|
||||
void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
|
||||
{
|
||||
ulong address;
|
||||
|
||||
mRunning = args.Running;
|
||||
|
||||
if (!mRunning && ulong.TryParse(MemoryAddress.Text, NumberStyles.HexNumber, null, out address))
|
||||
{
|
||||
mStoredBytes.Clear();
|
||||
mAddress = address & ~15UL;
|
||||
UpdateMemoryWindow();
|
||||
}
|
||||
}
|
||||
|
||||
public MemoryWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MemoryView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
|
||||
{
|
||||
ListViewItem theItem;
|
||||
int i;
|
||||
ulong toRead = mAddress + (ulong)(e.ItemIndex << 4);
|
||||
|
||||
if (mStoredBytes.TryGetValue(toRead, out theItem))
|
||||
{
|
||||
e.Item = theItem;
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder resultName = new StringBuilder(string.Format("{0:X8}:", toRead));
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
resultName.Append(" ??");
|
||||
|
||||
e.Item = new ListViewItem(resultName.ToString());
|
||||
mStoredBytes[toRead] = e.Item;
|
||||
ThreadPool.QueueUserWorkItem(UpdateRow, toRead);
|
||||
}
|
||||
|
||||
void UpdateRow(object toReadObj)
|
||||
{
|
||||
ulong toRead = (ulong)toReadObj;
|
||||
DebugMemoryStream mem = mConnection.NewMemoryStream();
|
||||
StringBuilder resultName = new StringBuilder(string.Format("{0:X8}:", toRead));
|
||||
|
||||
int width = 16;
|
||||
byte[] readBuf = new byte[width];
|
||||
|
||||
mem.Seek((long)toRead, System.IO.SeekOrigin.Begin);
|
||||
|
||||
int i, result = mRunning ? 0 : mem.Read(readBuf, 0, readBuf.Length);
|
||||
|
||||
if (result == 0) return;
|
||||
|
||||
for (i = 0; i < readBuf.Length; i++)
|
||||
resultName.Append(string.Format(" {0:X2}", (int)readBuf[i]));
|
||||
resultName.Append(" | ");
|
||||
for (i = 0; i < readBuf.Length; i++)
|
||||
resultName.Append((!char.IsControl((char)readBuf[i]) && (int)readBuf[i] < 128) ? (char)readBuf[i] : '\xb7');
|
||||
|
||||
mStoredBytes[toRead] = new ListViewItem(resultName.ToString());
|
||||
UpdateMemoryWindow();
|
||||
}
|
||||
|
||||
private void MemoryAddress_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
ulong address;
|
||||
if (ulong.TryParse(MemoryAddress.Text, NumberStyles.HexNumber, null, out address))
|
||||
{
|
||||
mAddress = address & ~15UL;
|
||||
UpdateMemoryWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/MemoryWindow.resx
Normal file
120
RosDBG/MemoryWindow.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
29
RosDBG/Module.cs
Normal file
29
RosDBG/Module.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DbgHelpAPI;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
class Module
|
||||
{
|
||||
ulong mBaseAddress;
|
||||
public ulong BaseAddress
|
||||
{
|
||||
get { return mBaseAddress; }
|
||||
}
|
||||
string mShortName;
|
||||
public string ShortName
|
||||
{
|
||||
get { return mShortName; }
|
||||
}
|
||||
|
||||
public Module(ulong addr, string shortName)
|
||||
{
|
||||
mBaseAddress = addr;
|
||||
mShortName = shortName.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
49
RosDBG/ModuleIndex.cs
Normal file
49
RosDBG/ModuleIndex.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
class ModuleIndex
|
||||
{
|
||||
string mReactOSBuild;
|
||||
Dictionary<string, string> mModcache = new Dictionary<string, string>();
|
||||
|
||||
public string ReactOSBuild
|
||||
{
|
||||
get { return mReactOSBuild; }
|
||||
set
|
||||
{
|
||||
mReactOSBuild = value;
|
||||
mModcache.Clear();
|
||||
if (mReactOSBuild != null)
|
||||
ReadDirs(mReactOSBuild);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadDirs(string dir)
|
||||
{
|
||||
foreach (string subdir in Directory.GetDirectories(dir))
|
||||
ReadDirs(Path.Combine(dir, subdir));
|
||||
|
||||
foreach (string file in Directory.GetFiles(dir))
|
||||
mModcache[Path.GetFileNameWithoutExtension(file).ToLowerInvariant()] =
|
||||
Path.Combine(dir, file);
|
||||
}
|
||||
|
||||
public ModuleIndex()
|
||||
{
|
||||
}
|
||||
|
||||
public string GetModuleByName(string name)
|
||||
{
|
||||
string result;
|
||||
if (mModcache.TryGetValue(name.ToLowerInvariant(), out result))
|
||||
return result;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
77
RosDBG/Modules.Designer.cs
generated
Normal file
77
RosDBG/Modules.Designer.cs
generated
Normal file
@ -0,0 +1,77 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class Modules
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ModulesList = new System.Windows.Forms.ListView();
|
||||
this.MListAddress = new System.Windows.Forms.ColumnHeader();
|
||||
this.MListShortName = new System.Windows.Forms.ColumnHeader();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ModulesList
|
||||
//
|
||||
this.ModulesList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.MListAddress,
|
||||
this.MListShortName});
|
||||
this.ModulesList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ModulesList.Location = new System.Drawing.Point(0, 0);
|
||||
this.ModulesList.Name = "ModulesList";
|
||||
this.ModulesList.Size = new System.Drawing.Size(244, 218);
|
||||
this.ModulesList.TabIndex = 0;
|
||||
this.ModulesList.UseCompatibleStateImageBehavior = false;
|
||||
this.ModulesList.View = System.Windows.Forms.View.Details;
|
||||
this.ModulesList.VirtualMode = true;
|
||||
this.ModulesList.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.ModulesList_RetrieveVirtualItem);
|
||||
//
|
||||
// MListAddress
|
||||
//
|
||||
this.MListAddress.Text = "Address";
|
||||
//
|
||||
// MListShortName
|
||||
//
|
||||
this.MListShortName.Text = "ShortName";
|
||||
this.MListShortName.Width = 120;
|
||||
//
|
||||
// Modules
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.ModulesList);
|
||||
this.Name = "Modules";
|
||||
this.Size = new System.Drawing.Size(244, 218);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView ModulesList;
|
||||
private System.Windows.Forms.ColumnHeader MListAddress;
|
||||
private System.Windows.Forms.ColumnHeader MListShortName;
|
||||
}
|
||||
}
|
56
RosDBG/Modules.cs
Normal file
56
RosDBG/Modules.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl]
|
||||
public partial class Modules : UserControl, IUseDebugConnection
|
||||
{
|
||||
public SortedList<uint, string> mModules = new SortedList<uint, string>();
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
conn.DebugModuleChangedEvent += DebugModuleChangedEvent;
|
||||
if (!conn.Running)
|
||||
conn.Debugger.GetModuleUpdate();
|
||||
}
|
||||
|
||||
void UpdateList()
|
||||
{
|
||||
lock (mModules)
|
||||
{
|
||||
ModulesList.VirtualListSize = mModules.Count;
|
||||
ModulesList.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void DebugModuleChangedEvent(object sender, DebugModuleChangedEventArgs args)
|
||||
{
|
||||
lock (mModules)
|
||||
{
|
||||
if (args.ModuleName.ToLower() == "ntoskrnl.exe")
|
||||
mModules.Clear();
|
||||
mModules[args.ModuleAddr] = args.ModuleName;
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "UpdateList"));
|
||||
}
|
||||
|
||||
public Modules()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ModulesList_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
|
||||
{
|
||||
KeyValuePair<uint, string> modent = mModules.ElementAt(e.ItemIndex);
|
||||
e.Item = new ListViewItem(new string[] { modent.Key.ToString("X8"), modent.Value });
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/Modules.resx
Normal file
120
RosDBG/Modules.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
22
RosDBG/Program.cs
Normal file
22
RosDBG/Program.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
MainWindow mw = new MainWindow();
|
||||
Application.Run(mw);
|
||||
}
|
||||
}
|
||||
}
|
36
RosDBG/Properties/AssemblyInfo.cs
Normal file
36
RosDBG/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WindowsFormsApplication1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WindowsFormsApplication1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("5850a4c1-3776-4c7c-a19e-5c7e48d679cb")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
63
RosDBG/Properties/Resources.Designer.cs
generated
Normal file
63
RosDBG/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RosDBG.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RosDBG.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
RosDBG/Properties/Resources.resx
Normal file
117
RosDBG/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
RosDBG/Properties/Settings.Designer.cs
generated
Normal file
26
RosDBG/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RosDBG.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
RosDBG/Properties/Settings.settings
Normal file
7
RosDBG/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
62
RosDBG/RawTraffic.Designer.cs
generated
Normal file
62
RosDBG/RawTraffic.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class RawTraffic
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.RawTrafficText = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// RawTrafficText
|
||||
//
|
||||
this.RawTrafficText.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.RawTrafficText.Location = new System.Drawing.Point(0, 0);
|
||||
this.RawTrafficText.MaxLength = 10000000;
|
||||
this.RawTrafficText.Multiline = true;
|
||||
this.RawTrafficText.Name = "RawTrafficText";
|
||||
this.RawTrafficText.ReadOnly = true;
|
||||
this.RawTrafficText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.RawTrafficText.Size = new System.Drawing.Size(150, 150);
|
||||
this.RawTrafficText.TabIndex = 0;
|
||||
this.RawTrafficText.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.RawTrafficText_KeyPress);
|
||||
//
|
||||
// RawTraffic
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.RawTrafficText);
|
||||
this.Name = "RawTraffic";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox RawTrafficText;
|
||||
}
|
||||
}
|
56
RosDBG/RawTraffic.cs
Normal file
56
RosDBG/RawTraffic.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl, BuildAtStartup]
|
||||
public partial class RawTraffic : UserControl, IUseDebugConnection
|
||||
{
|
||||
DebugConnection mConnection;
|
||||
List<string> textToAdd = new List<string>();
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
conn.DebugRawTrafficEvent += DebugRawTrafficEvent;
|
||||
}
|
||||
|
||||
void UpdateText()
|
||||
{
|
||||
StringBuilder toAdd = new StringBuilder();
|
||||
lock (textToAdd)
|
||||
{
|
||||
foreach (string s in textToAdd)
|
||||
toAdd.Append(s);
|
||||
textToAdd.Clear();
|
||||
}
|
||||
RawTrafficText.AppendText(toAdd.ToString());
|
||||
}
|
||||
|
||||
void DebugRawTrafficEvent(object sender, DebugRawTrafficEventArgs args)
|
||||
{
|
||||
lock (textToAdd)
|
||||
{
|
||||
textToAdd.Add(args.Data);
|
||||
}
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "UpdateText"));
|
||||
}
|
||||
|
||||
public RawTraffic()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RawTrafficText_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
mConnection.Debugger.Write("" + e.KeyChar);
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/RawTraffic.resx
Normal file
120
RosDBG/RawTraffic.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
147
RosDBG/ReactOSWeb.Designer.cs
generated
Normal file
147
RosDBG/ReactOSWeb.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class ReactOSWeb
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.Paste = new System.Windows.Forms.LinkLabel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.BugzillaNumber = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.AddressInput = new System.Windows.Forms.TextBox();
|
||||
this.BrowserView = new System.Windows.Forms.WebBrowser();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.IsSplitterFixed = true;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.Paste);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label2);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.BugzillaNumber);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label1);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.AddressInput);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.BrowserView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(443, 317);
|
||||
this.splitContainer1.SplitterDistance = 27;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// Paste
|
||||
//
|
||||
this.Paste.AutoSize = true;
|
||||
this.Paste.Location = new System.Drawing.Point(223, 6);
|
||||
this.Paste.Name = "Paste";
|
||||
this.Paste.Size = new System.Drawing.Size(34, 13);
|
||||
this.Paste.TabIndex = 4;
|
||||
this.Paste.TabStop = true;
|
||||
this.Paste.Text = "Paste";
|
||||
this.Paste.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Paste_LinkClicked);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(291, 6);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(43, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Bugzilla";
|
||||
//
|
||||
// BugzillaNumber
|
||||
//
|
||||
this.BugzillaNumber.Location = new System.Drawing.Point(340, 3);
|
||||
this.BugzillaNumber.Name = "BugzillaNumber";
|
||||
this.BugzillaNumber.Size = new System.Drawing.Size(100, 20);
|
||||
this.BugzillaNumber.TabIndex = 2;
|
||||
this.BugzillaNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.BugzillaNumber_KeyPress);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(5, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(45, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Address";
|
||||
//
|
||||
// AddressInput
|
||||
//
|
||||
this.AddressInput.Location = new System.Drawing.Point(56, 3);
|
||||
this.AddressInput.Name = "AddressInput";
|
||||
this.AddressInput.Size = new System.Drawing.Size(161, 20);
|
||||
this.AddressInput.TabIndex = 0;
|
||||
this.AddressInput.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AddressInput_KeyPress);
|
||||
//
|
||||
// BrowserView
|
||||
//
|
||||
this.BrowserView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.BrowserView.Location = new System.Drawing.Point(0, 0);
|
||||
this.BrowserView.MinimumSize = new System.Drawing.Size(20, 20);
|
||||
this.BrowserView.Name = "BrowserView";
|
||||
this.BrowserView.Size = new System.Drawing.Size(443, 286);
|
||||
this.BrowserView.TabIndex = 0;
|
||||
this.BrowserView.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.BrowserView_Navigating);
|
||||
//
|
||||
// ReactOSWeb
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "ReactOSWeb";
|
||||
this.Size = new System.Drawing.Size(443, 317);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox AddressInput;
|
||||
private System.Windows.Forms.LinkLabel Paste;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox BugzillaNumber;
|
||||
private System.Windows.Forms.WebBrowser BrowserView;
|
||||
}
|
||||
}
|
48
RosDBG/ReactOSWeb.cs
Normal file
48
RosDBG/ReactOSWeb.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl, BuildAtStartup]
|
||||
public partial class ReactOSWeb : UserControl
|
||||
{
|
||||
public ReactOSWeb()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void AddressInput_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == 13)
|
||||
{
|
||||
e.Handled = true;
|
||||
BrowserView.Navigate(((TextBox)sender).Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void BrowserView_Navigating(object sender, WebBrowserNavigatingEventArgs e)
|
||||
{
|
||||
AddressInput.Text = e.Url.ToString();
|
||||
}
|
||||
|
||||
private void BugzillaNumber_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == 13)
|
||||
{
|
||||
e.Handled = true;
|
||||
BrowserView.Navigate("http://www.reactos.org/bugzilla/show_bug.cgi?id=" + ((TextBox)sender).Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void Paste_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
BrowserView.Navigate("http://www.reactos.org/paste");
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/ReactOSWeb.resx
Normal file
120
RosDBG/ReactOSWeb.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
59
RosDBG/RegisterView.Designer.cs
generated
Normal file
59
RosDBG/RegisterView.Designer.cs
generated
Normal file
@ -0,0 +1,59 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class RegisterView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.RegisterGrid = new System.Windows.Forms.PropertyGrid();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// RegisterGrid
|
||||
//
|
||||
this.RegisterGrid.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.RegisterGrid.Location = new System.Drawing.Point(0, 0);
|
||||
this.RegisterGrid.Name = "RegisterGrid";
|
||||
this.RegisterGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
|
||||
this.RegisterGrid.Size = new System.Drawing.Size(307, 274);
|
||||
this.RegisterGrid.TabIndex = 0;
|
||||
this.RegisterGrid.ToolbarVisible = false;
|
||||
//
|
||||
// RegisterView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.RegisterGrid);
|
||||
this.Name = "RegisterView";
|
||||
this.Size = new System.Drawing.Size(307, 274);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PropertyGrid RegisterGrid;
|
||||
}
|
||||
}
|
59
RosDBG/RegisterView.cs
Normal file
59
RosDBG/RegisterView.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DebugProtocol;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
[DebugControl, BuildAtStartup]
|
||||
public partial class RegisterView : UserControl, IUseDebugConnection
|
||||
{
|
||||
bool mGridEnabled;
|
||||
Registers mRegisters;
|
||||
DebugConnection mConnection;
|
||||
|
||||
public RegisterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
RegisterGrid.SelectedObject = new Registers();
|
||||
}
|
||||
|
||||
public void SetDebugConnection(DebugConnection conn)
|
||||
{
|
||||
mConnection = conn;
|
||||
mConnection.DebugRegisterChangeEvent += DebugRegisterChangeEvent;
|
||||
mConnection.DebugRunningChangeEvent += DebugRunningChangeEvent;
|
||||
if (!mConnection.Running)
|
||||
mConnection.Debugger.GetRegisterUpdate();
|
||||
}
|
||||
|
||||
void UpdateGridEnabled()
|
||||
{
|
||||
RegisterGrid.Enabled = mGridEnabled;
|
||||
}
|
||||
|
||||
void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
|
||||
{
|
||||
mGridEnabled = !args.Running;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "UpdateGridEnabled"));
|
||||
}
|
||||
|
||||
void UpdateGrid()
|
||||
{
|
||||
RegisterGrid.SelectedObject = null;
|
||||
RegisterGrid.SelectedObject = mRegisters;
|
||||
RegisterGrid.Refresh();
|
||||
}
|
||||
|
||||
void DebugRegisterChangeEvent(object sender, DebugRegisterChangeEventArgs args)
|
||||
{
|
||||
mRegisters = args.Registers;
|
||||
Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "UpdateGrid"));
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/RegisterView.resx
Normal file
120
RosDBG/RegisterView.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
29
RosDBG/Registers.cs
Normal file
29
RosDBG/Registers.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public class Registers
|
||||
{
|
||||
public ulong Eax { get { return RegisterSet[0]; } set { RegisterSet[0] = value; } }
|
||||
public ulong Ecx { get { return RegisterSet[1]; } set { RegisterSet[1] = value; } }
|
||||
public ulong Edx { get { return RegisterSet[2]; } set { RegisterSet[2] = value; } }
|
||||
public ulong Ebx { get { return RegisterSet[3]; } set { RegisterSet[3] = value; } }
|
||||
public ulong Esp { get { return RegisterSet[4]; } set { RegisterSet[4] = value; } }
|
||||
public ulong Ebp { get { return RegisterSet[5]; } set { RegisterSet[5] = value; } }
|
||||
public ulong Esi { get { return RegisterSet[6]; } set { RegisterSet[6] = value; } }
|
||||
public ulong Edi { get { return RegisterSet[7]; } set { RegisterSet[7] = value; } }
|
||||
public ulong Eip { get { return RegisterSet[8]; } set { RegisterSet[8] = value; } }
|
||||
public ulong Eflags { get { return RegisterSet[9]; } set { RegisterSet[9] = value; } }
|
||||
public ulong Cs { get { return RegisterSet[10]; } set { RegisterSet[10] = value; } }
|
||||
public ulong Ds { get { return RegisterSet[11]; } set { RegisterSet[11] = value; } }
|
||||
public ulong Es { get { return RegisterSet[12]; } set { RegisterSet[12] = value; } }
|
||||
public ulong Fs { get { return RegisterSet[13]; } set { RegisterSet[13] = value; } }
|
||||
public ulong Gs { get { return RegisterSet[14]; } set { RegisterSet[14] = value; } }
|
||||
public ulong Ss { get { return RegisterSet[15]; } set { RegisterSet[15] = value; } }
|
||||
public ulong[] RegisterSet = new ulong[32];
|
||||
}
|
||||
}
|
252
RosDBG/RosDBG.csproj
Normal file
252
RosDBG/RosDBG.csproj
Normal file
@ -0,0 +1,252 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RosDBG</RootNamespace>
|
||||
<AssemblyName>RosDBG</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BackTrace.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BackTrace.Designer.cs">
|
||||
<DependentUpon>BackTrace.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DebugControlAttribute.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DebugInfoFile.cs" />
|
||||
<Compile Include="HighLevelInteraction.cs" />
|
||||
<Compile Include="HostWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HostWindow.Designer.cs">
|
||||
<DependentUpon>HostWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="IShell.cs" />
|
||||
<Compile Include="IUseDebugConnection.cs" />
|
||||
<Compile Include="IUseSymbols.cs" />
|
||||
<Compile Include="Locals.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Locals.Designer.cs">
|
||||
<DependentUpon>Locals.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.Designer.cs">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MemoryWindow.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MemoryWindow.Designer.cs">
|
||||
<DependentUpon>MemoryWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Module.cs" />
|
||||
<Compile Include="ModuleIndex.cs" />
|
||||
<Compile Include="Modules.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Modules.Designer.cs">
|
||||
<DependentUpon>Modules.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="BackTrace.resx">
|
||||
<DependentUpon>BackTrace.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="HostWindow.resx">
|
||||
<DependentUpon>HostWindow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Locals.resx">
|
||||
<DependentUpon>Locals.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainWindow.resx">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MemoryWindow.resx">
|
||||
<DependentUpon>MemoryWindow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Modules.resx">
|
||||
<DependentUpon>Modules.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="RawTraffic.resx">
|
||||
<DependentUpon>RawTraffic.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ReactOSWeb.resx">
|
||||
<DependentUpon>ReactOSWeb.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="RegisterView.resx">
|
||||
<DependentUpon>RegisterView.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SourceView.resx">
|
||||
<DependentUpon>SourceView.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TCPTargetSelect.resx">
|
||||
<DependentUpon>TCPTargetSelect.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="RawTraffic.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RawTraffic.Designer.cs">
|
||||
<DependentUpon>RawTraffic.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ReactOSWeb.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ReactOSWeb.Designer.cs">
|
||||
<DependentUpon>ReactOSWeb.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RegisterView.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RegisterView.Designer.cs">
|
||||
<DependentUpon>RegisterView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SourceView.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SourceView.Designer.cs">
|
||||
<DependentUpon>SourceView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TCPTargetSelect.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TCPTargetSelect.Designer.cs">
|
||||
<DependentUpon>TCPTargetSelect.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DbgHelp\DbgHelp.csproj">
|
||||
<Project>{3442437A-CB9C-4C73-B35B-3F6E4F60F3B2}</Project>
|
||||
<Name>DbgHelp</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DebugProtocol\DebugProtocol.csproj">
|
||||
<Project>{76A02C1D-4B11-4D43-966E-E5C053870D65}</Project>
|
||||
<Name>DebugProtocol</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Pipe\Pipe.csproj">
|
||||
<Project>{F943218A-0A5E-436E-A7A4-475F37F45FA8}</Project>
|
||||
<Name>Pipe</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
26
RosDBG/RosDBG.sln
Normal file
26
RosDBG/RosDBG.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C# Express 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RosDBG", "RosDBG.csproj", "{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stabs", "..\stabs\stabs.csproj", "{BCA425B3-12A5-40A3-9C88-7B3D071C8018}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB776BFE-D2C2-465E-B713-6AD82CAE1A39}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BCA425B3-12A5-40A3-9C88-7B3D071C8018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BCA425B3-12A5-40A3-9C88-7B3D071C8018}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BCA425B3-12A5-40A3-9C88-7B3D071C8018}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BCA425B3-12A5-40A3-9C88-7B3D071C8018}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
59
RosDBG/SourceView.Designer.cs
generated
Normal file
59
RosDBG/SourceView.Designer.cs
generated
Normal file
@ -0,0 +1,59 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class SourceView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SourceCode = new System.Windows.Forms.RichTextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SourceCode
|
||||
//
|
||||
this.SourceCode.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SourceCode.Location = new System.Drawing.Point(0, 0);
|
||||
this.SourceCode.Name = "SourceCode";
|
||||
this.SourceCode.ReadOnly = true;
|
||||
this.SourceCode.Size = new System.Drawing.Size(497, 308);
|
||||
this.SourceCode.TabIndex = 0;
|
||||
this.SourceCode.Text = "";
|
||||
//
|
||||
// SourceView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.SourceCode);
|
||||
this.Name = "SourceView";
|
||||
this.Size = new System.Drawing.Size(497, 308);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox SourceCode;
|
||||
}
|
||||
}
|
78
RosDBG/SourceView.cs
Normal file
78
RosDBG/SourceView.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public partial class SourceView : UserControl
|
||||
{
|
||||
string mSourceFile;
|
||||
public string SourceFile
|
||||
{
|
||||
get { return mSourceFile; }
|
||||
set
|
||||
{
|
||||
mSourceFile = value;
|
||||
UpdateSourceCode();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
SourceCode.BackColor = Color.FromKnownColor(KnownColor.Window);
|
||||
}
|
||||
|
||||
public void ScrollTo(int line)
|
||||
{
|
||||
}
|
||||
|
||||
Dictionary<int, Color> mHighlightedLines = new Dictionary<int, Color>();
|
||||
public void ClearHighlight()
|
||||
{
|
||||
SourceCode.SelectAll();
|
||||
SourceCode.SelectionBackColor = Color.FromKnownColor(KnownColor.Window);
|
||||
SourceCode.SelectionColor = Color.FromKnownColor(KnownColor.WindowText);
|
||||
}
|
||||
|
||||
public void AddHighlight(int line, Color backColor, Color foreColor)
|
||||
{
|
||||
SourceCode.SelectionStart = SourceCode.GetFirstCharIndexFromLine(line);
|
||||
SourceCode.SelectionLength = SourceCode.GetFirstCharIndexFromLine(line + 1) - SourceCode.SelectionStart;
|
||||
SourceCode.SelectionBackColor = backColor;
|
||||
SourceCode.SelectionColor = foreColor;
|
||||
}
|
||||
|
||||
public void RemoveHighlight(int line)
|
||||
{
|
||||
AddHighlight(line, Color.FromKnownColor(KnownColor.Window), Color.FromKnownColor(KnownColor.WindowText));
|
||||
}
|
||||
|
||||
public SourceView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void UpdateSourceCode()
|
||||
{
|
||||
SourceCode.Clear();
|
||||
ClearHighlight();
|
||||
|
||||
if (mSourceFile == null) return;
|
||||
try
|
||||
{
|
||||
SourceCode.Lines = File.ReadAllLines(mSourceFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
SourceCode.Text = "Could not load " + mSourceFile + ": " + ex.Message + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/SourceView.resx
Normal file
120
RosDBG/SourceView.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
139
RosDBG/TCPTargetSelect.Designer.cs
generated
Normal file
139
RosDBG/TCPTargetSelect.Designer.cs
generated
Normal file
@ -0,0 +1,139 @@
|
||||
namespace RosDBG
|
||||
{
|
||||
partial class TCPTargetSelect
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.HostChoice = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.PortNumber = new System.Windows.Forms.NumericUpDown();
|
||||
this.CancelButton = new System.Windows.Forms.Button();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PortNumber)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// HostChoice
|
||||
//
|
||||
this.HostChoice.FormattingEnabled = true;
|
||||
this.HostChoice.Location = new System.Drawing.Point(47, 9);
|
||||
this.HostChoice.Name = "HostChoice";
|
||||
this.HostChoice.Size = new System.Drawing.Size(121, 21);
|
||||
this.HostChoice.TabIndex = 0;
|
||||
this.HostChoice.Text = "localhost";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Host";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 49);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(26, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Port";
|
||||
//
|
||||
// PortNumber
|
||||
//
|
||||
this.PortNumber.Location = new System.Drawing.Point(47, 47);
|
||||
this.PortNumber.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PortNumber.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PortNumber.Name = "PortNumber";
|
||||
this.PortNumber.Size = new System.Drawing.Size(120, 20);
|
||||
this.PortNumber.TabIndex = 3;
|
||||
this.PortNumber.Value = new decimal(new int[] {
|
||||
1235,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelButton.Location = new System.Drawing.Point(150, 90);
|
||||
this.CancelButton.Name = "CancelButton";
|
||||
this.CancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.CancelButton.TabIndex = 4;
|
||||
this.CancelButton.Text = "Cancel";
|
||||
this.CancelButton.UseVisualStyleBackColor = true;
|
||||
this.CancelButton.Click += new System.EventHandler(this.CancelButton_Click);
|
||||
//
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OKButton.Location = new System.Drawing.Point(69, 90);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.OKButton.TabIndex = 5;
|
||||
this.OKButton.Text = "OK";
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
|
||||
//
|
||||
// TCPTargetSelect
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(237, 125);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.Controls.Add(this.CancelButton);
|
||||
this.Controls.Add(this.PortNumber);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.HostChoice);
|
||||
this.Name = "TCPTargetSelect";
|
||||
this.Text = "TCPTargetSelect";
|
||||
((System.ComponentModel.ISupportInitialize)(this.PortNumber)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox HostChoice;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.NumericUpDown PortNumber;
|
||||
private System.Windows.Forms.Button CancelButton;
|
||||
private System.Windows.Forms.Button OKButton;
|
||||
}
|
||||
}
|
43
RosDBG/TCPTargetSelect.cs
Normal file
43
RosDBG/TCPTargetSelect.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RosDBG
|
||||
{
|
||||
public partial class TCPTargetSelect : Form
|
||||
{
|
||||
public string Host
|
||||
{
|
||||
get { return HostChoice.Text; }
|
||||
set { HostChoice.Text = value; }
|
||||
}
|
||||
|
||||
public int Port
|
||||
{
|
||||
get { return (int)PortNumber.Value; }
|
||||
set { PortNumber.Value = value; }
|
||||
}
|
||||
|
||||
public TCPTargetSelect()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OKButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
RosDBG/TCPTargetSelect.resx
Normal file
120
RosDBG/TCPTargetSelect.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
344
RosDBG/gdb.cs
Normal file
344
RosDBG/gdb.cs
Normal file
@ -0,0 +1,344 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Gdb
|
||||
{
|
||||
#region Event defs
|
||||
public class ConsoleOutputEventArgs : EventArgs
|
||||
{
|
||||
public readonly string Line;
|
||||
public ConsoleOutputEventArgs(string line)
|
||||
{
|
||||
Line = line;
|
||||
}
|
||||
}
|
||||
public delegate void ConsoleOutputEventHandler(object sender, ConsoleOutputEventArgs args);
|
||||
|
||||
public class RegisterChangeEventArgs : EventArgs
|
||||
{
|
||||
public readonly List<long> Registers;
|
||||
public RegisterChangeEventArgs(IEnumerable<long> registers)
|
||||
{
|
||||
Registers = new List<long>(registers);
|
||||
}
|
||||
}
|
||||
public delegate void RegisterChangeEventHandler(object sender, RegisterChangeEventArgs args);
|
||||
|
||||
public class SignalDeliveredEventArgs : EventArgs
|
||||
{
|
||||
public readonly int Signal;
|
||||
public SignalDeliveredEventArgs(int sig)
|
||||
{
|
||||
Signal = sig;
|
||||
}
|
||||
}
|
||||
public delegate void SignalDeliveredEventHandler(object sender, SignalDeliveredEventArgs args);
|
||||
|
||||
public class RemoteGDBErrorArgs : EventArgs
|
||||
{
|
||||
public readonly int Error;
|
||||
public RemoteGDBErrorArgs(int error)
|
||||
{
|
||||
Error = error;
|
||||
}
|
||||
}
|
||||
public delegate void RemoteGDBErrorHandler(object sender, RemoteGDBErrorArgs args);
|
||||
|
||||
public class MemoryUpdateEventArgs : EventArgs
|
||||
{
|
||||
public readonly long Address;
|
||||
public readonly byte []Memory;
|
||||
public MemoryUpdateEventArgs(long address, byte []memory)
|
||||
{
|
||||
Address = address;
|
||||
Memory = memory;
|
||||
}
|
||||
}
|
||||
public delegate void MemoryUpdateEventHandler(object sender, MemoryUpdateEventArgs args);
|
||||
|
||||
public class ModuleListEventArgs : EventArgs
|
||||
{
|
||||
public readonly long Address;
|
||||
public readonly string Module;
|
||||
public ModuleListEventArgs(string module, long address)
|
||||
{
|
||||
Module = module;
|
||||
Address = address;
|
||||
}
|
||||
}
|
||||
public delegate void ModuleListEventHandler(object sender, ModuleListEventArgs args);
|
||||
#endregion
|
||||
|
||||
public class Gdb : GdbProtocol
|
||||
{
|
||||
string []X86RegisterNames = new string[] {
|
||||
"eax", "ecx", "edx", "ebx",
|
||||
"esp", "ebp", "esi", "edi",
|
||||
"eip", "eflags", "cs", "ss",
|
||||
"ds", "es", "fs", "gs",
|
||||
"st0", "st1", "st2", "st3",
|
||||
"st4", "st5", "st6", "st7",
|
||||
"fctrl", "fstat", "ftag", "fiseg",
|
||||
"fioff", "foseg", "fooff", "fop",
|
||||
"xmm0", "xmm1", "xmm2", "xmm3",
|
||||
"xmm4", "xmm5", "xmm6", "xmm7",
|
||||
"mxcsr"
|
||||
};
|
||||
|
||||
enum ExpectedReplyPacket
|
||||
{
|
||||
gPacketReply,
|
||||
pPacketReply,
|
||||
SuccessOrFailure
|
||||
}
|
||||
|
||||
bool mRunning;
|
||||
public bool Running { get { return mRunning; } }
|
||||
|
||||
int mSignal;
|
||||
long []mRegisters = new long[32];
|
||||
|
||||
#region Memory updates
|
||||
public class MemoryBlock
|
||||
{
|
||||
public readonly long Address;
|
||||
public readonly byte[] Block;
|
||||
public MemoryBlock(long address)
|
||||
{
|
||||
Address = address;
|
||||
Block = new byte[mMemoryBlockSize];
|
||||
}
|
||||
}
|
||||
|
||||
long mNextMemoryResult;
|
||||
static int mMemoryBlockSize = 0x100;
|
||||
Dictionary<long, MemoryBlock> mMemState = new Dictionary<long, MemoryBlock>();
|
||||
|
||||
public MemoryBlock GetMemoryBlock(long addr)
|
||||
{
|
||||
MemoryBlock result;
|
||||
addr &= mMemoryBlockSize - 1;
|
||||
if (!mMemState.TryGetValue(addr, out result))
|
||||
{
|
||||
result = new MemoryBlock(addr);
|
||||
mMemState[addr] = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Breakpoints
|
||||
public class Breakpoint
|
||||
{
|
||||
public enum BPType { Software, Hardware, WriteWatch, ReadWatch, AccessWatch };
|
||||
public readonly BPType BreakpointType;
|
||||
public readonly long Address;
|
||||
public readonly int Length;
|
||||
public Breakpoint(BPType type, long addr, int len)
|
||||
{
|
||||
BreakpointType = type;
|
||||
Address = addr;
|
||||
Length = len;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (int)(((int)BreakpointType) ^ Address ^ (Length << 28));
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
Breakpoint otherbp = other as Breakpoint;
|
||||
if (otherbp == null) return false;
|
||||
return
|
||||
(otherbp.BreakpointType == BreakpointType) &&
|
||||
(otherbp.Address == Address) &&
|
||||
(otherbp.Length == Length);
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<Breakpoint,Breakpoint> mBreakpoints = new Dictionary<Breakpoint,Breakpoint>();
|
||||
|
||||
public void SetBreakpoint(Breakpoint bp)
|
||||
{
|
||||
if (!mBreakpoints.ContainsKey(bp))
|
||||
{
|
||||
mBreakpoints[bp] = bp;
|
||||
SendBPCommand('Z', bp);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveBreakpoint(Breakpoint bp)
|
||||
{
|
||||
mBreakpoints.Remove(bp);
|
||||
SendBPCommand('z', bp);
|
||||
}
|
||||
|
||||
void SendBPCommand(char ch, Breakpoint bp)
|
||||
{
|
||||
SendMessage
|
||||
(string.Format
|
||||
("{0}{1},{2:X},{3:X}",
|
||||
ch, (int)bp.BreakpointType, bp.Address, bp.Length));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
public event ConsoleOutputEventHandler ConsoleOutputEvent;
|
||||
public event RegisterChangeEventHandler RegisterChangeEvent;
|
||||
public event SignalDeliveredEventHandler SignalDeliveredEvent;
|
||||
public event RemoteGDBErrorHandler RemoteGDBError;
|
||||
public event MemoryUpdateEventHandler MemoryUpdateEvent;
|
||||
public event ModuleListEventHandler ModuleListEvent;
|
||||
#endregion
|
||||
|
||||
#region Packet receive
|
||||
public virtual void EmptyReply()
|
||||
{
|
||||
}
|
||||
|
||||
string hexdig = "[0-9a-fA-F]";
|
||||
Regex mAllHex = new Regex("[0-9a-fA-F]+");
|
||||
Regex mModuleLoaded = new Regex("M(?<sectaddr>[0-9a-fA-F]+),(?<modname>.+)");
|
||||
|
||||
protected override void ReceivePacket(string payload)
|
||||
{
|
||||
// An empty reply can be a handshake response; treat accordingly
|
||||
if (payload.Length == 0)
|
||||
{
|
||||
EmptyReply();
|
||||
return;
|
||||
}
|
||||
else if (payload == "OK")
|
||||
{
|
||||
// Maybe have an OK event?
|
||||
return;
|
||||
}
|
||||
// Output doesn't change state
|
||||
else if (payload[0] == 'O')
|
||||
{
|
||||
if (ConsoleOutputEvent != null)
|
||||
ConsoleOutputEvent(this, new ConsoleOutputEventArgs(payload.Substring(1)));
|
||||
return;
|
||||
}
|
||||
else if (payload[0] == 'S')
|
||||
{
|
||||
if (SignalDeliveredEvent != null)
|
||||
SignalDeliveredEvent(this, new SignalDeliveredEventArgs(int.Parse(payload.Substring(1,2), NumberStyles.HexNumber)));
|
||||
return;
|
||||
}
|
||||
else if (payload[0] == 'E')
|
||||
{
|
||||
if (RemoteGDBError != null)
|
||||
RemoteGDBError(this, new RemoteGDBErrorArgs(int.Parse(payload.Substring(1,2), NumberStyles.HexNumber)));
|
||||
return;
|
||||
}
|
||||
else if (payload[0] == 'M')
|
||||
{
|
||||
Match modmatch = mModuleLoaded.Match(payload);
|
||||
Console.WriteLine("Module [" + payload + "]");
|
||||
if (modmatch.Success)
|
||||
{
|
||||
if (ModuleListEvent != null)
|
||||
ModuleListEvent
|
||||
(this,
|
||||
new ModuleListEventArgs
|
||||
(modmatch.Groups["modname"].ToString(),
|
||||
int.Parse
|
||||
(modmatch.Groups["sectaddr"].ToString(),
|
||||
NumberStyles.HexNumber)));
|
||||
}
|
||||
}
|
||||
else if (payload[0] == 'R')
|
||||
{
|
||||
int i;
|
||||
|
||||
Console.WriteLine("Got Register Update");
|
||||
|
||||
for (i = 1; i < payload.Length; i += 8)
|
||||
{
|
||||
string regdata =
|
||||
payload.Substring(i+6,2) + payload.Substring(i+4,2) +
|
||||
payload.Substring(i+2,2) + payload.Substring(i,2);
|
||||
mRegisters[i>>3] = long.Parse(regdata, NumberStyles.HexNumber);
|
||||
}
|
||||
if (RegisterChangeEvent != null)
|
||||
RegisterChangeEvent(this, new RegisterChangeEventArgs(mRegisters));
|
||||
}
|
||||
else if (payload[0] == 'X')
|
||||
{
|
||||
int i;
|
||||
MemoryBlock mb = GetMemoryBlock(mNextMemoryResult);
|
||||
int blockOffset = (int)(mNextMemoryResult & (mMemoryBlockSize - 1));
|
||||
for (i = 0; i < payload.Length; i += 2)
|
||||
{
|
||||
int by = int.Parse(payload.Substring(i,2), NumberStyles.HexNumber);
|
||||
mb.Block[blockOffset++] = (byte)by;
|
||||
|
||||
if (blockOffset == mMemoryBlockSize)
|
||||
{
|
||||
if (MemoryUpdateEvent != null)
|
||||
MemoryUpdateEvent(this, new MemoryUpdateEventArgs(mb.Address, mb.Block));
|
||||
mNextMemoryResult += blockOffset;
|
||||
blockOffset = 0;
|
||||
mb = GetMemoryBlock(mNextMemoryResult);
|
||||
}
|
||||
}
|
||||
if (blockOffset != 0)
|
||||
{
|
||||
if (MemoryUpdateEvent != null)
|
||||
MemoryUpdateEvent(this, new MemoryUpdateEventArgs(mb.Address, mb.Block));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Actions on the target
|
||||
public void GetRegisterUpdate()
|
||||
{
|
||||
SendMessage("g");
|
||||
}
|
||||
|
||||
public void GetMemoryUpdate(long address, int len)
|
||||
{
|
||||
SendMessage
|
||||
(string.Format
|
||||
("m{0:X},{1:X}", address, len));
|
||||
}
|
||||
|
||||
public void WriteMemory(long address, byte[] buf)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (byte b in buf)
|
||||
sb.Append(string.Format("{0:X2}", b));
|
||||
SendMessage
|
||||
(string.Format
|
||||
("M{0:X},{1:X}:{2}", address, buf.Length, sb.ToString()));
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
SendMessage("s");
|
||||
}
|
||||
|
||||
public void Break()
|
||||
{
|
||||
SendBreak();
|
||||
}
|
||||
|
||||
public void Go(long address)
|
||||
{
|
||||
if (address != 0)
|
||||
SendMessage(string.Format("c{0:X2}", address));
|
||||
else
|
||||
SendMessage("c");
|
||||
}
|
||||
#endregion
|
||||
|
||||
public Gdb(Pipe p) : base(p) { }
|
||||
}
|
||||
}
|
152
RosDBG/gdbbase.cs
Normal file
152
RosDBG/gdbbase.cs
Normal file
@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Timers;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Gdb
|
||||
{
|
||||
public class PipeReceiveEventArgs
|
||||
{
|
||||
public readonly string Received;
|
||||
public PipeReceiveEventArgs(string received)
|
||||
{
|
||||
Received = received;
|
||||
}
|
||||
}
|
||||
public delegate void PipeReceiveEventHandler(object sender, PipeReceiveEventArgs args);
|
||||
public interface Pipe
|
||||
{
|
||||
event PipeReceiveEventHandler PipeReceiveEvent;
|
||||
bool Write(string output);
|
||||
}
|
||||
|
||||
public class GdbProtocol
|
||||
{
|
||||
Pipe mPipe;
|
||||
List<string> mSendBuffer = new List<string>();
|
||||
StringBuilder mInputBuffer = new StringBuilder();
|
||||
Timer mTimer = new Timer();
|
||||
int mMessageId = 0;
|
||||
|
||||
public void SendMessage(string msg)
|
||||
{
|
||||
byte csum = 0;
|
||||
foreach (char addend in msg) { csum += (byte)addend; }
|
||||
mSendBuffer.Add(string.Format("${0}#{1:X2}#{1:X3}", msg, csum, mMessageId++));
|
||||
mPipe.Write(mSendBuffer[0]);
|
||||
}
|
||||
|
||||
// Break isn't a packet... its effect is immediate
|
||||
public void SendBreak()
|
||||
{
|
||||
mPipe.Write("\x03\x03\x03\x03\x03");
|
||||
}
|
||||
|
||||
public void SendStart()
|
||||
{
|
||||
mPipe.Write("---");
|
||||
}
|
||||
|
||||
bool CheckSum(string payload, int checksum)
|
||||
{
|
||||
byte newcsum = 0;
|
||||
foreach (char p in payload)
|
||||
{
|
||||
newcsum += (byte)p;
|
||||
}
|
||||
return checksum == newcsum;
|
||||
}
|
||||
|
||||
static Regex mPacketRegex =
|
||||
new Regex("[^$]*\\$(?<payload>[^#]*)\\#(?<checksum>[0-9a-fA-F][0-9a-fA-F])\\#(?<mid>[0-9a-fA-F][0-9a-fA-F])(?<tail>.*)");
|
||||
int mLastId;
|
||||
|
||||
void RecvFired(object sender, PipeReceiveEventArgs args)
|
||||
{
|
||||
string msg = args.Received;
|
||||
|
||||
// Must get a confirmation as a single message
|
||||
if (msg.Length > 0 && msg[0] == '+')
|
||||
{
|
||||
if (mSendBuffer.Count > 0) mSendBuffer.RemoveAt(0);
|
||||
msg = msg.Substring(1);
|
||||
}
|
||||
|
||||
mInputBuffer.Append(msg);
|
||||
string inbuf = mInputBuffer.ToString();
|
||||
bool matched = false;
|
||||
bool parsed = false;
|
||||
|
||||
// Leave if there's no '$' in the buffer. We don't need to
|
||||
// process further
|
||||
if (inbuf.IndexOf('$') == -1)
|
||||
{
|
||||
mInputBuffer = new StringBuilder("");
|
||||
return;
|
||||
}
|
||||
|
||||
Match m = mPacketRegex.Match(inbuf);
|
||||
|
||||
while (m.Success)
|
||||
{
|
||||
string payload = m.Groups["payload"].ToString();
|
||||
string checksum = m.Groups["checksum"].ToString();
|
||||
string midstr = m.Groups["mid"].ToString();
|
||||
int mid = int.Parse(midstr, NumberStyles.HexNumber);
|
||||
matched = true;
|
||||
|
||||
if (CheckSum(payload, int.Parse(checksum, NumberStyles.HexNumber)))
|
||||
{
|
||||
parsed = true;
|
||||
try
|
||||
{
|
||||
if (mid != mLastId)
|
||||
{
|
||||
mLastId = mid;
|
||||
ReceivePacket(payload);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Error parsing [{0}]: {1}", payload, e.Message);
|
||||
}
|
||||
mPipe.Write("+");
|
||||
}
|
||||
mInputBuffer = new StringBuilder("");
|
||||
mInputBuffer.Append(inbuf = m.Groups["tail"].ToString());
|
||||
m = mPacketRegex.Match(inbuf);
|
||||
}
|
||||
|
||||
// On the safe side, send a nak if we got a packet, but it didn't
|
||||
// check
|
||||
if (matched && !parsed)
|
||||
{
|
||||
mPipe.Write("-");
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ReceivePacket(string payload)
|
||||
{
|
||||
Console.WriteLine("got payload: " + payload);
|
||||
}
|
||||
|
||||
void ResendTimer(object sender, ElapsedEventArgs args)
|
||||
{
|
||||
if (mSendBuffer.Count > 0)
|
||||
{
|
||||
mPipe.Write(mSendBuffer[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public GdbProtocol(Pipe pipe)
|
||||
{
|
||||
mPipe = pipe;
|
||||
mPipe.PipeReceiveEvent += RecvFired;
|
||||
mTimer.Elapsed += ResendTimer;
|
||||
mTimer.Start();
|
||||
}
|
||||
}
|
||||
}
|
19
RosDBG/hextest.cs
Normal file
19
RosDBG/hextest.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Gdb
|
||||
{
|
||||
public class GdbSocketTest
|
||||
{
|
||||
public static void Main(string []args)
|
||||
{
|
||||
foreach (string arg in args)
|
||||
{
|
||||
Console.WriteLine(long.Parse(arg, NumberStyles.HexNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
45
RosDBG/socketpipe.cs
Normal file
45
RosDBG/socketpipe.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Gdb
|
||||
{
|
||||
public class SocketPipe : Pipe
|
||||
{
|
||||
Socket mSocket;
|
||||
byte []mBuf = new byte[4096];
|
||||
IAsyncResult mResult;
|
||||
|
||||
public event PipeReceiveEventHandler PipeReceiveEvent;
|
||||
public bool Write(string output)
|
||||
{
|
||||
byte []outbuf = UTF8Encoding.UTF8.GetBytes(output);
|
||||
int off = 0, res;
|
||||
do
|
||||
{
|
||||
res = mSocket.Send(outbuf, off, outbuf.Length - off, SocketFlags.None);
|
||||
if (res > 0)
|
||||
off += res;
|
||||
}
|
||||
while (off < outbuf.Length && res != -1);
|
||||
return off == outbuf.Length;
|
||||
}
|
||||
|
||||
public void TriggerReadable(IAsyncResult result)
|
||||
{
|
||||
int bytes = mSocket.EndReceive(mResult);
|
||||
string datastr = UTF8Encoding.UTF8.GetString(mBuf, 0, bytes);
|
||||
if (PipeReceiveEvent != null)
|
||||
PipeReceiveEvent(this, new PipeReceiveEventArgs(datastr));
|
||||
mResult = mSocket.BeginReceive
|
||||
(mBuf, 0, mBuf.Length, SocketFlags.None, TriggerReadable, this);
|
||||
}
|
||||
|
||||
public SocketPipe(Socket socket)
|
||||
{
|
||||
mSocket = socket;
|
||||
mResult = mSocket.BeginReceive
|
||||
(mBuf, 0, mBuf.Length, SocketFlags.None, TriggerReadable, this);
|
||||
}
|
||||
}
|
||||
}
|
7
dbghelptest/Makefile
Normal file
7
dbghelptest/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
all: testline.exe
|
||||
|
||||
testline.exe: testline.o
|
||||
gcc -g -o testline.exe testline.o libdbghelp.a
|
||||
|
||||
testline.o: testline.c
|
||||
gcc -g -I. -c testline.c
|
BIN
dbghelptest/dbghelp.dll
Normal file
BIN
dbghelptest/dbghelp.dll
Normal file
Binary file not shown.
1377
dbghelptest/dbghelp.h
Normal file
1377
dbghelptest/dbghelp.h
Normal file
File diff suppressed because it is too large
Load Diff
237
dbghelptest/testline.c
Normal file
237
dbghelptest/testline.c
Normal file
@ -0,0 +1,237 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
|
||||
#define MAXNAMELEN 256
|
||||
// PSDK and MSDN disagree on the name of this
|
||||
#define SymMemberIndex info
|
||||
|
||||
#define SYMOPT_ALLOW_ZERO_ADDRESS 0x1000000
|
||||
|
||||
typedef struct StrIntPair {
|
||||
const char *name;
|
||||
int flag;
|
||||
} StrIntPair_t;
|
||||
|
||||
static StrIntPair_t symInfoFlags[] = {
|
||||
{ "SYMFLAG_CLR_TOKEN", 0x00040000 },
|
||||
{ "SYMFLAG_CONSTANT", 0x00000100 },
|
||||
{ "SYMFLAG_EXPORT", 0x00000200 },
|
||||
{ "SYMFLAG_FORWARDER", 0x00000400 },
|
||||
{ "SYMFLAG_FRAMEREL", 0x00000020 },
|
||||
{ "SYMFLAG_FUNCTION", 0x00000800 },
|
||||
{ "SYMFLAG_ILREL", 0x00010000 },
|
||||
{ "SYMFLAG_LOCAL", 0x00000080 },
|
||||
{ "SYMFLAG_METADATA", 0x00020000 },
|
||||
{ "SYMFLAG_PARAMETER", 0x00000040 },
|
||||
{ "SYMFLAG_REGISTER", 0x00000008 },
|
||||
{ "SYMFLAG_REGREL", 0x00000010 },
|
||||
{ "SYMFLAG_SLOT", 0x00008000 },
|
||||
{ "SYMFLAG_THUNK", 0x00002000 },
|
||||
{ "SYMFLAG_TLSREL", 0x00004000 },
|
||||
{ "SYMFLAG_VALUEPRESENT", 0x00000001 },
|
||||
{ "SYMFLAG_VIRTUAL", 0x00001000 },
|
||||
{ }
|
||||
};
|
||||
|
||||
void printFlags(StrIntPair_t *pairs, int flagValue)
|
||||
{
|
||||
int beenThere = 0;
|
||||
while(pairs->name) {
|
||||
if (pairs->flag & flagValue) {
|
||||
printf("%s%s", beenThere ? ", " : "", pairs->name);
|
||||
beenThere = 1;
|
||||
}
|
||||
pairs++;
|
||||
}
|
||||
}
|
||||
|
||||
void printDbgStruct(PSYMBOL_INFO symInfo)
|
||||
{
|
||||
printf("-- SYMBOL INFO --\n");
|
||||
printf(" TypeIndex: ... %08x\n", symInfo->TypeIndex);
|
||||
printf(" Index: ....... %08x\n", symInfo->SymMemberIndex);
|
||||
printf(" Size: ........ %08x\n", symInfo->Size);
|
||||
printf(" Flags: ....... %08x -- ", symInfo->Flags);
|
||||
printFlags(symInfoFlags, symInfo->Flags); printf("\n");
|
||||
printf(" Value: ....... %08x\n", symInfo->Value);
|
||||
printf(" Address: ..... %08x\n", (ULONG)symInfo->Address);
|
||||
printf(" Register: .... %08x\n", symInfo->Register);
|
||||
printf(" Scope: ....... %08x\n", symInfo->Scope);
|
||||
printf(" Tag: ......... %08x\n", symInfo->Tag);
|
||||
printf(" Name: ........ %s\n", symInfo->Name);
|
||||
printf("-- SYMBOL INFO END --\n");
|
||||
}
|
||||
|
||||
void printHlpSymbol(PIMAGEHLP_SYMBOL64 byNameSymbol)
|
||||
{
|
||||
printf("== SYMBOL INFO ==\n");
|
||||
printf(" Address: ..... %08x\n", (ULONG)byNameSymbol->Address);
|
||||
printf(" Size: ........ %08x\n", byNameSymbol->Size);
|
||||
printf(" Name: ........ %s\n", byNameSymbol->Name);
|
||||
printf("== SYMBOL INFO END ==\n");
|
||||
}
|
||||
|
||||
BOOL CALLBACK PrintSymbols(PSYMBOL_INFO symInfo, ULONG symbolSize, PVOID userContext)
|
||||
{
|
||||
printDbgStruct(symInfo);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
DWORD moduleAddr, displacement, testAddr;
|
||||
DWORD64 displacement64;
|
||||
char fileName[256];
|
||||
IMAGEHLP_LINE64 lineNumberIdent = { };
|
||||
HANDLE hProcess = (HANDLE)((rand() & ~3) + 1);
|
||||
|
||||
DWORD symIndex;
|
||||
BYTE symInfoBuf[sizeof(SYMBOL_INFO)+MAXNAMELEN-1];
|
||||
PSYMBOL_INFO symInfo = (PSYMBOL_INFO)symInfoBuf;
|
||||
|
||||
BYTE byNameSymbolBuf[sizeof(IMAGEHLP_SYMBOL64)+MAXNAMELEN-1];
|
||||
PIMAGEHLP_SYMBOL64 byNameSymbol = (PIMAGEHLP_SYMBOL64)byNameSymbolBuf;
|
||||
|
||||
IMAGEHLP_STACK_FRAME stackFrame = { };
|
||||
|
||||
symInfo->SizeOfStruct = sizeof(*symInfo);
|
||||
symInfo->MaxNameLen = MAXNAMELEN - 1;
|
||||
|
||||
byNameSymbol->SizeOfStruct = sizeof(*byNameSymbol);
|
||||
byNameSymbol->MaxNameLength = MAXNAMELEN - 1;
|
||||
|
||||
lineNumberIdent.SizeOfStruct = sizeof(lineNumberIdent);
|
||||
SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_ALLOW_ZERO_ADDRESS | SYMOPT_LOAD_ANYTHING);
|
||||
|
||||
if (!SymInitialize(hProcess, NULL, FALSE))
|
||||
{
|
||||
printf("Could not initialize dbghelp\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
sscanf(argv[2], "%x", &moduleAddr);
|
||||
if (!SymLoadModuleEx
|
||||
(hProcess,
|
||||
NULL,
|
||||
argv[1],
|
||||
NULL,
|
||||
moduleAddr,
|
||||
0,
|
||||
NULL,
|
||||
0))
|
||||
{
|
||||
printf("Could not do SymLoadModule on %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
if (!SymGetSymFromAddr64
|
||||
(hProcess,
|
||||
moduleAddr,
|
||||
&displacement64,
|
||||
byNameSymbol))
|
||||
{
|
||||
printf("Could not get root symbol at %x for %s\n", moduleAddr, argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printHlpSymbol(byNameSymbol);
|
||||
|
||||
if (!SymFromAddr
|
||||
(hProcess,
|
||||
byNameSymbol->Address,
|
||||
&displacement64,
|
||||
symInfo))
|
||||
{
|
||||
printf("SymFromAddr failed for addr %x\n", testAddr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printDbgStruct(symInfo);
|
||||
while (SymGetSymNext64(hProcess, byNameSymbol))
|
||||
{
|
||||
printHlpSymbol(byNameSymbol);
|
||||
|
||||
if (!SymFromAddr
|
||||
(hProcess,
|
||||
byNameSymbol->Address,
|
||||
&displacement64,
|
||||
symInfo))
|
||||
{
|
||||
printf("SymFromAddr failed for addr %x\n", testAddr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printDbgStruct(symInfo);
|
||||
}
|
||||
}
|
||||
else if (!strcmp("-va", argv[3]))
|
||||
{
|
||||
if (argc == 4)
|
||||
{
|
||||
printf("-va requires a global name to look up\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!SymGetSymFromName64(hProcess, argv[4], byNameSymbol))
|
||||
{
|
||||
printf("Couldn't find symbol named %s\n", argv[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
testAddr = byNameSymbol->Address;
|
||||
|
||||
printHlpSymbol(byNameSymbol);
|
||||
|
||||
if (!SymFromAddr
|
||||
(hProcess,
|
||||
byNameSymbol->Address,
|
||||
&displacement64,
|
||||
symInfo))
|
||||
{
|
||||
printf("SymFromAddr failed for addr %x\n", testAddr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printDbgStruct(symInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(argv[3], "%x", &testAddr);
|
||||
|
||||
if (!SymGetLineFromAddr64
|
||||
(hProcess,
|
||||
testAddr,
|
||||
&displacement,
|
||||
&lineNumberIdent))
|
||||
{
|
||||
printf("SymGetLineFromAddr64 failed for addr %x\n", testAddr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("%x -> %s:%d\n", testAddr, lineNumberIdent.FileName, lineNumberIdent.LineNumber);
|
||||
|
||||
if (!SymFromAddr
|
||||
(hProcess,
|
||||
testAddr,
|
||||
&displacement64,
|
||||
symInfo))
|
||||
{
|
||||
printf("SymFromAddr failed for addr %x\n", testAddr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("In function %s\n", symInfo->Name);
|
||||
}
|
||||
|
||||
stackFrame.InstructionOffset = testAddr;
|
||||
|
||||
if (SymSetContext(hProcess, &stackFrame, 0) || !GetLastError())
|
||||
SymEnumSymbols(hProcess, 0, 0, PrintSymbols, NULL);
|
||||
else
|
||||
printf("Could not set context for address %x\n", testAddr);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user