[Mono-devel-list] monodebugger - Inserting breakpoints in a method that has been JITted

Martin Baulig martin at ximian.com
Wed Jan 19 09:11:00 EST 2005

On Wed, 2005-01-19 at 03:32 +0000, Rex R wrote:

> Have a question on how the mono debugger, given a sourceline number
> finds the address in memory where a software breakpoint 
> instruction has to be written.


> After looking at the code it looks like the symbol file is used to
> find the address corresponding to a source line.

the symbol file is used to map a source line to an IL offset, it does
not contain addresses.


> For a method that is already JITted, can we not use the following
> method?
> 1.Remember/Store the ILOffset to memory address mapping for each
> method that is JITted. 
> This can be done in mono_arch_output_basic_block in mini-x86.c (and is
> already being done 
> via a call to mono_debug_record_line_number).
> 2.When an "insert breakpoint" is requested on a particular source
> line, find the ILOffset for the source line, for the method.
> Lookup the ILOffset to memory address mapping that we stored and find
> the memory address in 
> JITted code
> 3.Remember/Store the original instruction at the memory address and
> replace it with a software breakpoint.
> Is there any particular reason why the above mentioned scheme would
> fail?

More information about the Mono-devel-list mailing list