From d75710b02c7dc0bef0c9a36f0976e7ac2fe6d660 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sat, 19 Sep 1992 16:55:34 +0000 Subject: * 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. --- gdb/ChangeLog | 12 ++++++++++++ gdb/main.c | 52 ++++++++++++++++++++++------------------------------ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 325670f..6d13c79 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Sat Sep 19 09:52:26 1992 Fred Fish (fnf@cygnus.com) + + * 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. + Wed Sep 16 22:31:55 1992 K. Richard Pixley (rich@sendai.cygnus.com) * breakpoint.c, sparc-tdep.c: comment changes. 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. */ -- cgit v1.1