From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id DF5E1385040B for ; Fri, 8 Jan 2021 05:07:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DF5E1385040B 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-lf1-x12d.google.com with SMTP id l11so20214945lfg.0 for ; Thu, 07 Jan 2021 21:07:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=/rRj+H8l/buu/VXAwaMuvjjlHK5FpLC0XfPCb4y1220=; b=FoviZ2s9vSWpFOv8KsRYZSw1a67JldG8OCu9b4vmqakNIXWKjI4548OddfBIIC6Ebj +Tyn83VoYndq4ogaBkZXdcjQaQJGztbzLYkG4xpMlznTkv7vptDafcRGo6nHZ9B6zg9y oBhhCTQXkpiwTMi7ajz/3kc71vaHbRL/T3KBMplyXU4oms+W0+640rpR+72Yea4zRlpF dr9DqlbXqgYqm9MzVOFR9w05UBbvuKjkVOM1GteIv5Mixqrf14psTaESjs5IuGNf9GYo 65AKk8feaMPAq05tpJwSwjX6wgT33k64xGxJjiC3OQZAWUtRqxgLMntCpustl4eQhAS5 rSfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=/rRj+H8l/buu/VXAwaMuvjjlHK5FpLC0XfPCb4y1220=; b=BdIXfO8TTFivLlhecIohWjZZWL8OJTVoblMUSe3wvUEq+SUGXGZFwGsQBPWhj1K43t 8iC6ImCgHiLkI1A6qQqisQ85g1Ow93E7haFVNKEwLGOB7gR/f9rJBJ9kgE9juFa/x5gD gEyASMSwobX+ZbczTGdQeH7NnbNQRrpfeE99RdM6TIFdbUBCE5npjSajzu8d1AjZ/PpG NgNSRHtrHc2jnlfDkns71A/wQ4DVF9lO5ABiGKMkdWbJKjz39MU6dpUN524AK+yWf7HY gOTRhYffNJl+f1D5PifcU90tssAcdwtMlAhv6a6QHxIM3Q1Hme/cA7+23PYAcCBUXcFf zSOw== X-Gm-Message-State: AOAM532EacGO/sEkf7/eNUQCMv8rLe1U5W+7GwVKDsfIQorwW5iEOsa1 0lcb+je+sQv/N1UX8T3KnR5y6mrc5dJLzS7ECef/bhZO2SW8RAC3 X-Google-Smtp-Source: ABdhPJxOUNmlCmD/hPCjEt9uDfwrEjHNSLSBR874+d+PaIQiLuTTmRiBEAXtn7+xkZ4Z9abvLkpTmEUBRzDnUYklZPk= X-Received: by 2002:a19:ecb:: with SMTP id 194mr888310lfo.70.1610082457191; Thu, 07 Jan 2021 21:07:37 -0800 (PST) MIME-Version: 1.0 From: Craig Ringer Date: Fri, 8 Jan 2021 13:07:26 +0800 Message-ID: Subject: Command line systemtap macro setting To: systemtap@sourceware.org X-Spam-Status: No, score=-1.8 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: Fri, 08 Jan 2021 05:07:41 -0000 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