aboutsummaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-09-19 16:55:34 +0000
committerFred Fish <fnf@specifix.com>1992-09-19 16:55:34 +0000
commitd75710b02c7dc0bef0c9a36f0976e7ac2fe6d660 (patch)
treef707a1984dfd24ff8588635e30b374417f809884 /gdb/main.c
parent5f1c39efa244145447808660b9bd8119cfc956c6 (diff)
downloadfsf-binutils-gdb-d75710b02c7dc0bef0c9a36f0976e7ac2fe6d660.zip
fsf-binutils-gdb-d75710b02c7dc0bef0c9a36f0976e7ac2fe6d660.tar.gz
fsf-binutils-gdb-d75710b02c7dc0bef0c9a36f0976e7ac2fe6d660.tar.bz2
* main.c (main): Move code that sets initial language to
symfile.c. Fixup places where command files are processed to be consistent in setting a default language if none has been previously set. * symfile.c (set_initial_language): Add code moved from main() that sets an initial default language when a new symbol file is read. * symfile.c (symbol_file_command): Call set_initial_language. * symtab.c (find_main_psymtab): Add FIXME comment.
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/gdb/main.c b/gdb/main.c
index 924aa90..b2643f5 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -767,25 +767,6 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
error_pre_print = "\n";
warning_pre_print = "\nwarning: ";
- /* Set the initial language. */
- {
- struct partial_symtab *pst = find_main_psymtab ();
- enum language lang = language_unknown;
- if (pst == NULL) ;
-#if 0
- /* A better solution would set the language when reading the psymtab.
- This would win for symbol file formats that encode the langauge,
- such as DWARF. But, we don't do that yet. FIXME */
- else if (pst->language != language_unknown)
- lang = pst->language;
-#endif
- else if (pst->filename != NULL)
- lang = deduce_language_from_filename (pst->filename);
- if (lang == language_unknown) /* Make C the default language */
- lang = language_c;
- set_language (lang);
- }
-
if (corearg != NULL)
if (!setjmp (to_top_level))
core_file_command (corearg, !batch);
@@ -812,19 +793,30 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
if (!homedir
|| memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
if (!inhibit_gdbinit && access (gdbinit, R_OK) == 0)
- if (!setjmp (to_top_level))
- source_command (gdbinit, 0);
- do_cleanups (ALL_CLEANUPS);
-
- for (i = 0; i < ncmd; i++)
- if (!setjmp (to_top_level))
{
- if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0')
- read_command_file (stdin);
- else
- source_command (cmdarg[i], !batch);
- do_cleanups (ALL_CLEANUPS);
+ /* If no language has been set yet, default to C. */
+ if (current_language->la_language == language_unknown)
+ set_language (language_c);
+ if (!setjmp (to_top_level))
+ source_command (gdbinit, 0);
}
+ do_cleanups (ALL_CLEANUPS);
+
+ for (i = 0; i < ncmd; i++)
+ {
+ /* If no language has been set yet, default to C. For consistency with
+ other places, we redo this each time before sourcing commands. */
+ if (current_language->la_language == language_unknown)
+ set_language (language_c);
+ if (!setjmp (to_top_level))
+ {
+ if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0')
+ read_command_file (stdin);
+ else
+ source_command (cmdarg[i], !batch);
+ do_cleanups (ALL_CLEANUPS);
+ }
+ }
free ((PTR)cmdarg);
/* Read in the old history after all the command files have been read. */