Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
Hello everyone .
I am working right now on a script language which is interpreted to C# and then compiled via CSharpCodeProvidor .. (I have my own IDE for the script language)

Well , firstly i want to understand how really VS can actually stop the application at runtime and then change (compiled) code and then even save it and simply resume !

Really , i want to create my own debugger in my IDE and also if i will success to replace compiled objects somehow like VS is doing i will be able to design some Real-Time programming and debugging mechanism for my own script language .

The first reason i want to know how it works is because real-time programming (Change code and resume the application without restarting every time)

and the second reason is for some good debugger (which is not really necessary after having the real-time mechanism)
Posted
Comments
bbirajdar 27-Dec-12 8:24am    
Good question.. I will wait till somebody answers
srabonir 28-Dec-12 0:52am    
Great discussions all together.My question for David is where actually you want to implement it?

 
Share this answer
 
v5
Comments
bbirajdar 27-Dec-12 9:29am    
Thank you for the info.. Something new I have never read about.. +5
Suvabrata Roy 27-Dec-12 23:57pm    
you welcome :)
Well to do that you must have an excellent knowledge in CLR and it's internall behavior and mechanism. Without it all your attempts will fail.

Also you must have clear imagination of how CLR work with conjunction of JIT compiler.

In brevity, you need to find a way to hhok up into the CLR so you comp can obser the behaviour of your app (this can be done by using a profiler).
A common language runtime (CLR) profiler is a dynamic link library (DLL) taht consist of functions that receive messages from and, send the messages to the CLR by using API.
This DLL is loaded by the clr at runtime.

The profiling API enforces your compiler with management functionality (to change the in-memory MSIL code stream from a routine before it will be JIT compiled).
in this manner profiler api can dynamically add instrumentation code to particular routines that need deeper investigatrion.
So basically profiler DLL provide you with few callbacks ICorProfilerInfo and ICorProfilerCallback, the last one get all information like :function entry, function exit , first one is implemented to query data from modules , retreive it metadata etc.

So all i have covered it's a tiny part of full mechanism.
And if i was attentive, you mention C# tag in that question.
My opinion, that knowledge of C# won't be enough, at least you must know C++
So if any questions , please ask.
 
Share this answer
 
Comments
bbirajdar 27-Dec-12 9:29am    
Thank you for the info.. Something new I have never read about.. +5
Oleksandr Kulchytskyi 27-Dec-12 9:32am    
Thanks for your mark,you are welcome =)
YES !

I have found here a very useful sample ! (Thanks to Suvabrata Roy for posting the entry blog)

In same blog i found here a download for a good sample of ICorDebug using .
With everything needed to establish same debugger as in VS !

http://www.microsoft.com/en-us/download/details.aspx?id=19621[^]
 
Share this answer
 
Comments
Suvabrata Roy 28-Dec-12 0:06am    
You welcome :) Enjoy coding...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900