sof icon indicating copy to clipboard operation
sof copied to clipboard

debug: jump to GDB stub upon exception

Open lyakh opened this issue 4 months ago • 7 comments

Enable a Zephyr option on Xtensa to jump to GDB stub upon exception

lyakh avatar Aug 22 '25 06:08 lyakh

@lyakh looks like build errors. Btw, on exception GDB stub should be in read only mode and use a polling based IPC.

lgirdwood avatar Aug 25 '25 15:08 lgirdwood

@lyakh looks like build errors. Btw, on exception GDB stub should be in read only mode and use a polling based IPC.

@lgirdwood why IPC? We don't use IPC for the GDB stub, we use a dedicated memory window. As for read-only, well, should be possible in principle, just ignore all the write commands, any specific non-obvious reason for that? Apart from protecting the developer from shooting themselves in the foot?

lyakh avatar Sep 09 '25 08:09 lyakh

@lyakh looks like build errors. Btw, on exception GDB stub should be in read only mode and use a polling based IPC.

@lgirdwood why IPC? We don't use IPC for the GDB stub, we use a dedicated memory window. As for read-only, well, should be possible in principle, just ignore all the write commands, any specific non-obvious reason for that? Apart from protecting the developer from shooting themselves in the foot?

If we have a crash then user could write TEXT payload to memory and reboot. We can have a Kconfig for this though as main usage for regular users is to be able to dump data for bug reports.

lgirdwood avatar Sep 09 '25 12:09 lgirdwood

Gah, clicked wrong button.

lgirdwood avatar Sep 09 '25 12:09 lgirdwood

@lyakh looks like build errors. Btw, on exception GDB stub should be in read only mode and use a polling based IPC.

@lgirdwood why IPC? We don't use IPC for the GDB stub, we use a dedicated memory window. As for read-only, well, should be possible in principle, just ignore all the write commands, any specific non-obvious reason for that? Apart from protecting the developer from shooting themselves in the foot?

If we have a crash then user could write TEXT payload to memory and reboot. We can have a Kconfig for this though as main usage for regular users is to be able to dump data for bug reports.

@lgirdwood but they can do that with no crash too. Just use the GDB stub as always, no crash is needed, or what am I missing?

lyakh avatar Sep 09 '25 13:09 lyakh

@lyakh looks like build errors. Btw, on exception GDB stub should be in read only mode and use a polling based IPC.

@lgirdwood why IPC? We don't use IPC for the GDB stub, we use a dedicated memory window. As for read-only, well, should be possible in principle, just ignore all the write commands, any specific non-obvious reason for that? Apart from protecting the developer from shooting themselves in the foot?

If we have a crash then user could write TEXT payload to memory and reboot. We can have a Kconfig for this though as main usage for regular users is to be able to dump data for bug reports.

@lgirdwood but they can do that with no crash too. Just use the GDB stub as always, no crash is needed, or what am I missing?

RW Stub would be built in by developers for dev usage today, but RO crash stub would be in production build for end users to help report issues.

lgirdwood avatar Sep 10 '25 10:09 lgirdwood

RW Stub would be built in by developers for dev usage today, but RO crash stub would be in production build for end users to help report issues.

@lgirdwood ah, I see now! Thanks for the clarification. That needs a bit more work then, we need at least two Kconfig options then, so far we have only one.

lyakh avatar Sep 11 '25 07:09 lyakh