From: Roland McGrath Date: Wed, 7 May 2008 18:37:14 +0000 (+0000) Subject: libdwfl/ X-Git-Tag: elfutils-0.135~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fa20e84d7ac183bd3e270d825a557d879921b9c;p=thirdparty%2Felfutils.git libdwfl/ 2008-05-06 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use FTS_LOGICAL here too. (dwfl_linux_kernel_find_elf): Likewise. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 2b4d78d97..2a8166db4 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,17 @@ +2008-05-06 Roland McGrath + + * 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 + + * 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 * linux-kernel-modules.c (report_kernel): Fix crash when diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index f1ff3a4b0..a01293e8e 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -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) diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index d18657b2b..2cfe6bc8a 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -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; }