diff options
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -188,9 +188,6 @@ captured_main (void *data) line[0] = '\0'; /* Terminate saved (now empty) cmd line */ instream = stdin; - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - current_directory = gdb_dirbuf; - gdb_stdout = stdio_fileopen (stdout); gdb_stderr = stdio_fileopen (stderr); gdb_stdlog = gdb_stderr; /* for moment */ @@ -199,6 +196,15 @@ captured_main (void *data) gdb_stdtargerr = gdb_stderr; /* for moment */ gdb_stdtargin = gdb_stdin; /* for moment */ + if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) + /* Don't use *_filtered or warning() (which relies on + current_target) until after initialize_all_files(). */ + fprintf_unfiltered (gdb_stderr, + _("%s: warning: error finding working directory: %s\n"), + argv[0], safe_strerror (errno)); + + current_directory = gdb_dirbuf; + /* Set the sysroot path. */ #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT); |