aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-11-15 17:28:02 +0000
committerFred Fish <fnf@specifix.com>1992-11-15 17:28:02 +0000
commite58de8a23021ce9bbdee715ac79745ebb93437a8 (patch)
tree008503bb278b756abfe43212bf412ab003eb6e7c /gdb/symfile.c
parentc1878f87886dd7ae9af9d2aafe8dcf075ecfaa9c (diff)
downloadgdb-e58de8a23021ce9bbdee715ac79745ebb93437a8.zip
gdb-e58de8a23021ce9bbdee715ac79745ebb93437a8.tar.gz
gdb-e58de8a23021ce9bbdee715ac79745ebb93437a8.tar.bz2
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c. * Makefile.in (YYOBJ): Add ch-exp.tab.o. * Makefile.in (saber_gdb): Add unload of ch-exp.y and load of ch-exp.tab.c. * Makefile.in (distclean): Add target ch-exp.tab.c. * Makefile.in (realclean): Add rm of ch-exp.tab.c. * Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on Makefile since it contains sed patterns used in generation. Add sed pattern to also delete #include of any malloc.h. * Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets. * ch-exp.y: New expression parser, for GNU-Chill. * c-exp.y, expr.c, expression.h, language.c, m2-exp.y, parser-defs.h, valarith.c, valops.c, value.h: Remap macros and function names to conform to K&R terminology with respect to logical and bitwise operators: UNOP_ZEROP => UNOP_LOGICAL_NOT UNOP_LOGNOT => UNOP_COMPLEMENT BINOP_LOGAND => BINOP_BITWISE_AND BINOP_LOGXOR => BINOP_BITWISE_XOR BINOP_LOGIOR => BINOP_BITWISE_IOR BINOP_AND => BINOP_LOGICAL_AND BINOP_OR => BINOP_LOGICAL_OR PREC_OR => PREC_LOGICAL_OR PREC_AND => PREC_LOGICAL_AND PREC_LOGIOR => PREC_BITWISE_IOR PREC_LOGXOR => PREC_BITWISE_XOR PREC_LOGAND => PREC_BITWISE_AND value_zerop() => value_logical_not() value_lognot() => value_complement() * c-exp.y (c_op_print_tab): Add explicit empty terminator. * m2-exp.y (m2_op_print_tab): Add explicit empty terminator. * defs.h (enum language): Add language_chill. * dwarfread.c (set_cu_language): Add LANG_CHILL case and make LANG_MODULA2 a recognized language. * eval.c (evaluate_subexp): Add OP_BOOL case. * expprint.c (print_subexp): Add OP_BOOL case. * gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for Chill as well as Modula-2. * gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long, builtin_type_chill_ulong, builtin_type_chill_real): Add. * i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary and is nonexistant in some SVR4 based systems. * language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4. * language.c (set_language_command): Add chill. * language.c (binop_result_type, integral_type, character_type, boolean_type, structured_type, value_true, binop_type_check): Add language_chill cases. * language.h (_LANG_chill): Define. * m2-exp.y (number_sign, modblock): Make static, #ifdef out unused modblock. * m2-exp.y (ANDAND): Rename to LOGICAL_AND. * source.c (source_info): Fix minor nits, print "1 line" rather than "1 lines", and "language is <lang>". * symfile.c (deduce_language_from_filename): Recognize the filename extensions ".chill", ".c186", and ".c286" for Chill. * valarith.c (value_binop): Handle TYPE_CODE_BOOL as well as TYPE_CODE_INT and TYPE_CODE_FLOAT. * valprint.c (val_print): Print TYPE_CODE_BOOL type values as "TRUE" or "FALSE". * valprint.c (typedef_print): Add case for language_chill. * values.c (value_from_longest): Handle TYPE_CODE_BOOL.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 21ead48..96c994f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "objfiles.h"
#include "gdbcmd.h"
#include "breakpoint.h"
+#include "language.h"
#include <obstack.h>
#include <assert.h>
@@ -50,6 +51,9 @@ extern int info_verbose;
/* Functions this file defines */
static void
+set_initial_language PARAMS ((void));
+
+static void
load_command PARAMS ((char *, int));
static void
@@ -643,7 +647,7 @@ symbol_file_command (args, from_tty)
current_source_line = 0;
if (from_tty)
{
- printf_filtered ("No symbol file now.\n");
+ printf ("No symbol file now.\n");
}
}
else
@@ -681,11 +685,45 @@ symbol_file_command (args, from_tty)
else
{
symbol_file_add (name, from_tty, (CORE_ADDR)0, 1, mapped, readnow);
+ set_initial_language ();
}
do_cleanups (cleanups);
}
}
+/* Set the initial language.
+
+ A better solution would be to record the language in the psymtab when reading
+ partial symbols, and then use it (if known) to set the language. This would
+ be a win for formats that encode the language in an easily discoverable place,
+ such as DWARF. For stabs, we can jump through hoops looking for specially
+ named symbols or try to intuit the language from the specific type of stabs
+ we find, but we can't do that until later when we read in full symbols.
+ FIXME. */
+
+static void
+set_initial_language ()
+{
+ struct partial_symtab *pst;
+ enum language lang = language_unknown;
+
+ pst = find_main_psymtab ();
+ if (pst != NULL)
+ {
+ 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);
+ expected_language = current_language; /* Don't warn the user */
+ }
+}
+
/* Open file specified by NAME and hand it off to BFD for preliminary
analysis. Result is a newly initialized bfd *, which includes a newly
malloc'd` copy of NAME (tilde-expanded and made absolute).
@@ -720,6 +758,7 @@ symfile_bfd_open (name)
error ("\"%s\": can't open to read symbols: %s.", name,
bfd_errmsg (bfd_error));
}
+ sym_bfd->cacheable = true;
if (!bfd_check_format (sym_bfd, bfd_object))
{
@@ -1013,6 +1052,8 @@ deduce_language_from_filename (filename)
return language_c;
else if(!strcmp(c,".cc") || !strcmp(c,".C"))
return language_cplus;
+ else if(!strcmp(c,".chill") || !strcmp(c,".c186") || !strcmp(c,".c286"))
+ return language_chill;
return language_unknown; /* default */
}
@@ -1128,7 +1169,7 @@ clear_symtab_users_once ()
return;
clear_symtab_users_done = clear_symtab_users_queued;
- printf_filtered ("Resetting debugger state after updating old symbol tables\n");
+ printf ("Resetting debugger state after updating old symbol tables\n");
/* Someday, we should do better than this, by only blowing away
the things that really need to be blown. */