]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Implement --no-debug to accept debuginfo-lacking files. Use in self-test.
authorPetr Machata <pmachata@redhat.com>
Sat, 10 Jan 2009 15:14:54 +0000 (16:14 +0100)
committerPetr Machata <pmachata@redhat.com>
Sat, 10 Jan 2009 15:14:54 +0000 (16:14 +0100)
src/ChangeLog
src/dwarflint.c
tests/ChangeLog
tests/run-dwarflint-self.sh

index 3b73c4f142ebd91762c3ce7662387744a5f731b2..988cc4b647743c5ebe4c68a08d40c7b81191c00e 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-10  Petr Machata  <pmachata@redhat.com>
+
+       * dwarflint.c: Implement --no-debug: silently accept file, if its
+       debug info is not available.
+
 2009-01-10  Roland McGrath  <roland@redhat.com>
 
        * dwarfcmp.cc: New file.
index 0b02bbcd62d23f7b97a3805d7a93d2c137aa8abc..82217d07c5992991382e9991d6f5d01903387ef8 100644 (file)
@@ -53,6 +53,7 @@ const char *argp_program_bug_address = PACKAGE_BUGREPORT;
 
 #define ARGP_strict    300
 #define ARGP_gnu       301
+#define ARGP_nodebug   302
 
 /* Definitions of arguments for argp functions.  */
 static const struct argp_option options[] =
@@ -61,6 +62,8 @@ static const struct argp_option options[] =
   { "strict", ARGP_strict, NULL, 0,
     N_("Be extremely strict, flag level 2 features."), 0 },
   { "quiet", 'q', NULL, 0, N_("Do not print anything if successful"), 0 },
+  { "no-debug", ARGP_nodebug, NULL, 0,
+    N_("Accept silently if no debug info is available."), 0 },
   { "gnu", ARGP_gnu, NULL, 0,
     N_("Binary has been created with GNU toolchain and is therefore known to be \
 broken in certain ways"), 0 },
@@ -83,6 +86,9 @@ static struct argp argp =
   options, parse_opt, args_doc, doc, NULL, NULL, NULL
 };
 
+/* If true, we accept silently files without debuginfo.  */
+static bool tolerate_nodebug = false;
+
 static void
 process_file (int fd, Dwarf *dwarf, const char *fname,
              size_t size, bool only_one);
@@ -223,9 +229,11 @@ main (int argc, char *argv[])
          unsigned int prev_error_count = error_count;
          Dwarf *dwarf = dwarf_begin_elf (elf, DWARF_C_READ, NULL);
          if (dwarf == NULL)
-           ERROR (gettext ("cannot generate Dwarf descriptor: %s\n"),
-                  dwarf_errmsg (-1));
-
+           {
+             if (!tolerate_nodebug)
+               ERROR (gettext ("cannot generate Dwarf descriptor: %s\n"),
+                      dwarf_errmsg (-1));
+           }
          else
            {
              struct stat64 st;
@@ -275,6 +283,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
       warning_criteria.reject |= mc_acc_bloat;
       break;
 
+    case ARGP_nodebug:
+      tolerate_nodebug = true;
+      break;
+
     case 'q':
       be_quiet = true;
       break;
index 1d1d6e28bbffb247a55ecb87ecb864d7da3bfa53..b18af041f2616c3b002596a5b800b5cab9542af7 100644 (file)
@@ -1,3 +1,7 @@
+2009-01-10  Petr Machata  <pmachata@redhat.com>
+
+       * run-dwarflint-self.sh: Pass new option --no-debug to dwarflint.
+
 2009-01-10  Roland McGrath  <roland@redhat.com>
 
        * run-dwarflint-self.sh: New file.
index 7515976976f840b92e038e7b3839d277aaeddda8..16dd1597b829eaaf42ce8e72ac588484c3172cc0 100755 (executable)
@@ -30,7 +30,7 @@ runtest()
 {
   for file; do
     if [ -f $file ]; then
-      testrun ../src/dwarflint -q --gnu $file ||
+      testrun ../src/dwarflint -q --gnu --no-debug $file ||
       { echo "*** failure in $file"; status=1; }
     fi
   done