From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 3DF2C3858D33 for ; Wed, 13 Jan 2021 04:39:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3DF2C3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=2ndquadrant.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=craig.ringer@2ndquadrant.com Received: by mail-lj1-x236.google.com with SMTP id b10so1070474ljp.6 for ; Tue, 12 Jan 2021 20:39:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=+JUb4NEjz4+58Co3uUWPqESqSu1MdD8/5nqdoRaUcdM=; b=kG22UQCm7Q0AI0GB85LEV/zMc9pTj+gkGXq902464aVrYUaQX6kyWydJY3oROCVjFy YEmOtkUOvIC6QrELdvOJrcRtL7334rDVgFD+NaKFgMPxZ+Gz+//yvM3zkN7KyXtm4EtT z4CSigVeZ+33yrWw2FKzbjO0SZ5pQKEoCYBSyobSDZJvdOReKpg2hGymg2hNQOX4B3OE iwKIMgXeRZY5hcWveW8avZ4/atgpmp+6d+tkKdM+zCofwDmQcwpI4oWZaQx3BzsbVi/+ JPs64W+OBqRgNv6ar3yZVl1rR/OpYpPC39mJ0aO/Q5R5SfpDZUMnVgYTtaTutDyALxbZ YrUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+JUb4NEjz4+58Co3uUWPqESqSu1MdD8/5nqdoRaUcdM=; b=oeSu3Jnu4t/c6pHGcI1BSX1ntucINP6ced4M6cPHDBMLBFLWsPpaNjJVHXsewRTh9T o0mdrDGGjwbBBcmFkbFg1Cm4RAUH9LLzsCYBVEmhNXLWqVkTp4Q80N3rUP+BaTyP/cyy z2+BYeV+kTZTAhjhfcFzAOLXFYXrszWhj9n1ndWUNFY2hNLzLAbHD4PFKWMqdxmLR0el f5H3QVi4IORymJ/llLLa2GNTYV5GjBytiWH9RGRh/mKctb4e8WCj82ZVb6wGv5XzSmfK C0rYI69/rLsR/KjQTCNvV7HdaCYn1jv1LUt8atlMlkIaEG1D9nAA20mvRuBvQ1kvSRtt GVew== X-Gm-Message-State: AOAM533MwweElp1UWMGTkCFdZWvVb2yRKpFac+USzDBmU/Xtk/QgGf71 sCUCDsGksrHarYNkAwlMOgewUwVYx0g43PG2f2brZS1WlWRn3g== X-Google-Smtp-Source: ABdhPJxJB7y86vT3+PJDhEjrBTJvVI+tqMlUlebrku63A6dz32jKAnDXzIht6ZMJz0p1/dBU3CS7m8SbFUfzoG/3Wrc= X-Received: by 2002:a05:651c:1254:: with SMTP id h20mr106289ljh.211.1610512762714; Tue, 12 Jan 2021 20:39:22 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Craig Ringer Date: Wed, 13 Jan 2021 12:39:11 +0800 Message-ID: Subject: Re: Command line systemtap macro setting To: systemtap@sourceware.org, "Frank Ch. Eigler" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2021 04:39:26 -0000 Frank, Any thoughts on this? I'd be happy to submit a patch but I'd like to know if you think it's reasonable to do first, so I don't spend the time writing something that won't be committable. It'd be a big usability improvement in systemtap for me to be able to define systemtap language macros on the command line. On Fri, 8 Jan 2021 at 13:07, Craig Ringer wrote: > Hi > > I keep on finding situations where I want to set systemtap language macros > on the command line. AFAICS there is no such feature. Right? The closest > seems to be to generate a .stpm file with the desired macro definition and > put on the include path. > > Would you object to a patch that added this capability? If so, how do you > think it should be spelled on the command line? "-D" is taken. So maybe > "-M" ? > > The most important time I need command line macro definitions is to work > around the issues with relative paths. I pretty much always require > absolute paths for executables in my tapscripts. Otherwise @var("var@cu", > "exec_path") doesn't work properly or didn't last I checked. And probes > that fail to match seem to like to fail silently if the executable isn't > found on the PATH, where they'll report an explicit error if the executable > is a fully qualified path. So I try to run with absolute paths all the > time. But I don't really want users to have to hack the script to supply > them, so I'd like to be able to e.g. > > -D POSTGRES_EXECUTABLE="/path/to/postgres" > > However, this won't work - it'd set a C preprocessor macro for the runtime > compilation, not the systemtap language processing phase. And you can't > > -G POSTGRES_EXECUTABLE="/path/to/postgres" > > because probes don't accept globals in their arguments; this isn't legal: > > probe process(POSTGRES_EXECUTABLE).function("foo") { ...} > > That can be handled with a positional parameter instead, but doing so is > less user friendly. It's much less obvious what the param is and does when > reading the cmdline. > > Similarly, if I want to make it easy to customise script behaviour, > something like this won't work: > > global stats_report_interval_ms=5000 > probe timer.ms(stats_report_interval_ms ) { do_something(); } > > > > > -- > Craig Ringer http://www.2ndQuadrant.com/ > 2ndQuadrant - PostgreSQL Solutions for the Enterprise > -- Craig Ringer http://www.2ndQuadrant.com/ 2ndQuadrant - PostgreSQL Solutions for the Enterprise