Quote:
Originally Posted by schluppo
This prevents people from using a PC-trace beyond ~8,000,000 instructions. Even splitting the big file into smaller 16mb-files and trying to reload traces after every 8,000,000 instructions does not help and throws the same exception.
|
Try to read only 1MB from the traces into memory and store it in a ring buffer like:
Code:
uint32 ringsize = 0x40000;
unit32 ringbuffer[ringsize];
uint32 i = 0; // entry pointer in trace file
fopen(...)
// initialize the buffer
fread(ringbuffer, sizeof(uint32), ringsize, trace_file);
while (1)
{
printf("current pc is: %08d\n", ringbuffer[i % ringsize]);
i++; // switch to next pc entry
// usually we could write and read at the same time (two threads)
// i assume only one thread so i refresh/write the entire buffer at once
if( i % ringsize == 0) // check if are back to our starting point (walked the ring all the way around). if so refresh the buffer
{
// read the next MB into the buffer
fread(ringbuffer, sizeof(uint32), ringsize, trace_file);
}
}
I wrote this in only a few minutes (so there might be a mistake) but i hope it helps.