g_hash_table_insert (bp_locs, inst->ip, GINT_TO_POINTER (count + 1));
mono_loader_unlock ();
- if (count == 0) {
+ if (sp->native_offset == SEQ_POINT_NATIVE_OFFSET_DEAD_CODE) {
+ DEBUG (1, fprintf (log_file, "[dbg] Attempting to insert seq point at dead IL offset %d, ignoring.\n", (int)bp->il_offset));
+ } else if (count == 0) {
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
mono_arch_set_breakpoint (ji, inst->ip);
#else
g_assert (count > 0);
- if (count == 1) {
+ if (count == 1 && inst->native_offset != SEQ_POINT_NATIVE_OFFSET_DEAD_CODE) {
mono_arch_clear_breakpoint (ji, ip);
}
#else
MonoInst *cached_tls_addr = NULL;
MonoDebugMethodInfo *minfo;
MonoBitSet *seq_point_locs = NULL;
+ MonoBitSet *seq_point_set_locs = NULL;
disable_inline = is_jit_optimizer_disabled (method);
mono_debug_symfile_get_line_numbers_full (minfo, NULL, NULL, &n_il_offsets, &il_offsets, &line_numbers, NULL, NULL);
seq_point_locs = mono_bitset_mem_new (mono_mempool_alloc0 (cfg->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
+ seq_point_set_locs = mono_bitset_mem_new (mono_mempool_alloc0 (cfg->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
sym_seq_points = TRUE;
for (i = 0; i < n_il_offsets; ++i) {
if (il_offsets [i] < header->code_size)
//if (!(cfg->cbb->last_ins && cfg->cbb->last_ins->opcode == OP_SEQ_POINT)) {
NEW_SEQ_POINT (cfg, ins, ip - header->code, intr_loc);
MONO_ADD_INS (cfg->cbb, ins);
+
+ if (sym_seq_points)
+ mono_bitset_set_fast (seq_point_set_locs, ip - header->code);
}
bblock->real_offset = cfg->real_offset;
MONO_ADD_INS (cfg->bb_exit, ins);
}
+ /*
+ * Add seq points for IL offsets which have line number info, but wasn't generated a seq point during JITting because
+ * the code they refer to was dead (#11880).
+ */
+ if (sym_seq_points) {
+ for (i = 0; i < header->code_size; ++i) {
+ if (mono_bitset_test_fast (seq_point_locs, i) && !mono_bitset_test_fast (seq_point_set_locs, i)) {
+ MonoInst *ins;
+
+ NEW_SEQ_POINT (cfg, ins, i, FALSE);
+ mono_add_seq_point (cfg, NULL, ins, SEQ_POINT_NATIVE_OFFSET_DEAD_CODE);
+ }
+ }
+ }
+
cfg->ip = NULL;
if (cfg->method == method) {
{
ins->inst_offset = native_offset;
g_ptr_array_add (cfg->seq_points, ins);
- bb->seq_points = g_slist_prepend_mempool (cfg->mempool, bb->seq_points, ins);
- bb->last_seq_point = ins;
+ if (bb) {
+ bb->seq_points = g_slist_prepend_mempool (cfg->mempool, bb->seq_points, ins);
+ bb->last_seq_point = ins;
+ }
}
void
if (ins->inst_imm == METHOD_ENTRY_IL_OFFSET || ins->inst_imm == METHOD_EXIT_IL_OFFSET)
/* Used to implement method entry/exit events */
continue;
+ if (ins->inst_offset == SEQ_POINT_NATIVE_OFFSET_DEAD_CODE)
+ continue;
if (last != NULL) {
/* Link with the previous seq point in the same bb */