Re: Debugger API
From: Jan Stranik (jstranik_at_online.microsoft.com)
Date: 09/15/04
- Previous message: Ken Kolda: "Re: Creating a Singleton that is a cross AppDomain Singleton"
- In reply to: Sergey: "Re: Debugger API"
- Next in thread: Sergey: "Re: Debugger API"
- Reply: Sergey: "Re: Debugger API"
- Reply: Sergey: "Re: Debugger API"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 19:06:15 GMT
Hello Aniskevich,
I understand the reading (and also writing) debugger code is non-trivial.
The API is pretty complicated. On the other hand you
need to expect non-trivial API for anything that is doing so powerfull
operation as enabling debugging.
I recommend you studying code in the corapi\debug directory first in the
sample. Also, please refer to CorDebug.idl header file that describes
what individual API do.
If you want to learn more about the debugger, and would like to get to some
more simplistic code, I would recommand, that you start with
the mentioned sample and keep removing parts that you don't need.
/jan
--------------------
| From: aniskevichsn@mail.ru (Sergey)
| Newsgroups: microsoft.public.dotnet.framework.clr
| Subject: Re: Debugger API
| Date: 13 Sep 2004 23:00:17 -0700
| Organization: http://groups.google.com
| Lines: 115
| Message-ID: <be01093e.0409132200.2c052a94@posting.google.com>
| References: <#fXueyZkEHA.3788@TK2MSFTNGP14.phx.gbl>
<dcAuBkbmEHA.404@cpmsftngxa06.phx.gbl>
| NNTP-Posting-Host: 195.225.130.127
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1095141617 7566 127.0.0.1 (14 Sep 2004
06:00:17 GMT)
| X-Complaints-To: groups-abuse@google.com
| NNTP-Posting-Date: Tue, 14 Sep 2004 06:00:17 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news.glorb.com!postnews2.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.clr:11802
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
|
| Thanks for your answer.
| I studied before your example
|
(http://www.microsoft.com/downloads/details.aspx?familyid=38449a42-6b7a-4e28
-80ce-c55645ab1310&displaylang=en),
| however it very complex and I has got confused.
|
| If it is possible, send, please, the simple example in which occurs
| creation ICorDebug, ICorDebugManagedCallback and calling method
| CreateProcess.
|
|
| Beforehand thanks.
| e-mail: aniskevichsn@mail.ru
|
| jstranik@online.microsoft.com (Jan Stranik) wrote in message
news:<dcAuBkbmEHA.404@cpmsftngxa06.phx.gbl>...
| > Hello Aniskevich,
| > from your code snippet I cannot determine why is your code not working.
| > Generally it is possible to write a debugger in managed code.
| > We have a complete sample of managed debugger written in C#, feel free
to
| > refer to it for your needs,
| > The sample is located at:
| >
http://www.microsoft.com/downloads/details.aspx?familyid=38449a42-6b7a-4e28-
| > 80ce-c55645ab1310&displaylang=en.
| >
| > Regards
| > /jan
| >
| > --------------------
| > >From: Aniskevich Sergey via .NET 247 <anonymous@dotnet247.com>
| > >X-Newsreader: AspNNTP 1.50 (Matthew Reynolds Consulting)
| > >Subject: Debugger API
| > >Mime-Version: 1.0
| > >Content-Type: text/plain; charset="us-ascii"
| > >Content-Transfer-Encoding: 7bit
| > >Message-ID: <#fXueyZkEHA.3788@TK2MSFTNGP14.phx.gbl>
| > >Newsgroups: microsoft.public.dotnet.framework.clr
| > >Date: Fri, 03 Sep 2004 02:58:52 -0700
| > >NNTP-Posting-Host: 81-86-69-114.dsl.pipex.com 81.86.69.114
| > >Lines: 1
| > >Path:
| >
cpmsftngxa10.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP0
| > 8.phx.gbl!TK2MSFTNGP14.phx.gbl
| > >Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.clr:11779
| > >X-Tomcat-NG: microsoft.public.dotnet.framework.clr
| > >
| > >I am have problem with Debugging API under C# (Framework 2.0). A am
run
| > Debugged process as follows:
| > >
| > >int size;
| > > GetCORVersion(null, 0, out size);
| > > Debug.Assert(size > 0);
| > > StringBuilder sb = new StringBuilder(size);
| > > int hr = GetCORVersion(sb, sb.Capacity, out size);
| > >
| > > CreateDebuggingInterfaceFromVersion(3, sb.ToString(), out
| > m_ICorDebug);
| > > Debug.Assert(m_ICorDebug != null);
| > >
| > > m_ICorDebug.Initialize();
| > > CManagedCallback _mc = new CManagedCallback(this);
| > > m_ICorDebug.SetManagedHandler(_mc);
| > >
| > >
| > > PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
| > >
| > > STARTUPINFO si = new STARTUPINFO();
| > > si.cb = Marshal.SizeOf(si);
| > >
| > > // initialize safe handles
| > > si.hStdInput = new
| > Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(0), false);
| > > si.hStdOutput = new
| > Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(0), false);
| > > si.hStdError = new
| > Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(0), false);
| > >
| > > //constrained execution region (CER)
| > >
| >
System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions();
| > > string commandLine = "WindowsApplication1.exe";
| > > string applicationName = null;
| > > int flags = 0;
| > > string currentDirectory = ".";
| > > IntPtr environment = new IntPtr(0);
| > >
| > > m_ICorDebug.CreateProcess(
| > > applicationName,
| > > commandLine,
| > > null,
| > > null,
| > > 1,
| > > (uint)flags,
| > > environment,
| > > currentDirectory,
| > > si,
| > > pi,
| > >
| > CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS,
| > > out m_ICorDebugProcess);
| > >
| > > CloseHandle(pi.hThread);
| > > CloseHandle(pi.hProcess);
| > >
| > >
| > >
| > >But one function of a class (CManagedCallbck :
ICorDebugManagedCallback)
| > is not callback.
| > >In what a problem?
| > >
| > >Best regards
| > >
| > >-----------------------
| > >Posted by a user from .NET 247 (http://www.dotnet247.com/)
| > >
| > ><Id>SOeem8tB8UWHhvFHTwmSdA==</Id>
| > >
|
- Previous message: Ken Kolda: "Re: Creating a Singleton that is a cross AppDomain Singleton"
- In reply to: Sergey: "Re: Debugger API"
- Next in thread: Sergey: "Re: Debugger API"
- Reply: Sergey: "Re: Debugger API"
- Reply: Sergey: "Re: Debugger API"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|