[DTrace-devel] [PATCH 05/12] Add support for the stack() action
Eugene Loh
eugene.loh at oracle.com
Wed Jun 9 16:02:13 PDT 2021
On 6/9/21 1:21 AM, Eugene Loh wrote:
> On 6/9/21 12:43 AM, Kris Van Hees wrote:
>
>> Fri, May 28, 2021 at 02:35:09PM -0400,eugene.loh at oracle.com wrote:
>>> diff --git a/libdtrace/dt_consume.c b/libdtrace/dt_consume.c
>>> @@ -2057,7 +2060,16 @@ dt_consume_one(dtrace_hdl_t *dtp, FILE *fp, char *buf,
>>> if (rval != DTRACE_CONSUME_THIS)
>>> return dt_set_errno(dtp, EDT_BADRVAL);
>>>
>>> - switch (rec->dtrd_action) {
>>> + if (act == DTRACEACT_STACK) {
>>> + int depth = rec->dtrd_arg;
>>> +
>>> + if (dt_print_stack(dtp, fp, NULL, addr, depth,
>>> + rec->dtrd_size / depth) < 0)
>>> + return -1;
>>> + continue;
>>> + }
>>> +
>>> + switch (act) {
>> I truly do not understand why you put the DTRACEACT_STACK case outside the
>> switch, when it could just as easily be part of the switch.
>
> You brought this up with respect to another patch as well, so I
> figured I'd explain. The DTv1 code had this sequence of "if
> (act==foo)" code blocks. I was simply trying to preserve some of the
> structure of that code. Is that a good idea? Some people will think
> so some of the time, and others... well. Anyhow, I posted a v2 of
> that other patch. The switch statement ends up impacting other
> patches and I propagated the change through.
>
> Now, the DTv1 code still had the PRINTF-LIKE actions separately.
> Sounds like you want everything in one big switch. Fine by me. I'll
> do that. I just figured I'd explain why the code looked the way it did.
One other point. The code had been structured to look for dt_print_*()
functions for various actions, and then to look for and handle
ISPRINTFLIKE actions. That's why there was code for actions like
stack(), etc., and then for the printf-like stuff. I had been trying to
preserve that structure but, again, seems like you want it squashed
together so that's what's happening.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/dtrace-devel/attachments/20210609/71212f16/attachment.html
More information about the DTrace-devel
mailing list