2 * debug-mini.c: Mini-specific debugging stuff.
5 * Martin Baulig (martin@ximian.com)
7 * (C) 2003 Ximian, Inc.
13 #include <mono/metadata/verify.h>
14 #include <mono/metadata/mono-config.h>
15 #include <mono/metadata/mono-debug.h>
16 #include <mono/metadata/appdomain.h>
17 #include <mono/metadata/threads-types.h>
19 #define _IN_THE_MONO_DEBUGGER
20 #include <mono/metadata/mono-debug-debugger.h>
21 #include "debug-mini.h"
23 #ifdef HAVE_VALGRIND_H
24 #include <valgrind/valgrind.h>
27 #ifdef MONO_DEBUGGER_SUPPORTED
28 #include <libgc/include/libgc-mono-debugger.h>
34 } MiniDebugBreakpointInfo
;
38 MonoDebugMethodJitInfo
*jit
;
40 guint32 has_line_numbers
;
41 guint32 breakpoint_id
;
42 } MiniDebugMethodInfo
;
44 struct _MonoDebuggerThreadInfo
{
49 guint64 extended_notifications
;
52 MonoDebuggerThreadInfo
*next
;
55 * The stack bounds are only used when reading a core file.
58 guint64 signal_stack_start
;
60 guint32 signal_stack_size
;
63 * The debugger doesn't access anything beyond this point.
65 MonoJitTlsData
*jit_tls
;
69 MonoDebuggerThreadInfo
*mono_debugger_thread_table
= NULL
;
72 record_line_number (MiniDebugMethodInfo
*info
, guint32 address
, guint32 offset
)
74 MonoDebugLineNumberEntry lne
;
76 lne
.native_offset
= address
;
77 lne
.il_offset
= offset
;
79 g_array_append_val (info
->line_numbers
, lne
);
84 mono_debug_init_method (MonoCompile
*cfg
, MonoBasicBlock
*start_block
, guint32 breakpoint_id
)
86 MiniDebugMethodInfo
*info
;
88 if (mono_debug_format
== MONO_DEBUG_FORMAT_NONE
)
91 info
= g_new0 (MiniDebugMethodInfo
, 1);
92 info
->breakpoint_id
= breakpoint_id
;
94 cfg
->debug_info
= info
;
98 mono_debug_open_method (MonoCompile
*cfg
)
100 MiniDebugMethodInfo
*info
;
101 MonoDebugMethodJitInfo
*jit
;
102 MonoMethodHeader
*header
;
104 info
= (MiniDebugMethodInfo
*) cfg
->debug_info
;
108 mono_class_init (cfg
->method
->klass
);
110 header
= mono_method_get_header (cfg
->method
);
113 info
->jit
= jit
= g_new0 (MonoDebugMethodJitInfo
, 1);
114 info
->line_numbers
= g_array_new (FALSE
, TRUE
, sizeof (MonoDebugLineNumberEntry
));
115 jit
->num_locals
= header
->num_locals
;
116 jit
->locals
= g_new0 (MonoDebugVarInfo
, jit
->num_locals
);
120 write_variable (MonoInst
*inst
, MonoDebugVarInfo
*var
)
122 var
->type
= inst
->inst_vtype
;
124 if (inst
->opcode
== OP_REGVAR
)
125 var
->index
= inst
->dreg
| MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER
;
126 else if (inst
->flags
& MONO_INST_IS_DEAD
)
127 var
->index
= MONO_DEBUG_VAR_ADDRESS_MODE_DEAD
;
129 /* the debug interface needs fixing to allow 0(%base) address */
130 var
->index
= inst
->inst_basereg
| MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET
;
131 var
->offset
= inst
->inst_offset
;
136 * mono_debug_add_vg_method:
138 * Register symbol information for the method with valgrind
141 mono_debug_add_vg_method (MonoMethod
*method
, MonoDebugMethodJitInfo
*jit
)
143 #ifdef VALGRIND_ADD_LINE_INFO
144 MonoMethodHeader
*header
;
145 MonoDebugMethodInfo
*minfo
;
147 char *filename
= NULL
;
148 guint32 address
, line_number
;
149 const char *full_name
;
153 if (!RUNNING_ON_VALGRIND
)
156 header
= mono_method_get_header (method
);
158 full_name
= mono_method_full_name (method
, TRUE
);
160 addresses
= g_new0 (guint32
, header
->code_size
+ 1);
161 lines
= g_new0 (guint32
, header
->code_size
+ 1);
164 * Very simple code to convert the addr->offset mappings that mono has
165 * into [addr-addr] ->line number mappings.
168 minfo
= mono_debug_lookup_method (method
);
170 /* Create offset->line number mapping */
171 for (i
= 0; i
< header
->code_size
; ++i
) {
172 MonoDebugSourceLocation
*location
;
174 location
= mono_debug_symfile_lookup_location (minfo
, i
);
178 lines
[i
] = location
.row
;
180 filename
= location
.source_file
;
182 mono_debug_free_source_location (location
);
186 /* Create address->offset mapping */
187 for (i
= 0; i
< jit
->num_line_numbers
; ++i
) {
188 MonoDebugLineNumberEntry
*lne
= jit
->line_numbers
[i
];
190 g_assert (lne
->offset
<= header
->code_size
);
192 if ((addresses
[lne
->offset
] == 0) || (lne
->address
< addresses
[lne
->offset
]))
193 addresses
[lne
->offset
] = lne
->address
;
195 /* Fill out missing addresses */
197 for (i
= 0; i
< header
->code_size
; ++i
) {
198 if (addresses
[i
] == 0)
199 addresses
[i
] = address
;
201 address
= addresses
[i
];
207 while (i
< header
->code_size
) {
208 if (lines
[i
] == line_number
)
211 if (line_number
> 0) {
212 //g_assert (addresses [i] - 1 >= address);
214 if (addresses
[i
] - 1 >= address
) {
215 VALGRIND_ADD_LINE_INFO (jit
->code_start
+ address
, jit
->code_start
+ addresses
[i
] - 1, filename
, line_number
);
216 //printf ("[%d-%d] -> %d.\n", address, addresses [i] - 1, line_number);
219 address
= addresses
[i
];
220 line_number
= lines
[i
];
224 if (line_number
> 0) {
225 VALGRIND_ADD_LINE_INFO (jit
->code_start
+ address
, jit
->code_start
+ jit
->code_size
- 1, filename
, line_number
);
226 //printf ("[%d-%d] -> %d.\n", address, jit->code_size - 1, line_number);
229 VALGRIND_ADD_SYMBOL (jit
->code_start
, jit
->code_size
, full_name
);
233 #endif /* VALGRIND_ADD_LINE_INFO */
237 mono_debug_close_method (MonoCompile
*cfg
)
239 MiniDebugMethodInfo
*info
;
240 MonoDebugMethodJitInfo
*jit
;
241 MonoMethodHeader
*header
;
242 MonoMethodSignature
*sig
;
243 MonoDebugMethodAddress
*debug_info
;
247 info
= (MiniDebugMethodInfo
*) cfg
->debug_info
;
248 if (!info
|| !info
->jit
) {
254 method
= cfg
->method
;
255 header
= mono_method_get_header (method
);
256 sig
= mono_method_signature (method
);
259 jit
->code_start
= cfg
->native_code
;
260 jit
->epilogue_begin
= cfg
->epilog_begin
;
261 jit
->code_size
= cfg
->code_len
;
263 if (jit
->epilogue_begin
)
264 record_line_number (info
, jit
->epilogue_begin
, header
->code_size
);
266 jit
->num_params
= sig
->param_count
;
267 jit
->params
= g_new0 (MonoDebugVarInfo
, jit
->num_params
);
269 for (i
= 0; i
< jit
->num_locals
; i
++)
270 write_variable (cfg
->locals
[i
], &jit
->locals
[i
]);
273 jit
->this_var
= g_new0 (MonoDebugVarInfo
, 1);
274 write_variable (cfg
->args
[0], jit
->this_var
);
277 for (i
= 0; i
< jit
->num_params
; i
++)
278 write_variable (cfg
->args
[i
+ sig
->hasthis
], &jit
->params
[i
]);
280 jit
->num_line_numbers
= info
->line_numbers
->len
;
281 jit
->line_numbers
= g_new0 (MonoDebugLineNumberEntry
, jit
->num_line_numbers
);
283 for (i
= 0; i
< jit
->num_line_numbers
; i
++)
284 jit
->line_numbers
[i
] = g_array_index (info
->line_numbers
, MonoDebugLineNumberEntry
, i
);
286 debug_info
= mono_debug_add_method (method
, jit
, cfg
->domain
);
288 mono_debug_add_vg_method (method
, jit
);
290 if (info
->breakpoint_id
)
291 mono_debugger_breakpoint_callback (method
, info
->breakpoint_id
);
293 mono_debugger_check_breakpoints (method
, debug_info
);
295 mono_debug_free_method_jit_info (jit
);
296 g_array_free (info
->line_numbers
, TRUE
);
301 mono_debug_record_line_number (MonoCompile
*cfg
, MonoInst
*ins
, guint32 address
)
303 MiniDebugMethodInfo
*info
;
304 MonoMethodHeader
*header
;
307 info
= (MiniDebugMethodInfo
*) cfg
->debug_info
;
308 if (!info
|| !info
->jit
|| !ins
->cil_code
)
311 header
= mono_method_get_header (cfg
->method
);
314 if ((ins
->cil_code
< header
->code
) ||
315 (ins
->cil_code
> header
->code
+ header
->code_size
))
318 offset
= ins
->cil_code
- header
->code
;
319 if (!info
->has_line_numbers
) {
320 info
->jit
->prologue_end
= address
;
321 info
->has_line_numbers
= TRUE
;
324 record_line_number (info
, address
, offset
);
328 mono_debug_open_block (MonoCompile
*cfg
, MonoBasicBlock
*bb
, guint32 address
)
330 MiniDebugMethodInfo
*info
;
331 MonoMethodHeader
*header
;
334 info
= (MiniDebugMethodInfo
*) cfg
->debug_info
;
335 if (!info
|| !info
->jit
|| !bb
->cil_code
)
338 header
= mono_method_get_header (cfg
->method
);
341 if ((bb
->cil_code
< header
->code
) ||
342 (bb
->cil_code
> header
->code
+ header
->code_size
))
345 offset
= bb
->cil_code
- header
->code
;
346 if (!info
->has_line_numbers
) {
347 info
->jit
->prologue_end
= address
;
348 info
->has_line_numbers
= TRUE
;
351 record_line_number (info
, address
, offset
);
355 encode_value (gint32 value
, guint8
*buf
, guint8
**endbuf
)
359 //printf ("ENCODE: %d 0x%x.\n", value, value);
362 * Same encoding as the one used in the metadata, extended to handle values
363 * greater than 0x1fffffff.
365 if ((value
>= 0) && (value
<= 127))
367 else if ((value
>= 0) && (value
<= 16383)) {
368 p
[0] = 0x80 | (value
>> 8);
369 p
[1] = value
& 0xff;
371 } else if ((value
>= 0) && (value
<= 0x1fffffff)) {
372 p
[0] = (value
>> 24) | 0xc0;
373 p
[1] = (value
>> 16) & 0xff;
374 p
[2] = (value
>> 8) & 0xff;
375 p
[3] = value
& 0xff;
380 p
[1] = (value
>> 24) & 0xff;
381 p
[2] = (value
>> 16) & 0xff;
382 p
[3] = (value
>> 8) & 0xff;
383 p
[4] = value
& 0xff;
391 decode_value (guint8
*ptr
, guint8
**rptr
)
396 if ((b
& 0x80) == 0){
399 } else if ((b
& 0x40) == 0){
400 len
= ((b
& 0x3f) << 8 | ptr
[1]);
402 } else if (b
!= 0xff) {
403 len
= ((b
& 0x1f) << 24) |
410 len
= (ptr
[1] << 24) | (ptr
[2] << 16) | (ptr
[3] << 8) | ptr
[4];
416 //printf ("DECODE: %d.\n", len);
421 serialize_variable (MonoDebugVarInfo
*var
, guint8
*p
, guint8
**endbuf
)
423 guint32 flags
= var
->index
& MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS
;
425 encode_value (var
->index
, p
, &p
);
428 case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER
:
430 case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET
:
431 encode_value (var
->offset
, p
, &p
);
433 case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD
:
436 g_assert_not_reached ();
442 mono_debug_serialize_debug_info (MonoCompile
*cfg
, guint8
**out_buf
, guint32
*buf_len
)
444 MonoDebugMethodJitInfo
*jit
;
445 guint32 size
, prev_offset
, prev_native_offset
;
449 /* Can't use cfg->debug_info as it is freed by close_method () */
450 jit
= mono_debug_find_method (cfg
->method
, mono_domain_get ());
456 size
= ((jit
->num_params
+ jit
->num_locals
+ 1) * 10) + (jit
->num_line_numbers
* 10) + 64;
457 p
= buf
= g_malloc (size
);
458 encode_value (jit
->epilogue_begin
, p
, &p
);
459 encode_value (jit
->prologue_end
, p
, &p
);
460 encode_value (jit
->code_size
, p
, &p
);
462 for (i
= 0; i
< jit
->num_params
; ++i
)
463 serialize_variable (&jit
->params
[i
], p
, &p
);
465 if (mono_method_signature (cfg
->method
)->hasthis
)
466 serialize_variable (jit
->this_var
, p
, &p
);
468 for (i
= 0; i
< jit
->num_locals
; i
++)
469 serialize_variable (&jit
->locals
[i
], p
, &p
);
471 encode_value (jit
->num_line_numbers
, p
, &p
);
474 prev_native_offset
= 0;
475 for (i
= 0; i
< jit
->num_line_numbers
; ++i
) {
476 /* Sometimes, the offset values are not in increasing order */
477 MonoDebugLineNumberEntry
*lne
= &jit
->line_numbers
[i
];
478 encode_value (lne
->il_offset
- prev_offset
, p
, &p
);
479 encode_value (lne
->native_offset
- prev_native_offset
, p
, &p
);
480 prev_offset
= lne
->il_offset
;
481 prev_native_offset
= lne
->native_offset
;
484 g_assert (p
- buf
< size
);
491 deserialize_variable (MonoDebugVarInfo
*var
, guint8
*p
, guint8
**endbuf
)
495 var
->index
= decode_value (p
, &p
);
497 flags
= var
->index
& MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS
;
500 case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER
:
502 case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET
:
503 var
->offset
= decode_value (p
, &p
);
505 case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD
:
508 g_assert_not_reached ();
513 static MonoDebugMethodJitInfo
*
514 deserialize_debug_info (MonoMethod
*method
, guint8
*code_start
, guint8
*buf
, guint32 buf_len
)
516 MonoMethodHeader
*header
;
517 gint32 offset
, native_offset
, prev_offset
, prev_native_offset
;
518 MonoDebugMethodJitInfo
*jit
;
522 header
= mono_method_get_header (method
);
525 jit
= g_new0 (MonoDebugMethodJitInfo
, 1);
526 jit
->code_start
= code_start
;
527 jit
->num_locals
= header
->num_locals
;
528 jit
->locals
= g_new0 (MonoDebugVarInfo
, jit
->num_locals
);
529 jit
->num_params
= mono_method_signature (method
)->param_count
;
530 jit
->params
= g_new0 (MonoDebugVarInfo
, jit
->num_params
);
533 jit
->epilogue_begin
= decode_value (p
, &p
);
534 jit
->prologue_end
= decode_value (p
, &p
);
535 jit
->code_size
= decode_value (p
, &p
);
537 for (i
= 0; i
< jit
->num_params
; ++i
)
538 deserialize_variable (&jit
->params
[i
], p
, &p
);
540 if (mono_method_signature (method
)->hasthis
) {
541 jit
->this_var
= g_new0 (MonoDebugVarInfo
, 1);
542 deserialize_variable (jit
->this_var
, p
, &p
);
545 for (i
= 0; i
< jit
->num_locals
; i
++)
546 deserialize_variable (&jit
->locals
[i
], p
, &p
);
548 jit
->num_line_numbers
= decode_value (p
, &p
);
549 jit
->line_numbers
= g_new0 (MonoDebugLineNumberEntry
, jit
->num_line_numbers
);
552 prev_native_offset
= 0;
553 for (i
= 0; i
< jit
->num_line_numbers
; ++i
) {
554 MonoDebugLineNumberEntry
*lne
= &jit
->line_numbers
[i
];
556 offset
= prev_offset
+ decode_value (p
, &p
);
557 native_offset
= prev_native_offset
+ decode_value (p
, &p
);
559 lne
->native_offset
= native_offset
;
560 lne
->il_offset
= offset
;
562 prev_offset
= offset
;
563 prev_native_offset
= native_offset
;
570 mono_debug_add_aot_method (MonoDomain
*domain
, MonoMethod
*method
, guint8
*code_start
,
571 guint8
*debug_info
, guint32 debug_info_len
)
573 MonoDebugMethodJitInfo
*jit
;
575 if (mono_debug_format
== MONO_DEBUG_FORMAT_NONE
)
578 if ((method
->iflags
& METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL
) ||
579 (method
->iflags
& METHOD_IMPL_ATTRIBUTE_RUNTIME
) ||
580 (method
->flags
& METHOD_ATTRIBUTE_PINVOKE_IMPL
) ||
581 (method
->flags
& METHOD_ATTRIBUTE_ABSTRACT
) ||
582 (method
->wrapper_type
!= MONO_WRAPPER_NONE
))
585 if (debug_info_len
== 0)
588 jit
= deserialize_debug_info (method
, code_start
, debug_info
, debug_info_len
);
590 mono_debug_add_method (method
, jit
, domain
);
592 mono_debug_add_vg_method (method
, jit
);
594 mono_debug_free_method_jit_info (jit
);
598 mono_debug_add_icall_wrapper (MonoMethod
*method
, MonoJitICallInfo
* callinfo
)
600 if (mono_debug_format
== MONO_DEBUG_FORMAT_NONE
)
603 // mono_debug_add_wrapper (method, callinfo->wrapper, callinfo->func);
607 print_var_info (MonoDebugVarInfo
*info
, int idx
, const char *name
, const char *type
)
609 switch (info
->index
& MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS
) {
610 case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER
:
611 g_print ("%s %s (%d) in register %s\n", type
, name
, idx
, mono_arch_regname (info
->index
& (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS
)));
613 case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET
:
614 g_print ("%s %s (%d) in memory: base register %s + %d\n", type
, name
, idx
, mono_arch_regname (info
->index
& (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS
)), info
->offset
);
616 case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS
:
618 g_assert_not_reached ();
623 * mono_debug_print_locals:
625 * Prints to stdout the information about the local variables in
626 * a method (if @only_arguments is false) or about the arguments.
627 * The information includes the storage info (where the variable
628 * lives, in a register or in memory).
629 * The method is found by looking up what method has been emitted at
630 * the instruction address @ip.
631 * This is for use inside a debugger.
634 mono_debug_print_vars (gpointer ip
, gboolean only_arguments
)
636 MonoDomain
*domain
= mono_domain_get ();
637 MonoJitInfo
*ji
= mono_jit_info_table_find (domain
, ip
);
638 MonoDebugMethodJitInfo
*jit
;
644 jit
= mono_debug_find_method (mono_jit_info_get_method (ji
), domain
);
648 if (only_arguments
) {
650 names
= g_new (char *, jit
->num_params
);
651 mono_method_get_param_names (mono_jit_info_get_method (ji
), (const char **) names
);
653 print_var_info (jit
->this_var
, 0, "this", "Arg");
654 for (i
= 0; i
< jit
->num_params
; ++i
) {
655 print_var_info (&jit
->params
[i
], i
, names
[i
]? names
[i
]: "unknown name", "Arg");
659 for (i
= 0; i
< jit
->num_locals
; ++i
) {
660 print_var_info (&jit
->locals
[i
], i
, "", "Local");
663 mono_debug_free_method_jit_info (jit
);
667 * The old Debugger breakpoint interface.
669 * This interface is used to insert breakpoints on methods which are not yet JITed.
670 * The debugging code keeps a list of all such breakpoints and automatically inserts the
671 * breakpoint when the method is JITed.
674 static GPtrArray
*breakpoints
= NULL
;
677 mono_debugger_insert_breakpoint_full (MonoMethodDesc
*desc
)
679 static int last_breakpoint_id
= 0;
680 MiniDebugBreakpointInfo
*info
;
682 info
= g_new0 (MiniDebugBreakpointInfo
, 1);
684 info
->index
= ++last_breakpoint_id
;
687 breakpoints
= g_ptr_array_new ();
689 g_ptr_array_add (breakpoints
, info
);
695 mono_debugger_remove_breakpoint (int breakpoint_id
)
702 for (i
= 0; i
< breakpoints
->len
; i
++) {
703 MiniDebugBreakpointInfo
*info
= g_ptr_array_index (breakpoints
, i
);
705 if (info
->index
!= breakpoint_id
)
708 mono_method_desc_free (info
->desc
);
709 g_ptr_array_remove (breakpoints
, info
);
718 mono_debugger_insert_breakpoint (const gchar
*method_name
, gboolean include_namespace
)
720 MonoMethodDesc
*desc
;
722 desc
= mono_method_desc_new (method_name
, include_namespace
);
726 return mono_debugger_insert_breakpoint_full (desc
);
730 mono_debugger_method_has_breakpoint (MonoMethod
*method
)
734 if (!breakpoints
|| (method
->wrapper_type
!= MONO_WRAPPER_NONE
))
737 for (i
= 0; i
< breakpoints
->len
; i
++) {
738 MiniDebugBreakpointInfo
*info
= g_ptr_array_index (breakpoints
, i
);
740 if (!mono_method_desc_full_match (info
->desc
, method
))
750 mono_debugger_breakpoint_callback (MonoMethod
*method
, guint32 index
)
752 mono_debugger_event (MONO_DEBUGGER_EVENT_JIT_BREAKPOINT
, (guint64
) (gsize
) method
, index
);
756 mono_debugger_thread_created (gsize tid
, MonoThread
*thread
, MonoJitTlsData
*jit_tls
)
758 #ifdef MONO_DEBUGGER_SUPPORTED
760 guint8
*staddr
= NULL
;
761 MonoDebuggerThreadInfo
*info
;
763 if (mono_debug_format
== MONO_DEBUG_FORMAT_NONE
)
766 mono_debugger_lock ();
768 mono_thread_get_stack_bounds (&staddr
, &stsize
);
770 info
= g_new0 (MonoDebuggerThreadInfo
, 1);
772 info
->thread
= thread
;
773 info
->stack_start
= (guint64
) (gsize
) staddr
;
774 info
->signal_stack_start
= (guint64
) (gsize
) jit_tls
->signal_stack
;
775 info
->stack_size
= stsize
;
776 info
->signal_stack_size
= jit_tls
->signal_stack_size
;
777 info
->end_stack
= (guint64
) (gsize
) GC_mono_debugger_get_stack_ptr ();
778 info
->lmf_addr
= (guint64
) (gsize
) mono_get_lmf_addr ();
779 info
->jit_tls
= jit_tls
;
781 info
->next
= mono_debugger_thread_table
;
782 mono_debugger_thread_table
= info
;
784 mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_CREATED
,
785 tid
, (guint64
) (gsize
) info
);
787 mono_debugger_unlock ();
788 #endif /* MONO_DEBUGGER_SUPPORTED */
792 mono_debugger_thread_cleanup (MonoJitTlsData
*jit_tls
)
794 #ifdef MONO_DEBUGGER_SUPPORTED
795 MonoDebuggerThreadInfo
**ptr
;
797 if (mono_debug_format
== MONO_DEBUG_FORMAT_NONE
)
800 mono_debugger_lock ();
802 for (ptr
= &mono_debugger_thread_table
; *ptr
; ptr
= &(*ptr
)->next
) {
803 MonoDebuggerThreadInfo
*info
= *ptr
;
805 if (info
->jit_tls
!= jit_tls
)
808 mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_CLEANUP
,
809 info
->tid
, (guint64
) (gsize
) info
);
816 mono_debugger_unlock ();
821 mono_debugger_extended_notification (MonoDebuggerEvent event
, guint64 data
, guint64 arg
)
823 #ifdef MONO_DEBUGGER_SUPPORTED
824 MonoDebuggerThreadInfo
**ptr
;
825 MonoThread
*thread
= mono_thread_current ();
827 if (!mono_debug_using_mono_debugger ())
830 mono_debugger_lock ();
832 for (ptr
= &mono_debugger_thread_table
; *ptr
; ptr
= &(*ptr
)->next
) {
833 MonoDebuggerThreadInfo
*info
= *ptr
;
835 if (info
->thread
!= thread
)
838 if ((info
->extended_notifications
& (int) event
) == 0)
841 mono_debugger_event (event
, data
, arg
);
844 mono_debugger_unlock ();
849 mono_debugger_trampoline_compiled (MonoMethod
*method
, const guint8
*code
)
851 mono_debugger_extended_notification (MONO_DEBUGGER_EVENT_TRAMPOLINE
,
852 (guint64
) (gsize
) method
, (guint64
) (gsize
) code
);