* Makefile.in (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_DEFINE): New

variables.
	(main.o): Custom rule which uses $(TARGET_SYSTEM_ROOT_DEFINE).
	* configure.in: Add --with-sysroot.
	* configure: Regenerated.
	* main.c (gdb_sysroot): New variable.
	(captured_main): Initialize gdb_sysroot.
	* defs.h (gdb_sysroot): New extern declaration.
	* solib.c (_initialize_solib): Initialize solib_absolute_prefix.
This commit is contained in:
Daniel Jacobowitz 2003-01-13 18:00:16 +00:00
parent f5ebfba0ca
commit 030292b70e
7 changed files with 632 additions and 500 deletions

View file

@ -1,3 +1,15 @@
2003-01-13 Daniel Jacobowitz <drow@mvista.com>
* Makefile.in (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_DEFINE): New
variables.
(main.o): Custom rule which uses $(TARGET_SYSTEM_ROOT_DEFINE).
* configure.in: Add --with-sysroot.
* configure: Regenerated.
* main.c (gdb_sysroot): New variable.
(captured_main): Initialize gdb_sysroot.
* defs.h (gdb_sysroot): New extern declaration.
* solib.c (_initialize_solib): Initialize solib_absolute_prefix.
2003-01-12 Michael Chastain <mec@shout.net> 2003-01-12 Michael Chastain <mec@shout.net>
* config/djgpp/fnchange.lst: add gdb/ChangeLog-2002. * config/djgpp/fnchange.lst: add gdb/ChangeLog-2002.

View file

@ -136,6 +136,10 @@ INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC)
# Where is the ICONV library? This can be empty if libc has iconv. # Where is the ICONV library? This can be empty if libc has iconv.
LIBICONV = @LIBICONV@ LIBICONV = @LIBICONV@
# Did the user give us a --with-sysroot option?
TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
# #
# CLI sub directory definitons # CLI sub directory definitons
# #
@ -1403,6 +1407,11 @@ hpux-thread.o: $(srcdir)/hpux-thread.c
-I$(srcdir)/osf-share/HP800 -I/usr/include/dce \ -I$(srcdir)/osf-share/HP800 -I/usr/include/dce \
$(srcdir)/hpux-thread.c $(srcdir)/hpux-thread.c
# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and BINDIR.
main.o: main.c
$(CC) -c $(INTERNAL_CFLAGS) $(TARGET_SYSTEM_ROOT_DEFINE) \
-DBINDIR=\"$(bindir)\" $(srcdir)/main.c
# FIXME: Procfs.o gets -Wformat errors because things like pid_t don't # FIXME: Procfs.o gets -Wformat errors because things like pid_t don't
# match output format strings. # match output format strings.
procfs.o: $(srcdir)/procfs.c procfs.o: $(srcdir)/procfs.c

1035
gdb/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -851,6 +851,38 @@ fi
dnl Handle optional features that can be enabled. dnl Handle optional features that can be enabled.
AC_ARG_WITH(sysroot,
[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
[
case ${with_sysroot} in
yes) AC_ERROR(with-sysroot must specify path) ;;
*) TARGET_SYSTEM_ROOT=$with_sysroot ;;
esac
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
if test "x$exec_prefix" = xNONE; then
if test "x$prefix" = xNONE; then
test_prefix=/usr/local
else
test_prefix=$prefix
fi
else
test_prefix=$exec_prefix
fi
case ${TARGET_SYSTEM_ROOT} in
${test_prefix}*)
t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
TARGET_SYSTEM_ROOT_DEFINE="$t"
;;
esac
], [
TARGET_SYSTEM_ROOT=
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
])
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
# NOTE: Don't add -Wall or -Wunused, they both include # NOTE: Don't add -Wall or -Wunused, they both include
# -Wunused-parameter which reports bogus warnings. # -Wunused-parameter which reports bogus warnings.
# NOTE: If you add to this list, remember to update # NOTE: If you add to this list, remember to update

View file

@ -1,7 +1,7 @@
/* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */ /* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */
/* Basic, host-specific, and target-specific definitions for GDB. /* Basic, host-specific, and target-specific definitions for GDB.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -169,6 +169,9 @@ extern int xdb_commands;
/* enable dbx commands if set */ /* enable dbx commands if set */
extern int dbx_commands; extern int dbx_commands;
/* System root path, used to find libraries etc. */
extern char *gdb_sysroot;
extern int quit_flag; extern int quit_flag;
extern int immediate_quit; extern int immediate_quit;
extern int sevenbit_strings; extern int sevenbit_strings;

View file

@ -1,6 +1,6 @@
/* Top level stuff for GDB, the GNU debugger. /* Top level stuff for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -65,6 +65,9 @@ int xdb_commands = 0;
/* Whether dbx commands will be handled */ /* Whether dbx commands will be handled */
int dbx_commands = 0; int dbx_commands = 0;
/* System root path, used to find libraries etc. */
char *gdb_sysroot = 0;
struct ui_file *gdb_stdout; struct ui_file *gdb_stdout;
struct ui_file *gdb_stderr; struct ui_file *gdb_stderr;
struct ui_file *gdb_stdlog; struct ui_file *gdb_stdlog;
@ -201,6 +204,34 @@ captured_main (void *data)
/* initialize error() */ /* initialize error() */
error_init (); error_init ();
/* Set the sysroot path. */
#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT);
if (gdb_sysroot)
{
struct stat s;
int res = 0;
if (stat (gdb_sysroot, &s) == 0)
if (S_ISDIR (s.st_mode))
res = 1;
if (res == 0)
{
free (gdb_sysroot);
gdb_sysroot = TARGET_SYSTEM_ROOT;
}
}
else
gdb_sysroot = TARGET_SYSTEM_ROOT;
#else
#if defined (TARGET_SYSTEM_ROOT)
gdb_sysroot = TARGET_SYSTEM_ROOT;
#else
gdb_sysroot = "";
#endif
#endif
/* Parse arguments and options. */ /* Parse arguments and options. */
{ {
int c; int c;

View file

@ -1,7 +1,7 @@
/* Handle shared libraries for GDB, the GNU Debugger. /* Handle shared libraries for GDB, the GNU Debugger.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -875,6 +875,10 @@ For other (relative) files, you can add values using `set solib-search-path'.",
add_show_from_set (c, &showlist); add_show_from_set (c, &showlist);
set_cmd_completer (c, filename_completer); set_cmd_completer (c, filename_completer);
/* Set the default value of "solib-absolute-prefix" from the sysroot, if
one is set. */
solib_absolute_prefix = xstrdup (gdb_sysroot);
c = add_set_cmd ("solib-search-path", class_support, var_string, c = add_set_cmd ("solib-search-path", class_support, var_string,
(char *) &solib_search_path, (char *) &solib_search_path,
"Set the search path for loading non-absolute shared library symbol files.\n\ "Set the search path for loading non-absolute shared library symbol files.\n\