Skip to content

Zero frame pointer register in Reset #617

@KingCol13

Description

@KingCol13

Hi, I'm new to this low level stuff so sorry if I get something wrong.

I've been trying to work out how to do a frame pointer stack walk using r7 for some profiling but I've been having trouble working out when to stop the walk. It works fine until I get to <main>'s frame record, at which point the frame pointer points into the boot RAM which I don't seem to be able to read. Would it be reasonable to zero the frame pointer r7 in <Reset>?

Section 6.2.1.4 of the AAPCS32 states:

The end of the frame record chain is indicated by the address zero in the address for the previous frame.

so I think making this change would conform with that.

Environment

I've been using a Pico 2 with an embassy application to test.

The gdb commands I've been using for walking the stack are:

info registers r7
p/x *((addr + 0*4) as *u32)

and for getting return addresses:

info registers lr
p/x *((addr + 1*4) as *u32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions