*Very* superficially looking at this (just at what's in the emails here),
you might want to make sure the BaseCPU destructor is virtual, or at least
the destructor of a base class is. If it isn't currently, the destructor of
SimObject should probably be virtual. I don't know for sure whether that
would cause your problem, but that would be the first thing I would check.
I know not having a virtual destructor can cause problems where things
don't get cleaned up properly.

That said, if you just want something generic to happen at the end of the
simulation (vs something to clean up some new part of BaseCPU),
registerExitCallback that Jason pointed out is probably the way to go.

Gabe

On Wed, Feb 9, 2022 at 5:24 PM Jason Lowe-Power via gem5-users <
gem5-users@gem5.org> wrote:

> Hi Scott,
>
> If you want something to execute before gem5 is completed, you can call
> `registerExitCallback`. See
> http://doxygen.gem5.org/release/current/namespacegem5.html#abcf3056836ee522620e5b14d9392ea87
>
> I *think* that will solve your problem, but let me know if not. I don't
> think there's a clean way to have a SimObject's destructor guaranteed to be
> called.
>
> Cheers,
> Jason
>
> On Wed, Feb 9, 2022 at 4:47 PM Scott Blankenberg via gem5-users <
> gem5-users@gem5.org> wrote:
>
>> Hello,
>>
>> In src/cpu/base.cc we have the following destructor:
>>
>> BaseCPU::~BaseCPU()
>> {
>> }
>>
>> By default nothing is inside of it. However, when I put code inside, it
>> does not seem to be executed at any point. Based on some previous threads I
>> have seen on the forums, it seems that the destructor for BaseCPU is not
>> being called at the end of the simulation.
>>
>> Has anyone found a way to make sure this destructor is called when the
>> simulation ends?
>>
>> Similarly, has anyone written a tracer which is a subclass of InstTracer
>> that has a destructor which is successfully called at the end of
>> simulation?
>>
>> Basically my objective is to make sure the destructor to my customTracer
>> is called at the end of the simulation.
>>
>> Thanks,
>>
>> Scott Blankenberg
>> _______________________________________________
>> gem5-users mailing list -- gem5-users@gem5.org
>> To unsubscribe send an email to gem5-users-le...@gem5.org
>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>>
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to