[DTrace-devel] [PATCH] Clean up the post-processing of ustack() frames

Kris Van Hees kris.van.hees at oracle.com
Fri Apr 29 04:10:50 UTC 2022


On Fri, Apr 29, 2022 at 12:00:47AM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/ustack/tst.ustack_profile.r.p | 26 ++++-----------------
>  1 file changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/test/unittest/ustack/tst.ustack_profile.r.p b/test/unittest/ustack/tst.ustack_profile.r.p
> index 0504cbef..06499bf5 100755
> --- a/test/unittest/ustack/tst.ustack_profile.r.p
> +++ b/test/unittest/ustack/tst.ustack_profile.r.p
> @@ -1,27 +1,11 @@
> -#!/bin/bash
> +#!/usr/bin/gawk -f
>  # Oracle Linux DTrace.
>  # Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  
> -# Determine if glibc version is at least 2.34.
> -read VERSMAJOR VERSMINOR <<< `ldd --version | awk '/^ldd/ {print $NF}' | tr '.' ' '`
> -if [ $VERSMAJOR -lt 2 ]; then
> -        VERS234=0
> -elif [ $VERSMAJOR -gt 2 ]; then
> -        VERS234=1
> -elif [ $VERSMINOR -lt 34 ]; then
> -        VERS234=0
> -else
> -        VERS234=1
> -fi
> -
> -# If we get to a frame we do not recognize, but we saw "main", exit.
> -# Rename the __libc_start_main frame, depending on glibc version.
> -awk '
> -BEGIN { saw_main = 0 }
> -!/myfunc_/ && !/main/ && saw_main { exit(0) }
> -  '$VERS234' { sub("__libc_start_call_main", "XXXSTART_MAINXXX") }
> -! '$VERS234' { sub("__libc_start_main",      "XXXSTART_MAINXXX") }
> +# Rename the __libc_start_main frame to some standard form.
> +# Once we get to a libc.so frame, exit.
> +{ sub("__libc_start.*_main", "XXXSTART_MAINXXX") }
>  { print }
> -/main/ { saw_main = 1 }'
> +/libc\.so/ { exit(0) }
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list