Re: [PATCH 3/7] Use gdb_sysroot for main executable on attach

Pedro Alves
2015-04-15T10:43:47Z

On 04/01/2015 12:22 PM, Gary Benson wrote:

> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -17800,18 +17800,20 @@ may try to load the host's libraries. @value{GDBN} has two variables
> to specify the search directories for target libraries.
>
> @table @code
> -@cindex prefix for shared library file names
> +@cindex prefix for executable and shared library file names
> @cindex system root, alternate
> @kindex set solib-absolute-prefix
> @kindex set sysroot
> @item set sysroot @var{path}
> Use @var{path} as the system root for the program being debugged. Any
> -absolute shared library paths will be prefixed with @var{path}; many
> -runtime loaders store the absolute paths to the shared library in the
> -target program's memory. If you use @code{set sysroot} to find shared
> -libraries, they need to be laid out in the same way that they are on
> -the target, with e.g.@: a @file{/lib} and @file{/usr/lib} hierarchy
> -under @var{path}.
> +shared library paths will be prefixed with @var{path}; many runtime
> +loaders store the absolute paths to the shared library in the target
> +program's memory. When attaching to already-running processes, their

This "When attaching to already-running processes" part confuses me,
as the sysroot is also prepended to paths in the "run" case.

Otherwise looks good to me.

> +paths will be prefixed with @var{path} if reported to @value{GDBN} as
> +absolute by the operating system. If you use @code{set sysroot} to
> +find executables and shared libraries, they need to be laid out in
> +the same way that they are on the target, with e.g.@: a @file{/bin},
> +@file{/lib} and @file{/usr/lib} hierarchy under @var{path}.
>
> If @var{path} starts with the sequence @file{target:} and the target
> system is remote then @value{GDBN} will retrieve the target binaries
> @@ -17846,7 +17848,7 @@ system:
> c:/foo/bar.dll @result{} /path/to/sysroot/c:/foo/bar.dll
> @end smallexample

Thanks,
Pedro Alves