ASSERT (opnd_create_immed_int: value too large for 8-bit size) in offline tracer when running with L0_filter and if application has basic block longer than 256 insts
Describe the bug
The assert occurs if we have a basic block longer than 256 instructions. The assert goes away if I change OPND_CREATE_INT8(ud->bb_instr_count)));
to OPND_CREATE_INT16(ud->bb_instr_count)));
1051 if (op_L0_filter.get_value()) {
1052 // Count dynamic instructions per thread.
1053 // It is too expensive to increment per instruction, so we increment once
1054 // per block by the instruction count for that block.
1055 if (drmgr_is_first_nonlabel_instr(drcontext, app)) {
1056 // On x86 we could do this in one instruction if we clobber the flags: but
1057 // then we'd have to preserve the flags before our same-line skip in
1058 // insert_filter_addr().
1059 dr_insert_read_raw_tls(drcontext, ilist, where, tls_seg,
1060 tls_offs + sizeof(void *) * MEMTRACE_TLS_OFFS_ICOUNT,
1061 reg_ptr);
1062 MINSERT(ilist, where,
>1063 XINST_CREATE_add(drcontext, opnd_create_reg(reg_ptr),
1064 OPND_CREATE_INT8(ud->bb_instr_count)));
1065 dr_insert_write_raw_tls(drcontext, ilist, where, tls_seg,
1066 tls_offs + sizeof(void *) * MEMTRACE_TLS_OFFS_ICOUNT,
1067 reg_ptr);
1068 }
(gdb) p ud->bb_instr_count
$5 = 257
To Reproduce Run offline tracer with the L0_filter option and an application that has a basic block longer than 256 instructions.
drrun -t drcachesim -offline -L0_filter -- <app>
Expected behavior The assert should not fail.
Screenshots or Pasted Text
opnd_create_immed_int: value too large for 8-bit size
Versions
- What version of DynamoRIO are you using? cronbuild-8.0.18752
- Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem? No
- What operating system version are you running on? Ubuntu 18.04.5 LTS
- Is your application 32-bit or 64-bit? ELF 64-bit LSB executable
Additional context None