[DTrace-devel] [PATCH 1/2] Unify the handling of stack traces in the consumer

Kris Van Hees kris.van.hees at oracle.com
Mon Sep 29 00:46:04 UTC 2025


On Sun, Sep 28, 2025 at 07:52:52PM -0400, Eugene Loh wrote:
> On 9/28/25 19:26, Kris Van Hees wrote:
> 
> > On Sun, Sep 28, 2025 at 01:50:02AM -0400, Eugene Loh wrote:
> > 
> > > For kernel stacks, I guess size is always 8.  Could mention that? Also not a
> > > big deal.
> > I am not sure what you mean by this?  The size of the data that is set aide to
> > store the stack trace depends on the number of frames that is requested.
> 
> Right.  I mean the size of a PC.
> 
> The code used to have a function
> 
> int
> dt_print_stack(dtp, fp, format, addr, depth, size)
> {
>         for (i = 0; i < depth; i++) {
>                 switch (size) {
>                 case sizeof(uint32_t):
>                         /* LINTED - alignment */
>                         pc = *((uint32_t *)addr);
>                         break;
>                 case sizeof(uint64_t):
>                         /* LINTED - alignment */
>                         pc = *((uint64_t *)addr);
>                         break;
>                 default:
>                         return dt_set_errno(dtp, EDT_BADSTACKPC);
>                 }
>                 addr += size;
>                 [...]
>         }
> }
> 
> (Lots of code redacted.)  Anyhow, we feed in a "size" argument.  The ported
> function is
> 
> int
> dt_print_stack_kernel(dtp, fp, format, addr, indent, depth)
> {
>         for (i = 0; i < depth; i++) {
>                 pc = *((uint64_t *)addr);
>                 if (pc == 0)
>                 addr += sizeof(pc);
>                 [...]
>         }
> }
> 
> which assumes 8-byte values.  Again, no big deal.

Oh, that....  Well, since we no longer support 32-bit anyway, it seems hardly
relevant to keep code around that handles 32-bit PCs.  If we were to bring
back tracing of 32-bit apps on a 64-bit system, we can re-introduce code for
it, hopefully in a more clean manner, but that will require additional code in
various other places I believe.



More information about the DTrace-devel mailing list