@@ -53,8 +53,7 @@ static void add_new_insn_frame(VCPU *vcpu, unsigned int vcpu_index,
53
53
54
54
static void log_insn_reg_access (unsigned int vcpu_index , void * udata ) {
55
55
g_rw_lock_reader_lock (& state .vcpus_array_lock );
56
- g_rw_lock_writer_lock (& state .frame_buffer_lock );
57
- g_rw_lock_writer_lock (& state .file_lock );
56
+ g_rw_lock_reader_lock (& state .frame_buffer_lock );
58
57
59
58
FrameBuffer * fbuf = g_ptr_array_index (state .frame_buffer , vcpu_index );
60
59
VCPU * vcpu = & g_array_index (state .vcpus , VCPU , vcpu_index );
@@ -64,16 +63,17 @@ static void log_insn_reg_access(unsigned int vcpu_index, void *udata) {
64
63
add_post_reg_state (vcpu , vcpu_index , current_regs , fbuf );
65
64
66
65
if (frame_buffer_is_full (fbuf )) {
66
+ g_rw_lock_writer_lock (& state .file_lock );
67
67
frame_buffer_flush_to_file (fbuf , state .file );
68
+ g_rw_lock_writer_unlock (& state .file_lock );
68
69
}
69
70
70
71
// Open new one.
71
72
Instruction * insn = udata ;
72
73
add_new_insn_frame (vcpu , vcpu_index , fbuf , insn );
73
74
add_pre_reg_state (vcpu , vcpu_index , current_regs , fbuf );
74
75
75
- g_rw_lock_writer_unlock (& state .file_lock );
76
- g_rw_lock_writer_unlock (& state .frame_buffer_lock );
76
+ g_rw_lock_reader_unlock (& state .frame_buffer_lock );
77
77
g_rw_lock_reader_unlock (& state .vcpus_array_lock );
78
78
79
79
return ;
0 commit comments