Hi Ange,

If you're using SE mode, you may be able to augment the allocation code to
track the heap size. E.g.,
https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/src/sim/mem_state.cc#108

In fact, the MemState object tracks both the stack and the heap, so you can
get a lot of information from that. Again, this assumes you're using SE
mode.

If you're using FS mode, it will be a bit more complicated. You're on the
right track with the readArchInReg. I'm not sure exactly how Arm tracks the
heap, but I would dig into the remote GDB implementation to see if there
are any hints in that code.

Cheers,
Jason

On Thu, Sep 23, 2021 at 9:46 AM Ange via gem5-users <gem5-users@gem5.org>
wrote:

> Hi all,
>
> I am trying to keep track of the size of the stack and heap while
> executing a binary, and at the moment, I can get the address of the stack
> pointer using this line of code
> cpu->readArchIntReg(ArmISA::INTREG_SP ,tid).
> I am also trying to read the frame pointer (FP), but I am having trouble
> getting the address for it
> because it always prints zero as its address, and I am using Register 11
> for the FP (cpu->readArchIntReg(ArmISA::INTREG_R11) ).
> Am I doing something wrong, or is there a better way to get the stack
> size?  and also the heap size with its addresses?
>
> I saw that someone asked a similar question a while back on this forum,
> but it was not fully answered.
> Here is the link
> https://www.mail-archive.com/gem5-users@gem5.org/msg04154.html
>
> I need help!
>
> Ange
> _______________________________________________
> 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