]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl/
authorRoland McGrath <roland@redhat.com>
Wed, 7 May 2008 18:37:14 +0000 (18:37 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 7 May 2008 18:37:14 +0000 (18:37 +0000)
2008-05-06  Roland McGrath  <roland@frob.com>

* linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use
FTS_LOGICAL here too.
(dwfl_linux_kernel_find_elf): Likewise.

libdwfl/ChangeLog
libdwfl/find-debuginfo.c
libdwfl/linux-kernel-modules.c

index 2b4d78d97959bcb3dbc4cf0e8a0c302587e37e6a..2a8166db4c1597613408c2d02856fabf31113b9d 100644 (file)
@@ -1,3 +1,17 @@
+2008-05-06  Roland McGrath  <roland@frob.com>
+
+       * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use
+       FTS_LOGICAL here too.
+       (dwfl_linux_kernel_find_elf): Likewise.
+
+2008-04-29  Roland McGrath  <roland@redhat.com>
+
+       * find-debuginfo.c (dwfl_standard_find_debuginfo): Try path search
+       based on canonicalize_file_name if it differs from the supplied name.
+
+       * linux-kernel-modules.c (check_module_notes): Use FTS_LOGICAL so
+       we accept symlinks.
+
 2008-04-27  Roland McGrath  <roland@redhat.com>
 
        * linux-kernel-modules.c (report_kernel): Fix crash when
index f1ff3a4b098906690ff144f27819ec406d2b0248..a01293e8e7885ef475a0c4c2dfa3b145f2be1a0d 100644 (file)
@@ -1,5 +1,5 @@
 /* Standard find_debuginfo callback for libdwfl.
-   Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
+   Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -242,7 +242,23 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
     }
 
   /* Failing that, search the path by name.  */
-  return find_debuginfo_in_path (mod, file_name, debuglink_file, debuglink_crc,
-                                debuginfo_file_name);
+  int fd = find_debuginfo_in_path (mod, file_name,
+                                  debuglink_file, debuglink_crc,
+                                  debuginfo_file_name);
+
+  if (fd < 0 && errno == 0)
+    {
+      /* If FILE_NAME is a symlink, the debug file might be associated
+        with the symlink target name instead.  */
+
+      char *canon = canonicalize_file_name (file_name);
+      if (canon != NULL && strcmp (file_name, canon))
+       fd = find_debuginfo_in_path (mod, canon,
+                                    debuglink_file, debuglink_crc,
+                                    debuginfo_file_name);
+      free (canon);
+    }
+
+  return fd;
 }
 INTDEF (dwfl_standard_find_debuginfo)
index d18657b2b47e39ad32e3aa9ce2917983ba90a682..2cfe6bc8a35cdefdcb42099e0a37db61d7c4ca7b 100644 (file)
@@ -281,7 +281,7 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
            return errno;
        }
 
-      FTS *fts = fts_open (modulesdir, FTS_NOSTAT, NULL);
+      FTS *fts = fts_open (modulesdir, FTS_NOSTAT | FTS_LOGICAL, NULL);
       if (modulesdir[0] == (char *) release)
        modulesdir[0] = NULL;
       if (fts == NULL)
@@ -296,6 +296,7 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
          switch (f->fts_info)
            {
            case FTS_F:
+           case FTS_SL:
            case FTS_NSOK:
              /* See if this file name matches "*.ko".  */
              if (f->fts_namelen > 3
@@ -345,6 +346,7 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
              result = f->fts_errno;
              break;
 
+           case FTS_SLNONE:
            default:
              continue;
            }
@@ -494,7 +496,7 @@ check_module_notes (Dwfl_Module *mod)
   if (asprintf (&dirs[0], MODNOTESFMT, mod->name) < 0)
     return ENOMEM;
 
-  FTS *fts = fts_open (dirs, FTS_NOSTAT, NULL);
+  FTS *fts = fts_open (dirs, FTS_NOSTAT | FTS_LOGICAL, NULL);
   if (fts == NULL)
     {
       free (dirs[0]);
@@ -508,6 +510,7 @@ check_module_notes (Dwfl_Module *mod)
       switch (f->fts_info)
        {
        case FTS_F:
+       case FTS_SL:
        case FTS_NSOK:
          result = check_notes (mod, f->fts_accpath, 0, f->fts_name);
          if (result > 0)       /* Nothing found.  */
@@ -523,6 +526,7 @@ check_module_notes (Dwfl_Module *mod)
          break;
 
        case FTS_NS:
+       case FTS_SLNONE:
        default:
          continue;
        }
@@ -607,7 +611,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
   if (asprintf (&modulesdir[0], MODULEDIRFMT, release) < 0)
     return -1;
 
-  FTS *fts = fts_open (modulesdir, FTS_NOSTAT, NULL);
+  FTS *fts = fts_open (modulesdir, FTS_NOSTAT | FTS_LOGICAL, NULL);
   if (fts == NULL)
     {
       free (modulesdir[0]);
@@ -657,6 +661,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
       switch (f->fts_info)
        {
        case FTS_F:
+       case FTS_SL:
        case FTS_NSOK:
          /* See if this file name is "MODULE_NAME.ko".  */
          if (f->fts_namelen == namelen + 3
@@ -685,6 +690,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
          error = f->fts_errno;
          break;
 
+       case FTS_SLNONE:
        default:
          break;
        }