On Tue, Aug 23, 2016 at 06:18:10PM +0200, Matija Glavinic Pecotic wrote:

SNIP

> -             ret = filename__read_debuglink(filename, debuglink,
> -                                            size - (debuglink - filename));
> +             ret = filename__read_debuglink(filename, symfile, PATH_MAX);
> +             if (ret)
> +                     break;
> +
> +             /* Check predefined locations where debug file might reside:
> +              *  - if debuglink is absolute path, check only that one
> +              * If debuglink provides name w/o path, look for debug file:
> +              *  - in the same directory as dso
> +              *  - in the .debug subdirectory of dso directory
> +              *  - in the /usr/lib/debug/[dso directory]
> +              *  */
> +             ret = 0;
> +             if (symfile[0] == '/') {
> +                     if (!is_regular_file(symfile))
> +                             ret = -1;
> +                     else
> +                             strncpy(filename, symfile, size);
> +                     break;
>               }
> +
> +             snprintf(filename, size, "%s/%s", dso_dir, symfile);
> +             if(is_regular_file(filename))
> +                     break;
> +
> +             snprintf(filename, size, "%s/.debug/%s", dso_dir, symfile);
> +             if(is_regular_file(filename))
> +                     break;
> +
> +             snprintf(filename, size, "/usr/lib/debug/%s/%s",
> +                             dso_dir, symfile);
> +             if(is_regular_file(filename))
> +                     break;

it might be more clear to follow the same way we do for vmlinux search,
like array of possible paths and generic code to check.. search for
vmlinux_path in symbol.c

jirka

Reply via email to