Skip to content

Commit 554516d

Browse files
author
xor2003
committed
latest
1 parent fee6a57 commit 554516d

File tree

14 files changed

+15
-6
lines changed

14 files changed

+15
-6
lines changed

src/cpu/core_normal.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ if (trace_instructions)
188188
{
189189
print_instruction(SegBase(cs)>>4,cpu_regs.ip.dword[0]);
190190
}
191-
// compare_jump = false;
191+
192192
if (collect_rt_info) m2c::shadow_memory.collect_segs();
193+
// compare_jump = false;
193194

194195
core.opcode_index=cpu.code.big*0x200;
195196
core.prefixes=cpu.code.big;

src/custom/custom.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ bool compare_mode = false;
3030
bool complex_self_modifications = false;
3131
// Enable/disable collection of run-time information like code addresses and
3232
// segment values.
33-
bool collect_rt_info = false;
33+
bool collect_rt_info = true;
3434
// Enable/disable collection of memory access information (slower).
35-
bool collect_rt_info_vars = false;
35+
bool collect_rt_info_vars = true;
3636

3737
// -- configuration end
3838

@@ -178,6 +178,9 @@ void custom_init_prog(char *name, Bit16u relocate, Bit16u init_cs, Bit16u init_i
178178
// Custom exit function for DOSBox programs.
179179
void custom_exit_prog(Bit8u exitcode)
180180
{
181+
// Dump shadow memory.
182+
m2c::shadow_memory.dump();
183+
181184
// Check if it was a target binary.
182185
if (!custom_runs) {
183186
printf("It wasn't a target binary. Ignoring\n");
@@ -193,8 +196,6 @@ void custom_exit_prog(Bit8u exitcode)
193196

194197
init_runs--;
195198
}
196-
// Dump shadow memory.
197-
m2c::shadow_memory.dump();
198199
}
199200

200201
// Custom call function for handling translated function calls.
@@ -1395,6 +1396,9 @@ void ShadowMemory::collect_data(dd b, size_t size)
13951396
// Function to dump the collected run-time information to a JSON file.
13961397
void ShadowMemory::dump()
13971398
{
1399+
if (!collect_rt_info || m_code.empty())
1400+
return;
1401+
13981402
// Mark data addresses accessed multiple times as arrays.
13991403
for (auto &[key, value] : m_code) {
14001404
const Byte *b = value.get();
@@ -1421,6 +1425,10 @@ void ShadowMemory::dump()
14211425
fwrite(s.c_str(), s.size(), 1, f);
14221426
fclose(f);
14231427
printf("Saved json\n");
1428+
1429+
m_data.clear();
1430+
m_code.clear();
1431+
m_jumps.clear();
14241432
// printf("%s\n",j.dump(3).c_str());
14251433
}
14261434

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)