Skip to content

Commit 5348a03

Browse files
committed
fix num regs in case it's stored in xml file
1 parent ace3646 commit 5348a03

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

libafl/cpu.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,15 @@ int libafl_qemu_read_reg(CPUState* cpu, int reg, uint8_t* val)
134134
int libafl_qemu_num_regs(CPUState* cpu)
135135
{
136136
CPUClass* cc = CPU_GET_CLASS(cpu);
137-
return cc->gdb_num_core_regs;
137+
138+
if (cc->gdb_num_core_regs) {
139+
return cc->gdb_num_core_regs;
140+
} else {
141+
const GDBFeature *feature = gdb_find_static_feature(cc->gdb_core_xml_file);
142+
g_assert(feature);
143+
144+
return feature->num_regs;
145+
}
138146
}
139147

140148
void libafl_flush_jit(void)

0 commit comments

Comments
 (0)