Glenn Fowler wrote: > On Tue, 20 Mar 2007 16:43:35 -0700 Bart Smaalders wrote: >> Glenn Fowler wrote: >>> outsider input (but, by coincidence, deeply imbedded with tracebacks >>> for the last two weeks): its a mistake to have any traceback >>> function call malloc(), since plugging memory leaks must be >>> near the top of traceback requirements list >>> >>> backtrace() puts the info in a user buf,siz >>> an appropriately renamed backtrace_symbols() should to the same >>> with feedback when the buffer size is insufficient > >> Do you think providing a Solaris-only version of this is >> useful? I've added addrtosymstr(), which allows the >> user to create whatever he wants with backtrace() pretty >> easily. > > from a technical perspective provide a non-malloc api with > proper error handling and then wrap the gnu api on top of that >
That's what we've done so far. The semantics of the api requires that the pointer returned from backtrace_symbols() be able to be passed to free(); it's documented that way. Given that malloc & friends are often interposed upon, I couldn't come up with a way of not using malloc. > from political perspective gnu has grabbed the api > does that trump providing a (possibly better) api? > you have to pick the right moment to battle de-facto vs de-best > this may not be one of those moments > Solaris already has better, simpler APIs; see walkcontext(3) and printstack(). I am proposing to add these (potential usage warts and all) to provide source compatibility for more open source applications. - Bart -- Bart Smaalders Solaris Kernel Performance barts at cyber.eng.sun.com http://blogs.sun.com/barts
