|
|
Log in / Subscribe / Register

Printbuf rebuffed for now

Printbuf rebuffed for now

Posted Apr 29, 2022 6:31 UTC (Fri) by mb (subscriber, #50428)
In reply to: Printbuf rebuffed for now by Paf
Parent article: Printbuf rebuffed for now

>And there’s no way to know at runtime if you have any to spare.

If you have a fixed stack size with known begin and end pointers, then you'd just have to subtract SP from the end pointer.

Buf of course, what would you do then? Print an error message? ;)


to post comments

Printbuf rebuffed for now

Posted Apr 29, 2022 10:00 UTC (Fri) by matthias (subscriber, #94967) [Link]

This only works, if you either do not do any method call or you know for sure how much stack space the invoked methods will use in the worst case.

Printbuf rebuffed for now

Posted Apr 29, 2022 13:20 UTC (Fri) by nevets (subscriber, #11875) [Link]

> If you have a fixed stack size with known begin and end pointers, then you'd just have to subtract SP from the end pointer.

It's even more complex than that. Depending on the architecture, if you are in interrupt context, you may be on a different stack that is even a different size than the normal context stack. This would require an architecture dependent implementation.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds