[DOTNET-ROTOR] Method Entry/Return

2003-11-26 Thread SUBSCRIBE DOTNET-ROTOR Memomana
How do we capture each method invocation and return? Is it possible to
capture its information as well?

Thank you very much.

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


Re: [DOTNET-ROTOR] Method Entry/Return

2003-11-26 Thread Barry Bond
Take a look at the profiler, in sscli\samples\utilities\dnproprofiler.
There is a dnprofiler.html that describes a bit about the profiler
interface.  You should be able to use the JITCOmpilationStarted()
callback to instrument each method's IL as it is jitted.

Barry
This posting is provided AS IS with no warranties, and confers no
rights.

-Original Message-
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of SUBSCRIBE
DOTNET-ROTOR Memomana
Sent: Wednesday, November 26, 2003 8:30 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Method Entry/Return

How do we capture each method invocation and return? Is it possible to
capture its information as well?

Thank you very much.

===
This list is hosted by DevelopMentor(r)  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at
http://discuss.develop.com

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


Re: [DOTNET-ROTOR] Method Entry/Return

2003-11-26 Thread SUBSCRIBE DOTNET-ROTOR Memomana
The CProfilerCallBack::JITCompilationStarted function only displays the
method name that is being jitted.

if ( GetMethodNameFromFunctionId( functionId, wszClass, wszMethod ) )
{
   ProfilerPrintf(JITCompilationStarted: %ls::%ls\n,wszClass,wszMethod);
}
else
{
   ProfilerPrintf( JITCompilationStarted\n );
}

I found that the GetMethodNameFromFunctionId function is a helper function
to find the method name only.

How would we use the JITCompilationStarted() callback to instrument each
method's IL as it is jitted?

Moreover, when I set the DN_PROFILER_MASK to, for example, 0x20, the
profiler crashed. It complained: Fatal stack overflow error.

Thank you.

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


[DOTNET-ROTOR] Embedding rotor w/ Platform COM?

2003-11-26 Thread Nathan Herring
After peering at rotor for a while, it seems that if COM exists on the
platform, you could write an alternate PAL that took advantage of the
native COM. It seems that you could get interop out of rotor into COM
objects that way. However, I'm also interested in hosting the rotor
runtime by a native COM client. I didn't see a way to do this offhand.
Is this feasible? Is the code in rotor somewhere, or would I have to
write my own COM wrapper?

Thanks, 
nh 

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


Re: [DOTNET-ROTOR] Embedding rotor w/ Platform COM?

2003-11-26 Thread Barry Bond
You could host Rotor in-process inside a native app using the same
mechanism that clix.exe uses:  call Win32 LoadLibrary() on mscoree.dll,
then GetProcAddress for _CorExeMain2 and call it.  You *might* need to
first call LoadLibrary() on rotor_pal.dll and call its PAL_Initialize()
before loading mscoree.dll, just to be sure that the PAL is ready to go.

sscli\docs\techinfo\native_managed_interop.html describes Rotor's
Foreign Function Interface (FFI) which can be used to make calls from
native C/C++ code into managed code.  It would be a logical starting
place to build an interop layer that wraps a managed object with a COM
object.

Barry
This posting is provided AS IS with no warranties, and confers no
rights.

-Original Message-
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of Nathan Herring
Sent: Wednesday, November 26, 2003 3:38 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Embedding rotor w/ Platform COM?

[Try 3: After removing the digital signature, and after having it being
tossed as spam.]

After peering at rotor for a while, it seems that if COM exists on the
platform, you could write an alternate PAL that took advantage of the
native COM. It seems that you could get interop out of rotor into COM
objects that way. However, I'm also interested in hosting the rotor
runtime by a native COM client. I didn't see a way to do this offhand.
Is this feasible? Is the code in rotor somewhere, or would I have to
write my own COM wrapper?

Thanks, 
nh

===
This list is hosted by DevelopMentor(r)  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at
http://discuss.develop.com

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


