4

Possible Duplicate:
What is a good approach to building a debugger for a .NET language?

I have a Lisp-style language that I want to build a debugger for. My language is here - https://github.com/bryanedds/aml .

I am likely going to compile it down to IL. If it's helpful for writing the debugger, I'll write the compiler first. However, I am wondering what are some approaches for building the debugger. I looked at building it for Visual Studio, but that's difficult as it seems to require me to interface with VS via COM, meaning I need to write the debugger in C or C++ (UGH!). I'm hoping that Visual Studio Debugger development has a better story that I'm not aware of.

Looking at other threads on .NET debugging on SO, I see that IL includes source file coordinates, so I wonder if that means that I don't need to write as much COM code as one would initially suspect (EG - step debugging works out of the box without any COM code so long as the compiled IL has source file coordinates).

Alternatively, I could look at using another IDE that maybe has a happier path for .NET language debugging. There is Eclipse, but it doesn't seem to have any particular support for .NET language debugging.

Perhaps the IDE with the best debugger building story might be MonoDevelop. Of course, I'd need it to work with MS .NET instead of just Mono. However, it's documentation is rather bare. Anyone have experience building a debugger there?

So, as you can see, I'm rather lost in all this. I just need some ways to build a simple debugger with breakpoints and step debugging with variable inspection for my .NET language. I'd prefer to write most of the code in F# as that's what my language is written in.

Ilmari Karonen
  • 49,047
  • 9
  • 93
  • 153
Bryan Edds
  • 1,696
  • 12
  • 28
  • 1
    Please, don't repost exactly the same question that you asked before. The previous one was closed, why do you think this one won't? You could try editing your question to make it more constructive and then flag it for moderator attention to reopen it. – svick Sep 10 '12 at 16:54
  • 1
    @svick - I don't see anything wrong with the question (I mean, it's a bit muddled, but not clearly defective). No comments were left on the previously closed question that would suggest avenues for improvement. What does Bryan need to change to make it better? – kvb Sep 10 '12 at 16:59
  • Yep, someone just closed the previous one without any explanation, so I tried to change the question to be less subjective (now I ask what the different approaches are without asking which ones are better). Without any explanation as to why the previous question was closed, I cannot know what else I'm supposed to change. – Bryan Edds Sep 10 '12 at 17:17
  • @kvb I'm not sure why exactly was the question closed. But I do think that reposting it was not the right way to do it, reopening the old question might be. – svick Sep 10 '12 at 19:01
  • 2
    @svick - In theory I agree, but from a practical standpoint I'm not sure whether Bryan would have been able to get it reopened... How could he find out what the moderator thought needed to be changed? And then how would he get enough attention for a sufficient number of people to cast reopen votes? – kvb Sep 10 '12 at 20:03
  • See also: [Making a CLR/.NET Language Debuggable](https://stackoverflow.com/questions/4357420/making-a-clr-net-language-debuggable) and [Making your .NET language step correctly in the debugger](https://stackoverflow.com/questions/6937198/making-your-net-language-step-correctly-in-the-debugger) – Ilmari Karonen Feb 05 '19 at 01:22

1 Answers1

7

If you're going to use System.Reflection.Emit to compile your language to IL, then it should be quite easy to also generate debug information with your code (pdb file) and Visual Studio will pick that up automatically (so you do not have to write a debugger).

  • Emitting Symbolic Information with Reflection Emit on MSDN has some information on this.

  • You can also take a look at TickSpec source code, which is written in F# and uses this to enable debugging in files that describe the testing scenario (if you look at the video, on the home page, you can see that he can place breakpoints in the text file).

I don't think that writing a debugger for a .NET language is what you need - there is already a pretty good debugger in Visual Studio, so you just need to enable your language to use it.

Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553
  • Ah, this is starting to make sense now. I thought I would have to write all the backend stuff myself then connect it up to VS with COM. Very glad that is not the case! – Bryan Edds Sep 10 '12 at 17:19
  • 4
    How can the original question have been closed as unconstructive when Tomas was able to give a concise, constructive answer? – Kit Sep 11 '12 at 05:58
  • 2
    Kit, I think it's because SO is a social site, and social sites always become overrun by the unthinking masses. There is a reason that social media is regarded as a fad; all social websites eventually devolve into knee-jerk mob mentality. SO is clearly on its way. – Bryan Edds Sep 11 '12 at 12:10
  • @Tomas: This could work under mono/xamarin? – mamcx Jun 24 '15 at 01:21
  • I believe so, but I have not tried it... – Tomas Petricek Jun 24 '15 at 01:45