* NEWS: Add "set sysroot" and "show sysroot".
* solib.c (solib_absolute_prefix): Delete. Replace all uses with gdb_sysroot. (_initialize_solib): Add "set sysroot" and "show sysroot". Make "solib-absolute-prefix" an alias to it. * gdb.texinfo (Commands to specify files): Describe "set sysroot" and "show sysroot". (Using the `gdbserver' program): Lowercase argument to @var. Expand description of setting up GDB on the host.
This commit is contained in:
parent
3bdcfdf41f
commit
f822c95b59
5 changed files with 96 additions and 55 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* NEWS: Add "set sysroot" and "show sysroot".
|
||||||
|
* solib.c (solib_absolute_prefix): Delete. Replace
|
||||||
|
all uses with gdb_sysroot.
|
||||||
|
(_initialize_solib): Add "set sysroot" and "show sysroot".
|
||||||
|
Make "solib-absolute-prefix" an alias to it.
|
||||||
|
|
||||||
2007-01-08 Ulrich Weigand <uweigand@de.ibm.com>
|
2007-01-08 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* frame.c (get_frame_register_bytes): New function.
|
* frame.c (get_frame_register_bytes): New function.
|
||||||
|
|
6
gdb/NEWS
6
gdb/NEWS
|
@ -37,6 +37,12 @@ catch exception unhandled
|
||||||
catch assert
|
catch assert
|
||||||
Stop the program execution when an Ada assertion failed.
|
Stop the program execution when an Ada assertion failed.
|
||||||
|
|
||||||
|
set sysroot
|
||||||
|
show sysroot
|
||||||
|
Set an alternate system root for target files. This is a more
|
||||||
|
general version of "set solib-absolute-prefix", which is now
|
||||||
|
an alias to "set sysroot".
|
||||||
|
|
||||||
* New native configurations
|
* New native configurations
|
||||||
|
|
||||||
OpenBSD/sh sh*-*openbsd*
|
OpenBSD/sh sh*-*openbsd*
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (Commands to specify files): Describe
|
||||||
|
"set sysroot" and "show sysroot".
|
||||||
|
(Using the `gdbserver' program): Lowercase argument
|
||||||
|
to @var. Expand description of setting up GDB on the
|
||||||
|
host.
|
||||||
|
|
||||||
2007-01-05 Joel Brobecker <brobecker@adacore.com>
|
2007-01-05 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* gdb.texinfo (Set Catchpoints): Add documentation for the new
|
* gdb.texinfo (Set Catchpoints): Add documentation for the new
|
||||||
|
|
|
@ -11842,33 +11842,45 @@ to specify the search directories for target libraries.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@cindex prefix for shared library file names
|
@cindex prefix for shared library file names
|
||||||
|
@cindex system root, alternate
|
||||||
@kindex set solib-absolute-prefix
|
@kindex set solib-absolute-prefix
|
||||||
@item set solib-absolute-prefix @var{path}
|
@kindex set sysroot
|
||||||
If this variable is set, @var{path} will be used as a prefix for any
|
@item set sysroot @var{path}
|
||||||
absolute shared library paths; many runtime loaders store the absolute
|
Use @var{path} as the system root for the program being debugged. Any
|
||||||
paths to the shared library in the target program's memory. If you use
|
absolute shared library paths will be prefixed with @var{path}; many
|
||||||
@samp{solib-absolute-prefix} to find shared libraries, they need to be laid
|
runtime loaders store the absolute paths to the shared library in the
|
||||||
out in the same way that they are on the target, with e.g.@: a
|
target program's memory. If you use @code{set sysroot} to find shared
|
||||||
@file{/usr/lib} hierarchy under @var{path}.
|
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}.
|
||||||
|
|
||||||
@cindex default value of @samp{solib-absolute-prefix}
|
The @code{set solib-absolute-prefix} command is an alias for @code{set
|
||||||
|
sysroot}.
|
||||||
|
|
||||||
|
@cindex default system root
|
||||||
@cindex @samp{--with-sysroot}
|
@cindex @samp{--with-sysroot}
|
||||||
You can set the default value of @samp{solib-absolute-prefix} by using the
|
You can set the default system root by using the configure-time
|
||||||
configure-time @samp{--with-sysroot} option.
|
@samp{--with-sysroot} option. If the system root is inside
|
||||||
|
@value{GDBN}'s configured binary prefix (set with @samp{--prefix} or
|
||||||
|
@samp{--exec-prefix}), then the default system root will be updated
|
||||||
|
automatically if the installed @value{GDBN} is moved to a new
|
||||||
|
location.
|
||||||
|
|
||||||
@kindex show solib-absolute-prefix
|
@kindex show sysroot
|
||||||
@item show solib-absolute-prefix
|
@item show sysroot
|
||||||
Display the current shared library prefix.
|
Display the current shared library prefix.
|
||||||
|
|
||||||
@kindex set solib-search-path
|
@kindex set solib-search-path
|
||||||
@item set solib-search-path @var{path}
|
@item set solib-search-path @var{path}
|
||||||
If this variable is set, @var{path} is a colon-separated list of directories
|
If this variable is set, @var{path} is a colon-separated list of
|
||||||
to search for shared libraries. @samp{solib-search-path} is used after
|
directories to search for shared libraries. @samp{solib-search-path}
|
||||||
@samp{solib-absolute-prefix} fails to locate the library, or if the path to
|
is used after @samp{sysroot} fails to locate the library, or if the
|
||||||
the library is relative instead of absolute. If you want to use
|
path to the library is relative instead of absolute. If you want to
|
||||||
@samp{solib-search-path} instead of @samp{solib-absolute-prefix}, be sure to
|
use @samp{solib-search-path} instead of @samp{sysroot}, be sure to set
|
||||||
set @samp{solib-absolute-prefix} to a nonexistant directory to prevent
|
@samp{sysroot} to a nonexistant directory to prevent @value{GDBN} from
|
||||||
@value{GDBN} from finding your host's libraries.
|
finding your host's libraries. @samp{sysroot} is preferred; setting
|
||||||
|
it to a nonexistant directory may interfere with automatic loading
|
||||||
|
of shared library symbols.
|
||||||
|
|
||||||
@kindex show solib-search-path
|
@kindex show solib-search-path
|
||||||
@item show solib-search-path
|
@item show solib-search-path
|
||||||
|
@ -12709,25 +12721,34 @@ You can debug processes by name instead of process ID if your target has the
|
||||||
@code{pidof} utility:
|
@code{pidof} utility:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
target> gdbserver @var{comm} --attach `pidof @var{PROGRAM}`
|
target> gdbserver @var{comm} --attach `pidof @var{program}`
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
In case more than one copy of @var{PROGRAM} is running, or @var{PROGRAM}
|
In case more than one copy of @var{program} is running, or @var{program}
|
||||||
has multiple threads, most versions of @code{pidof} support the
|
has multiple threads, most versions of @code{pidof} support the
|
||||||
@code{-s} option to only return the first process ID.
|
@code{-s} option to only return the first process ID.
|
||||||
|
|
||||||
@item On the host machine,
|
@item On the host machine,
|
||||||
connect to your target (@pxref{Connecting,,Connecting to a remote target}).
|
first make sure you have the necessary symbol files. Load symbols for
|
||||||
|
your application using the @code{file} command before you connect. Use
|
||||||
|
@code{set sysroot} to locate target libraries (unless your @value{GDBN}
|
||||||
|
was compiled with the correct sysroot using @code{--with-system-root}).
|
||||||
|
|
||||||
|
The symbol file and target libraries must exactly match the executable
|
||||||
|
and libraries on the target, with one exception: the files on the host
|
||||||
|
system should not be stripped, even if the files on the target system
|
||||||
|
are. Mismatched or missing files will lead to confusing results
|
||||||
|
during debugging. On @sc{gnu}/Linux targets, mismatched or missing
|
||||||
|
files may also prevent @code{gdbserver} from debugging multi-threaded
|
||||||
|
programs.
|
||||||
|
|
||||||
|
Connect to your target (@pxref{Connecting,,Connecting to a remote target}).
|
||||||
For TCP connections, you must start up @code{gdbserver} prior to using
|
For TCP connections, you must start up @code{gdbserver} prior to using
|
||||||
the @code{target remote} command. Otherwise you may get an error whose
|
the @code{target remote} command. Otherwise you may get an error whose
|
||||||
text depends on the host system, but which usually looks something like
|
text depends on the host system, but which usually looks something like
|
||||||
@samp{Connection refused}. You don't need to use the @code{load}
|
@samp{Connection refused}. You don't need to use the @code{load}
|
||||||
command in @value{GDBN} when using @code{gdbserver}, since the program is
|
command in @value{GDBN} when using @code{gdbserver}, since the program is
|
||||||
already on the target. However, if you want to load the symbols (as
|
already on the target.
|
||||||
you normally would), do that with the @code{file} command, and issue
|
|
||||||
it @emph{before} connecting to the server; otherwise, you will get an
|
|
||||||
error message saying @code{"Program is already running"}, since the
|
|
||||||
program is considered running after the connection.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
54
gdb/solib.c
54
gdb/solib.c
|
@ -85,10 +85,6 @@ static int solib_cleanup_queued = 0; /* make_run_cleanup called */
|
||||||
|
|
||||||
static void do_clear_solib (void *);
|
static void do_clear_solib (void *);
|
||||||
|
|
||||||
/* If non-zero, this is a prefix that will be added to the front of the name
|
|
||||||
shared libraries with an absolute filename for loading. */
|
|
||||||
static char *solib_absolute_prefix = NULL;
|
|
||||||
|
|
||||||
/* If non-empty, this is a search path for loading non-absolute shared library
|
/* If non-empty, this is a search path for loading non-absolute shared library
|
||||||
symbol files. This takes precedence over the environment variables PATH
|
symbol files. This takes precedence over the environment variables PATH
|
||||||
and LD_LIBRARY_PATH. */
|
and LD_LIBRARY_PATH. */
|
||||||
|
@ -114,26 +110,26 @@ The search path for loading non-absolute shared library symbol files is %s.\n"),
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
Global variable SOLIB_ABSOLUTE_PREFIX is used as a prefix directory
|
Global variable GDB_SYSROOT is used as a prefix directory
|
||||||
to search for shared libraries if they have an absolute path.
|
to search for shared libraries if they have an absolute path.
|
||||||
|
|
||||||
Global variable SOLIB_SEARCH_PATH is used as a prefix directory
|
Global variable SOLIB_SEARCH_PATH is used as a prefix directory
|
||||||
(or set of directories, as in LD_LIBRARY_PATH) to search for all
|
(or set of directories, as in LD_LIBRARY_PATH) to search for all
|
||||||
shared libraries if not found in SOLIB_ABSOLUTE_PREFIX.
|
shared libraries if not found in GDB_SYSROOT.
|
||||||
|
|
||||||
Search algorithm:
|
Search algorithm:
|
||||||
* If there is a solib_absolute_prefix and path is absolute:
|
* If there is a gdb_sysroot and path is absolute:
|
||||||
* Search for solib_absolute_prefix/path.
|
* Search for gdb_sysroot/path.
|
||||||
* else
|
* else
|
||||||
* Look for it literally (unmodified).
|
* Look for it literally (unmodified).
|
||||||
* Look in SOLIB_SEARCH_PATH.
|
* Look in SOLIB_SEARCH_PATH.
|
||||||
* If available, use target defined search function.
|
* If available, use target defined search function.
|
||||||
* If solib_absolute_prefix is NOT set, perform the following two searches:
|
* If gdb_sysroot is NOT set, perform the following two searches:
|
||||||
* Look in inferior's $PATH.
|
* Look in inferior's $PATH.
|
||||||
* Look in inferior's $LD_LIBRARY_PATH.
|
* Look in inferior's $LD_LIBRARY_PATH.
|
||||||
*
|
*
|
||||||
* The last check avoids doing this search when targetting remote
|
* The last check avoids doing this search when targetting remote
|
||||||
* machines since solib_absolute_prefix will almost always be set.
|
* machines since gdb_sysroot will almost always be set.
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
|
|
||||||
|
@ -146,25 +142,24 @@ solib_open (char *in_pathname, char **found_pathname)
|
||||||
int found_file = -1;
|
int found_file = -1;
|
||||||
char *temp_pathname = NULL;
|
char *temp_pathname = NULL;
|
||||||
char *p = in_pathname;
|
char *p = in_pathname;
|
||||||
int solib_absolute_prefix_is_empty;
|
int gdb_sysroot_is_empty;
|
||||||
|
|
||||||
solib_absolute_prefix_is_empty = (solib_absolute_prefix == NULL
|
gdb_sysroot_is_empty = (gdb_sysroot == NULL || *gdb_sysroot == 0);
|
||||||
|| *solib_absolute_prefix == 0);
|
|
||||||
|
|
||||||
if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix_is_empty)
|
if (! IS_ABSOLUTE_PATH (in_pathname) || gdb_sysroot_is_empty)
|
||||||
temp_pathname = in_pathname;
|
temp_pathname = in_pathname;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int prefix_len = strlen (solib_absolute_prefix);
|
int prefix_len = strlen (gdb_sysroot);
|
||||||
|
|
||||||
/* Remove trailing slashes from absolute prefix. */
|
/* Remove trailing slashes from absolute prefix. */
|
||||||
while (prefix_len > 0
|
while (prefix_len > 0
|
||||||
&& IS_DIR_SEPARATOR (solib_absolute_prefix[prefix_len - 1]))
|
&& IS_DIR_SEPARATOR (gdb_sysroot[prefix_len - 1]))
|
||||||
prefix_len--;
|
prefix_len--;
|
||||||
|
|
||||||
/* Cat the prefixed pathname together. */
|
/* Cat the prefixed pathname together. */
|
||||||
temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
|
temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
|
||||||
strncpy (temp_pathname, solib_absolute_prefix, prefix_len);
|
strncpy (temp_pathname, gdb_sysroot, prefix_len);
|
||||||
temp_pathname[prefix_len] = '\0';
|
temp_pathname[prefix_len] = '\0';
|
||||||
strcat (temp_pathname, in_pathname);
|
strcat (temp_pathname, in_pathname);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +167,7 @@ solib_open (char *in_pathname, char **found_pathname)
|
||||||
/* Now see if we can open it. */
|
/* Now see if we can open it. */
|
||||||
found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
|
found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
|
||||||
|
|
||||||
/* If the search in solib_absolute_prefix failed, and the path name is
|
/* If the search in gdb_sysroot failed, and the path name is
|
||||||
absolute at this point, make it relative. (openp will try and open the
|
absolute at this point, make it relative. (openp will try and open the
|
||||||
file according to its absolute path otherwise, which is not what we want.)
|
file according to its absolute path otherwise, which is not what we want.)
|
||||||
Affects subsequent searches for this solib. */
|
Affects subsequent searches for this solib. */
|
||||||
|
@ -206,14 +201,14 @@ solib_open (char *in_pathname, char **found_pathname)
|
||||||
&temp_pathname);
|
&temp_pathname);
|
||||||
|
|
||||||
/* If not found, next search the inferior's $PATH environment variable. */
|
/* If not found, next search the inferior's $PATH environment variable. */
|
||||||
if (found_file < 0 && solib_absolute_prefix_is_empty)
|
if (found_file < 0 && gdb_sysroot_is_empty)
|
||||||
found_file = openp (get_in_environ (inferior_environ, "PATH"),
|
found_file = openp (get_in_environ (inferior_environ, "PATH"),
|
||||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
||||||
&temp_pathname);
|
&temp_pathname);
|
||||||
|
|
||||||
/* If not found, next search the inferior's $LD_LIBRARY_PATH
|
/* If not found, next search the inferior's $LD_LIBRARY_PATH
|
||||||
environment variable. */
|
environment variable. */
|
||||||
if (found_file < 0 && solib_absolute_prefix_is_empty)
|
if (found_file < 0 && gdb_sysroot_is_empty)
|
||||||
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
|
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
|
||||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
||||||
&temp_pathname);
|
&temp_pathname);
|
||||||
|
@ -979,18 +974,21 @@ inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'."),
|
||||||
show_auto_solib_add,
|
show_auto_solib_add,
|
||||||
&setlist, &showlist);
|
&setlist, &showlist);
|
||||||
|
|
||||||
add_setshow_filename_cmd ("solib-absolute-prefix", class_support,
|
add_setshow_filename_cmd ("sysroot", class_support,
|
||||||
&solib_absolute_prefix, _("\
|
&gdb_sysroot, _("\
|
||||||
Set prefix for loading absolute shared library symbol files."), _("\
|
Set an alternate system root."), _("\
|
||||||
Show prefix for loading absolute shared library symbol files."), _("\
|
Show the current system root."), _("\
|
||||||
For other (relative) files, you can add values using `set solib-search-path'."),
|
The system root is used to load absolute shared library symbol files.\n\
|
||||||
|
For other (relative) files, you can add directories using\n\
|
||||||
|
`set solib-search-path'."),
|
||||||
reload_shared_libraries,
|
reload_shared_libraries,
|
||||||
NULL,
|
NULL,
|
||||||
&setlist, &showlist);
|
&setlist, &showlist);
|
||||||
|
|
||||||
/* Set the default value of "solib-absolute-prefix" from the sysroot, if
|
add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
|
||||||
one is set. */
|
&setlist);
|
||||||
solib_absolute_prefix = xstrdup (gdb_sysroot);
|
add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
|
||||||
|
&showlist);
|
||||||
|
|
||||||
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
|
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
|
||||||
&solib_search_path, _("\
|
&solib_search_path, _("\
|
||||||
|
|
Loading…
Add table
Reference in a new issue