Re: [PATCH 5/5] Also look for debug files in gdb_sysroot

Pedro Alves
2015-07-01T13:45:36Z

On 06/16/2015 10:42 AM, Gary Benson wrote:
> This commit makes GDB look for separate debug files in gdb_sysroot if
> not found in the currently searched locations. This allows for easier
> analysis of core files from foreign machines using the sysroot option.
> The user creates or mounts a directory containing the necessary
> binaries and debuginfo and then sets GDB's sysroot to that directory
> before starting their debug session.

Looks fine to me, but I think this should be documented in
the manual, and maybe in the online help somewhere as well?
And NEWS too.

Thanks,
Pedro Alves

>
> gdb/ChangeLog:
>
> * gdb/symfile.c (find_separate_debug_file): In debugdir loop,
> also try alternate directory prefixed with gdb_sysroot.
> ---
> gdb/ChangeLog | 6 ++++++
> gdb/symfile.c | 11 +++++++++++
> 2 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 0cc940a..1cd99ea 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -1613,6 +1613,7 @@ find_separate_debug_file (const char *dir,
>
> if (altdir != NULL)
> {
> + /* Try in the alternate directory directly. */
> debugfile = build_debug_file_name (no_prefix, debugdir,
> altdir, debuglink, NULL);
> if (separate_debug_file_exists (debugfile, crc32, objfile))
> @@ -1621,6 +1622,16 @@ find_separate_debug_file (const char *dir,
> return debugfile;
> }
> xfree (debugfile);
> +
> + /* Try in the alternate directory in gdb_sysroot. */
> + debugfile = build_debug_file_name (gdb_sysroot, debugdir,
> + altdir, debuglink, NULL);
> + if (separate_debug_file_exists (debugfile, crc32, objfile))
> + {
> + do_cleanups (back_to);
> + return debugfile;
> + }
> + xfree (debugfile);