[Mono-dev] Porting Mono Debugger to OSX

Martin Baulig martin at ximian.com
Wed Apr 15 12:43:12 EDT 2009


On Tue, 2009-04-14 at 20:21 +0200, jonas echterhoff wrote:

> But, now I'm wondering, how setting of breakpoints should work. When I  
> launch mdb, set some breakpoints like "b Y.Test", and then run, that  
> causes OperationActivateBreakpoints and OperationInsertBreakpoint  
> operations to be executed, which call the function  
> debugger_insert_source_breakpoint inside mono. But, the breakpoints  
> never seem to be actually set (no calls to  
> server_ptrace_insert_breakpoint). How is this supposed to be invoked?

Hi,

When inserting managed breakpoints, the method is usually not JITed at
the time we insert the breakpoint, so we don't have any address for it
yet.  In addition to that, there may be more than one address for each
managed breakpoint - this happens when using multiple AppDomains.

Because of this, the JIT sends the debugger a notification each time a
method containing a breakpoint is compiled - see
`NotificationType.JitBreakpoint' in Notification() in
languages/mono/MonoLanguageBackend.cs.

Here, the debugger performs a symbol table lookup and then actually
inserts the breakpoint using server_ptrace_insert_breakpoint().

We need to do the symbol table lookup because we're usually not
inserting the breakpoint on the first instruction of the method, but on
some source line.

Martin



More information about the Mono-devel-list mailing list