Re: [DOTNET-ROTOR] Build rotor with visual studio.net?

2003-11-26 Thread Jan Kotas
The problem you are seeing is caused by optimization settings. The
default Rotor build flavor is fastchecked: both optimizations and
debugging instrumentation are turned on.

Try using the checked build flavor of Rotor. Setup the environment by
running env.bat checked and then do buildall as usual. The checked
build flavor has optimizations turned off so you should be able to watch
all variables, etc. On the other hand, the checked build flavor is
significantly slower.

-Jan

This posting is provided AS IS with no warranties, and confers no
rights.

-Original Message-
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of Sun, Yulin
Sent: Wednesday, November 26, 2003 5:59 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Build rotor with visual studio.net?

I found it was diffcult to debug rotor with visual studio.net with
devenv \debugexe clix helloworld.exe because some variable can't watch
from the watch window. Therefore I want to rebuild the rotor with visual
studio.net instead of the buildall of the rotor, but I failed to do
so. Has someone been success to do so or have some experience to do so?
Thank you.

===
This list is hosted by DevelopMentor(r)  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at
http://discuss.develop.com

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com


Re: [DOTNET-ROTOR] Method's IL Modification

2003-11-26 Thread Jan Kotas
Check Rewrite MSIL Code on the Fly with the .NET Framework Profiling
API article on MSDN:
http://msdn.microsoft.com/msdnmag/issues/03/09/NETProfilingAPI/default.a
spx . It should have answers to all your questions.

Note that there is bug in the profiler implementation in the final Rotor
v1 release - more details are at
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00511.ht
ml. 

You may also want to a look at
ICorProfilerInfo::SetEnterLeaveFunctionHooks. It gives you simple
Enter/Leave callbacks without rewriting the IL.

-Jan

This posting is provided AS IS with no warranties, and confers no
rights.

-Original Message-
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of SUBSCRIBE
DOTNET-ROTOR Memomana
Sent: Wednesday, November 26, 2003 8:11 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Method's IL Modification

I have followed the guide to use Get/SetILFunctionBody posted a while
ago by
Jan Kotas. The code works fine in my Rotor build.

I would like to modify the code so that the Main method displays a
Please
Help message before returning. i.e. if the original Main method
displays
Hello World, then the new code will make it display Hello World AND
Please Help.

In other words, the difference with Jan's code is that instead of
replacing
the original Main method's IL by a new IL to display Hello World, my
intention is to keep the original Main method's IL and add other new ILs
(in
this case, IL to display Please Help message).

I have managed to augment the IL code for displaying Please Help
before
Main returns.

Original IL code:
13 30 01 00 0b 00 00 00 00 00 00 00 72 01 00 00 70 28 02 00 00 0a 2a

My modified IL code:
13 30 01 00 0b 00 00 00 00 00 00 00 72 01 00 00 70 28 02 00 00 0a [72 1c
00
00 70 28 02 00 00 0a] 2a

The brackets are included only for easy reading.

Basically, I copied the original bytecode into a new (BYTE *) variable,
say
BYTE *X. Then, the last original bytecode (i.e. 2a) is copied to be the
last
bytecode of X. In between, I inserted the [72 1c 00 00 70 28 02 00 00
0a].

However, the Rotor complained:
VALIDATION FAILS: inPtr + sizeof(unsigned int) = inBuffEnd
At World.HelloWorld::Main at a
Unhandled Exception: System.InvalidProgramException: Common Language
Runtime
detected an invalid program.
   at World.HelloWorld.Main()

I figured that the new IL is not valid since, obviously, the size of the
IL
code is larger.
#1 How would we determine how much bigger?
#2 How would we set the new size back using the SetILFunctionBody
function?
#3 Any other (better) way to instrument the method's IL code?

Thank you beforehand.

===
This list is hosted by DevelopMentor(r)  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at
http://discuss.develop.com

===
This list is hosted by DevelopMentor®  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com