diff options
author | Daniel Jacobowitz <drow@false.org> | 2003-01-13 18:00:16 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2003-01-13 18:00:16 +0000 |
commit | 030292b70ecb623482264bd03ddf9ced4d9b0bbe (patch) | |
tree | f75fe864f2a5f72c5adc69fff2fc5b45e53b127a /gdb/main.c | |
parent | f5ebfba0cad0523f81fe510be73c90edd6e2b17b (diff) | |
download | gdb-030292b70ecb623482264bd03ddf9ced4d9b0bbe.zip gdb-030292b70ecb623482264bd03ddf9ced4d9b0bbe.tar.gz gdb-030292b70ecb623482264bd03ddf9ced4d9b0bbe.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* Top level stuff for GDB, the GNU debugger. 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. This file is part of GDB. @@ -65,6 +65,9 @@ int xdb_commands = 0; /* Whether dbx commands will be handled */ 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_stderr; struct ui_file *gdb_stdlog; @@ -201,6 +204,34 @@ captured_main (void *data) /* initialize error() */ 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. */ { int c; |