public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Trapp <michael.trapp@sap.com>
To: elfutils-devel@sourceware.org
Subject: [PATCH] debuginfod: add --disable-source-scan option.
Date: Fri,  3 Jun 2022 11:28:57 +0200	[thread overview]
Message-ID: <20220603092857.63144-1-michael.trapp@sap.com> (raw)

--disable-source-scan disables scanning of the dwarf source info
of debuginfo sections. The source info is not required in setups
without source code access.

Signed-off-by: Michael Trapp <michael.trapp@sap.com>
---

This option should save some scan cycles and DB space. If there
is no access to source code, the source info is not required.
In our setup the DB size is <5% without the source info.

 debuginfod/debuginfod.cxx | 9 ++++++++-
 doc/debuginfod.8          | 6 ++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 13980ced..51f4302b 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -381,6 +381,8 @@ static const struct argp_option options[] =
    {"forwarded-ttl-limit", ARGP_KEY_FORWARDED_TTL_LIMIT, "NUM", 0, "Limit of X-Forwarded-For hops, default 8.", 0},
 #define ARGP_KEY_PASSIVE 0x1008
    { "passive", ARGP_KEY_PASSIVE, NULL, 0, "Do not scan or groom, read-only database.", 0 },
+#define ARGP_KEY_DISABLE_SOURCE_SCAN 0x1009
+   { "disable-source-scan", ARGP_KEY_DISABLE_SOURCE_SCAN, NULL, 0, "Do not scan dwarf source info.", 0 },
    { NULL, 0, NULL, 0, NULL, 0 },
   };
 
@@ -430,6 +432,7 @@ static long fdcache_mintmp;
 static long fdcache_prefetch_mbs;
 static long fdcache_prefetch_fds;
 static unsigned forwarded_ttl_limit = 8;
+static bool scan_source_info = true;
 static string tmpdir;
 static bool passive_p = false;
 
@@ -632,6 +635,9 @@ parse_opt (int key, char *arg,
         // other conflicting options tricky to check
         argp_failure(state, 1, EINVAL, "inconsistent options with passive mode");
       break;
+    case ARGP_KEY_DISABLE_SOURCE_SCAN:
+      scan_source_info = false;
+      break;
       // case 'h': argp_state_help (state, stderr, ARGP_HELP_LONG|ARGP_HELP_EXIT_OK);
     default: return ARGP_ERR_UNKNOWN;
     }
@@ -2705,7 +2711,8 @@ elf_classify (int fd, bool &executable_p, bool &debuginfo_p, string &buildid, se
               startswith (section_name, ".zdebug_line"))
             {
               debuginfo_p = true;
-              dwarf_extract_source_paths (elf, debug_sourcefiles);
+              if (scan_source_info)
+                dwarf_extract_source_paths (elf, debug_sourcefiles);
               break; // expecting only one .*debug_line, so no need to look for others
             }
           else if (startswith (section_name, ".debug_") ||
diff --git a/doc/debuginfod.8 b/doc/debuginfod.8
index 95b827e9..a94315ad 100644
--- a/doc/debuginfod.8
+++ b/doc/debuginfod.8
@@ -273,6 +273,12 @@ Configure limits of X-Forwarded-For hops. if X-Forwarded-For
 exceeds N hops, it will not delegate a local lookup miss to
 upstream debuginfods. The default limit is 8.
 
+.TP
+.B "\-\-disable\-source\-scan"
+Disable scan of the dwarf source info of debuginfo sections.
+If a setup has no access to source code, the source info is not
+required.
+
 .TP
 .B "\-v"
 Increase verbosity of logging to the standard error file descriptor.
-- 
2.32.1 (Apple Git-133)


             reply	other threads:[~2022-06-03  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  9:28 Michael Trapp [this message]
2022-06-03 17:27 ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220603092857.63144-1-michael.trapp@sap.com \
    --to=michael.trapp@sap.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).