This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support separate debuginfo and bin roots debug path searching.


Mark Wielaard <mjw@redhat.com> a écrit:

[...]

> I changed the implementation slightly from what Dodji suggested
> (it now only searches real sub-subdirs by using / as separator instead
> of using all full subpath prefixes) and added some documentation
> to explain what is going on. Dodji could you check if the changes
> still make sense to you?

[...]

> diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
> index 1faa494..6b8d1ac 100644
> --- a/libdwfl/find-debuginfo.c
> +++ b/libdwfl/find-debuginfo.c
> @@ -252,7 +252,15 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
>  	  dir = p;
>  	  if (mod->dw == NULL)
>  	    {
> -	      subdir = file_dirname + 1;
> +	      subdir = file_dirname;
> +	      /* We want to explore all sub-subdirs.  Chop off one slash
> +		 at a time.  */
> +	    explore_dir:
> +	      subdir = strchr (subdir, '/');

Yes, this is better than what I initially did.  Thank you for that.

> +	      if (subdir != NULL)
> +		subdir = subdir + 1;
> +	      if (subdir && *subdir == 0)
> +		continue;
>  	      file = debuglink_file;
>  	    }
>  	  else
> @@ -292,6 +300,9 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name,
>  		  }
>  		break;
>  	      }
> +	    /* If possible try again with a sub-subdir.  */
> +	    if (mod->dw == NULL && subdir)
> +	      goto explore_dir;
>  	    continue;
>  	  default:
>  	    goto fail_free;

And it all works just fine in my testing environment.

So this looks good for me, for what that's worth.

Thanks!

-- 
		Dodji

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]