title: How to set a breakpoint with lldb + mono
body: <p>I have the following C# program (test.cs) which I want to debug:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  class Program
  {
      static void Main(string[] args)
      {
          Console.WriteLine( "Hello, World!" );
          List&lt;int&gt; list = new List&lt;int&gt;();
          list.Add(123);
          list.Add(234);
          list.Add(345);
          list.Add(456);
          int number = 4;
          ++number;
          Console.WriteLine(" number " + number); // &lt;--- L:16 I want to set a breakpoint here :)
          Console.WriteLine("Number of elements" + list.Count);
          foreach (Object obj in list)
          {
              Console.WriteLine(" " + obj);
          }
          Console.WriteLine("Bye");
      }
  }
  </code></pre>
  
  <p>And below is the debug session using <strong>lldb</strong> and <strong>mono</strong> (I am in OSX). I can start the session and run the program however I am not able to setup any breakpoint. I guess that when using mono as the executable file things are different. How can I achieve this?</p>
  
  <pre><code>$ mcs -debug test.cs
  $ lldb 
  (lldb) target create mono
  Current executable set to 'mono' (i386).
  (lldb) b test.cs:16
  Breakpoint 1: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.
  (lldb) run --debug test.exe 
  Process 15191 launched: '/usr/bin/mono' (i386)
  Hello, World!
   number 5
  Number of elements4
   123
   234
   345
   456
  Bye
  Process 15191 exited with status = 0 (0x00000000) 
  (lldb) 
  </code></pre>
  
  <p>I've tried with GBD as <a href="http://www.mono-project.com/Debugging#Debugging_with_GDB" rel="nofollow">this old guide suggests</a> but it is worse, apparently there is <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=15090" rel="nofollow">something broken in mono in OSX</a> that makes it impossible to debug unless the soft debugger is used (which is exactly what I want to avoid. MonoDevelop debugger is really really unstable/unreliable/slow). This is <a href="https://gist.github.com/nacho4d/14344cc175c159e6ed0d" rel="nofollow">what I have tried with GBD</a>. No luck at all.</p>
  
  <p>And help is appreciated. </p>