aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog38
-rw-r--r--gdb/Makefile.in1
-rw-r--r--gdb/buildsym.c4
-rw-r--r--gdb/c-exp.y3
-rw-r--r--gdb/ch-exp.y3
-rw-r--r--gdb/ch-typeprint.c1
-rw-r--r--gdb/ch-valprint.c1
-rw-r--r--gdb/coffread.c2
-rw-r--r--gdb/core.c1
-rw-r--r--gdb/coredep.c1
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/findvar.c7
-rw-r--r--gdb/fork-child.c1
-rw-r--r--gdb/inferior.h45
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/inftarg.c81
-rw-r--r--gdb/m2-exp.y3
-rw-r--r--gdb/maint.c2
-rw-r--r--gdb/nlmread.c1
-rw-r--r--gdb/objfiles.c145
-rw-r--r--gdb/parser-defs.h29
-rw-r--r--gdb/regex.h2
-rw-r--r--gdb/stabsread.h25
23 files changed, 255 insertions, 151 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c51fee7..4b88ca2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,41 @@
+Thu Oct 21 12:23:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
+ which no longer occur.
+
+ gcc -Wall lint:
+ * findvar.c (symbol_read_needs_frame), corelow.c (ignore),
+ inflow.c (gdb_has_a_terminal): Make sure to return a value.
+ * regex.h: Declare re_set_syntax.
+ * printcmd.c: Include valprint.h.
+ * infcmd.c, exec.c, maint.c, core.c: Include language.h.
+ * maint.c: Include expression.h.
+ * infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
+ * inftarg.c: Include command.h.
+ * coredep.c: Include value.h.
+ * c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
+ * ch-typeprint.c: Include typeprint.h.
+ * ch-valprint.c: Include c-lang.h.
+ * nlmread.c: Include buildsym.h.
+ * environ.c: Include gdbcore.h. Only include defs.h once.
+ (set_in_environ): Cast const char * to char * when passing to
+ set_gnutarget.
+ Remove unused variables:
+ * printcmd.c (printf_command): args_to_vprintf.
+ * coffread.c (coff_symfile_init): strsection.
+ Move variables to within the #ifdefs where they are used:
+ * symtab.c (gdb_mangle_name): opname.
+ * inftarg.c (child_attach): pid and exec_file.
+ * inftarg.c (child_detach): siggnal.
+ * objfiles.c (allocate_objfile): mapto, md, and fd.
+ * objfiles.c (free_objfile): mmfd.
+ * infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
+ * infrun.c (wait_for_inferior): Remove unused same_pid label.
+ * inferior.h: Declare set_sigint_trap and clear_sigint_trap.
+ * parser-defs.h: Declare write_exp_elt_block.
+ * stabsread.h: Declare elfstab_offset_sections and
+ coffstab_build_psymtabs.
+
Thu Oct 21 12:05:08 1993 Ken Raeburn (raeburn@cygnus.com)
Patch from Jeff Law:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 21094a8..26ffeb00 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -730,7 +730,6 @@ version.c: Makefile
# else.
c-exp.tab.o: c-exp.tab.c
c-exp.tab.c: c-exp.y Makefile.in
- @echo 'Expect 6 shift/reduce conflicts.'
$(YACC) $(YFLAGS) $(srcdir)/c-exp.y
-sed -e '/extern.*malloc/d' \
-e '/extern.*realloc/d' \
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index dfa9be1..58eb157 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -39,6 +39,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "buildsym.h" /* Our own declarations */
#undef EXTERN
+/* For cleanup_undefined_types and finish_global_stabs (somewhat
+ questionable--see comment where we call them). */
+#include "stabsread.h"
+
static int
compare_line_numbers PARAMS ((const void *, const void *));
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 65f7537..dd7de2d 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -42,6 +42,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "language.h"
#include "c-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index b6370f3..c544a4e 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -60,6 +60,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "parser-defs.h"
#include "ch-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c
index c3cdcd2..06318b4 100644
--- a/gdb/ch-typeprint.c
+++ b/gdb/ch-typeprint.c
@@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "language.h"
#include "demangle.h"
#include "ch-lang.h"
+#include "typeprint.h"
#include <string.h>
#include <errno.h>
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index 261b22e..3e7f18e 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "language.h"
#include "demangle.h"
+#include "c-lang.h" /* For c_val_print */
static void
chill_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
diff --git a/gdb/coffread.c b/gdb/coffread.c
index ffe00d5..48b3ca5 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -513,7 +513,7 @@ static void
coff_symfile_init (objfile)
struct objfile *objfile;
{
- asection *section, *strsection;
+ asection *section;
bfd *abfd = objfile->obfd;
/* Allocate struct to keep track of stab reading. */
diff --git a/gdb/core.c b/gdb/core.c
index 36c9ab5..9126d94 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "gdbcore.h"
#include "dis-asm.h"
+#include "language.h"
extern char registers[];
diff --git a/gdb/coredep.c b/gdb/coredep.c
index d94fd98..ae30980 100644
--- a/gdb/coredep.c
+++ b/gdb/coredep.c
@@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/types.h>
#include <sys/param.h>
#include "gdbcore.h"
+#include "value.h" /* For supply_register. */
/* These are needed on various systems to expand REGISTER_U_ADDR. */
#ifndef USG
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 1cebc48..717a6ee 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "target.h"
#include "gdbcore.h"
+#include "thread.h"
static void
core_files_info PARAMS ((struct target_ops *));
@@ -299,6 +300,7 @@ ignore (addr, contents)
CORE_ADDR addr;
char *contents;
{
+ return 0;
}
struct target_ops core_ops = {
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 50d5da6..fe9fc36 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -555,6 +555,7 @@ symbol_read_needs_frame (sym)
case LOC_OPTIMIZED_OUT:
return 0;
}
+ return 1;
}
/* Given a struct symbol for a variable,
@@ -896,8 +897,12 @@ value_from_register (type, regnum, frame)
/* eg a variable of type `float' in a 68881 register
with raw type `extended' and virtual type `double'.
Fetch it as a `double' and then convert to `float'. */
+ /* FIXME: This value will be not_lval, which means we can't assign
+ to it. Probably the right fix is to do the cast on a temporary
+ value, and just copy the VALUE_CONTENTS over. */
v = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
- memcpy (VALUE_CONTENTS_RAW (v), virtual_buffer, len);
+ memcpy (VALUE_CONTENTS_RAW (v), virtual_buffer,
+ REGISTER_VIRTUAL_SIZE (regnum));
v = value_cast (type, v);
}
else
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 3c01b60..e5a16c5 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -25,6 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "wait.h"
#include "gdbcore.h"
#include "terminal.h"
+#include "thread.h"
#include <signal.h>
diff --git a/gdb/inferior.h b/gdb/inferior.h
index f0dddda..6fdad93 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -36,9 +36,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
* control variables.
*/
struct inferior_status {
- int pc_changed;
int stop_signal;
- int stop_pc;
+ CORE_ADDR stop_pc;
FRAME_ADDR stop_frame_address;
bpstat stop_bpstat;
int stop_step;
@@ -55,6 +54,12 @@ struct inferior_status {
FRAME_ADDR selected_frame_address;
int selected_level;
char stop_registers[REGISTER_BYTES];
+
+ /* These are here because if call_function_by_hand has written some
+ registers and then decides to call error(), we better not have changed
+ any registers. */
+ char registers[REGISTER_BYTES];
+
int breakpoint_proceeded;
int restore_stack_info;
int proceed_to_finish;
@@ -66,6 +71,9 @@ save_inferior_status PARAMS ((struct inferior_status *, int));
extern void
restore_inferior_status PARAMS ((struct inferior_status *));
+extern void set_sigint_trap PARAMS ((void));
+extern void clear_sigint_trap PARAMS ((void));
+
/* File name for default use for standard in/out in the inferior. */
extern char *inferior_io_terminal;
@@ -98,8 +106,7 @@ generic_mourn_inferior PARAMS ((void));
extern void
terminal_ours PARAMS ((void));
-extern void
-run_stack_dummy PARAMS ((char*, CORE_ADDR, char [REGISTER_BYTES]));
+extern int run_stack_dummy PARAMS ((CORE_ADDR, char [REGISTER_BYTES]));
extern CORE_ADDR
read_pc PARAMS ((void));
@@ -171,7 +178,7 @@ void
detach PARAMS ((int));
extern void
-child_resume PARAMS ((int, int));
+child_resume PARAMS ((int, int, int));
#ifndef PTRACE_ARG3_TYPE
#define PTRACE_ARG3_TYPE int /* Correct definition for most systems. */
@@ -260,7 +267,12 @@ extern int stopped_by_random_signal;
/* Range to single step within.
If this is nonzero, respond to a single-step signal
- by continuing to step if the pc is in this range. */
+ by continuing to step if the pc is in this range.
+
+ If step_range_start and step_range_end are both 1, it means to step for
+ a single instruction (FIXME: it might clean up wait_for_inferior in a
+ minor way if this were changed to the address of the instruction and
+ that address plus one. But maybe not.). */
extern CORE_ADDR step_range_start; /* Inclusive */
extern CORE_ADDR step_range_end; /* Exclusive */
@@ -301,11 +313,6 @@ extern int proceed_to_finish;
extern char stop_registers[REGISTER_BYTES];
-/* Nonzero if pc has been changed by the debugger
- since the inferior stopped. */
-
-extern int pc_changed;
-
/* Nonzero if the child process in inferior_pid was attached rather
than forked. */
@@ -338,6 +345,7 @@ extern int attach_flag;
#define ON_STACK 1
#define BEFORE_TEXT_END 2
#define AFTER_TEXT_END 3
+#define AT_ENTRY_POINT 4
#if !defined (CALL_DUMMY_LOCATION)
#define CALL_DUMMY_LOCATION ON_STACK
@@ -352,14 +360,16 @@ extern CORE_ADDR text_end;
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
((pc) >= text_end - CALL_DUMMY_LENGTH \
&& (pc) <= text_end + DECR_PC_AFTER_BREAK)
-#else /* Not before text_end. */
+#endif /* Before text_end. */
+
#if CALL_DUMMY_LOCATION == AFTER_TEXT_END
extern CORE_ADDR text_end;
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
((pc) >= text_end \
&& (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
-#else /* On stack. */
+#endif /* After text_end. */
+#if CALL_DUMMY_LOCATION == ON_STACK
/* Is the PC in a call dummy? SP and FRAME_ADDRESS are the bottom and
top of the stack frame which we are checking, where "bottom" and
"top" refer to some section of memory which contains the code for
@@ -381,7 +391,14 @@ extern CORE_ADDR text_end;
#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
((sp) INNER_THAN (pc) && (frame_address != 0) && (pc) INNER_THAN (frame_address))
#endif /* On stack. */
-#endif /* Not before text_end. */
+
+#if CALL_DUMMY_LOCATION == AT_ENTRY_POINT
+extern CORE_ADDR
+entry_point_address PARAMS ((void));
+#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
+ ((pc) >= entry_point_address () \
+ && (pc) <= (entry_point_address () + DECR_PC_AFTER_BREAK))
+#endif /* At entry point. */
#endif /* No PC_IN_CALL_DUMMY. */
#endif /* !defined (INFERIOR_H) */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index da58622..85ebb38 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "gdbcmd.h"
#include "target.h"
+#include "thread.h"
#include <signal.h>
@@ -583,8 +584,6 @@ switch_thread:
}
}
-same_pid:
-
#ifdef NO_SINGLE_STEP
if (one_stepped)
single_step (0); /* This actually cleans up the ss */
@@ -845,6 +844,9 @@ same_pid:
cleanup chain, so no need to worry about it here. */
goto stop_stepping;
+ case BPSTAT_WHAT_LAST:
+ /* Not a real code, but listed here to shut up gcc -Wall. */
+
case BPSTAT_WHAT_KEEP_CHECKING:
break;
}
@@ -1001,7 +1003,7 @@ same_pid:
/* If we end up in certain places, it means we did a subroutine
call. I'm not completely sure this is necessary now that we
have the above checks with stop_func_start (and now that
- find_pc_partial_function is pickier. */
+ find_pc_partial_function is pickier). */
|| IN_SOLIB_TRAMPOLINE (stop_pc, stop_func_name)
/* If none of the above apply, it is a jump within a function,
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index 3270fa6..2c110ab 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "wait.h"
#include "gdbcore.h"
-
+#include "command.h"
#include <signal.h>
static void
@@ -32,7 +32,7 @@ child_prepare_to_store PARAMS ((void));
#ifndef CHILD_WAIT
static int
-child_wait PARAMS ((int *));
+child_wait PARAMS ((int, int *));
#endif /* CHILD_WAIT */
static void
@@ -110,35 +110,38 @@ child_attach (args, from_tty)
char *args;
int from_tty;
{
- char *exec_file;
- int pid;
-
if (!args)
error_no_arg ("process-id to attach");
#ifndef ATTACH_DETACH
error ("Can't attach to a process on this machine.");
#else
- pid = atoi (args);
+ {
+ char *exec_file;
+ int pid;
+
+ pid = atoi (args);
- if (pid == getpid()) /* Trying to masturbate? */
- error ("I refuse to debug myself!");
+ if (pid == getpid()) /* Trying to masturbate? */
+ error ("I refuse to debug myself!");
- if (from_tty)
- {
- exec_file = (char *) get_exec_file (0);
+ if (from_tty)
+ {
+ exec_file = (char *) get_exec_file (0);
- if (exec_file)
- printf ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
- else
- printf ("Attaching to %s\n", target_pid_to_str (pid));
+ if (exec_file)
+ printf ("Attaching to program `%s', %s\n", exec_file,
+ target_pid_to_str (pid));
+ else
+ printf ("Attaching to %s\n", target_pid_to_str (pid));
- fflush (stdout);
- }
+ fflush (stdout);
+ }
- attach (pid);
- inferior_pid = pid;
- push_target (&child_ops);
+ attach (pid);
+ inferior_pid = pid;
+ push_target (&child_ops);
+ }
#endif /* ATTACH_DETACH */
}
@@ -156,26 +159,28 @@ child_detach (args, from_tty)
char *args;
int from_tty;
{
- int siggnal = 0;
-
#ifdef ATTACH_DETACH
- if (from_tty)
- {
- char *exec_file = get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf ("Detaching from program: %s %s\n", exec_file,
- target_pid_to_str (inferior_pid));
- fflush (stdout);
- }
- if (args)
- siggnal = atoi (args);
-
- detach (siggnal);
- inferior_pid = 0;
- unpush_target (&child_ops); /* Pop out of handling an inferior */
+ {
+ int siggnal = 0;
+
+ if (from_tty)
+ {
+ char *exec_file = get_exec_file (0);
+ if (exec_file == 0)
+ exec_file = "";
+ printf ("Detaching from program: %s %s\n", exec_file,
+ target_pid_to_str (inferior_pid));
+ fflush (stdout);
+ }
+ if (args)
+ siggnal = atoi (args);
+
+ detach (siggnal);
+ inferior_pid = 0;
+ unpush_target (&child_ops);
+ }
#else
- error ("This version of Unix does not support detaching a process.");
+ error ("This version of Unix does not support detaching a process.");
#endif
}
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index cc4001f..07448b1 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -44,6 +44,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "parser-defs.h"
#include "m2-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/maint.c b/gdb/maint.c
index b533451..7addd4e 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -30,6 +30,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbtypes.h"
#include "demangle.h"
#include "gdbcore.h"
+#include "expression.h" /* For language.h */
+#include "language.h"
static void
maintenance_command PARAMS ((char *, int));
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index fde3af2..8ad4444 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h"
#include "objfiles.h"
#include "gdb-stabs.h"
+#include "buildsym.h"
static void
nlm_new_init PARAMS ((struct objfile *));
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index b111f00..b890657 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -120,79 +120,88 @@ allocate_objfile (abfd, mapped)
int mapped;
{
struct objfile *objfile = NULL;
- int fd;
- PTR md;
- CORE_ADDR mapto;
mapped |= mapped_symbol_files;
#if !defined(NO_MMALLOC) && defined(HAVE_MMAP)
+ {
- /* If we can support mapped symbol files, try to open/reopen the mapped file
- that corresponds to the file from which we wish to read symbols. If the
- objfile is to be mapped, we must malloc the structure itself using the
- mmap version, and arrange that all memory allocation for the objfile uses
- the mmap routines. If we are reusing an existing mapped file, from which
- we get our objfile pointer, we have to make sure that we update the
- pointers to the alloc/free functions in the obstack, in case these
- functions have moved within the current gdb. */
-
- fd = open_mapped_file (bfd_get_filename (abfd), bfd_get_mtime (abfd),
- mapped);
- if (fd >= 0)
- {
- if (((mapto = map_to_address ()) == 0) ||
- ((md = mmalloc_attach (fd, (PTR) mapto)) == NULL))
- {
- close (fd);
- }
- else if ((objfile = (struct objfile *) mmalloc_getkey (md, 0)) != NULL)
- {
- /* Update memory corruption handler function addresses. */
- init_malloc (md);
- objfile -> md = md;
- objfile -> mmfd = fd;
- /* Update pointers to functions to *our* copies */
- obstack_chunkfun (&objfile -> psymbol_obstack, xmmalloc);
- obstack_freefun (&objfile -> psymbol_obstack, mfree);
- obstack_chunkfun (&objfile -> symbol_obstack, xmmalloc);
- obstack_freefun (&objfile -> symbol_obstack, mfree);
- obstack_chunkfun (&objfile -> type_obstack, xmmalloc);
- obstack_freefun (&objfile -> type_obstack, mfree);
- /* If already in objfile list, unlink it. */
- unlink_objfile (objfile);
- /* Forget things specific to a particular gdb, may have changed. */
- objfile -> sf = NULL;
- }
- else
- {
- /* Set up to detect internal memory corruption. MUST be done before
- the first malloc. See comments in init_malloc() and mmcheck(). */
- init_malloc (md);
- objfile = (struct objfile *) xmmalloc (md, sizeof (struct objfile));
- memset (objfile, 0, sizeof (struct objfile));
- objfile -> md = md;
- objfile -> mmfd = fd;
- objfile -> flags |= OBJF_MAPPED;
- mmalloc_setkey (objfile -> md, 0, objfile);
- obstack_specify_allocation_with_arg (&objfile -> psymbol_obstack,
- 0, 0, xmmalloc, mfree,
- objfile -> md);
- obstack_specify_allocation_with_arg (&objfile -> symbol_obstack,
- 0, 0, xmmalloc, mfree,
- objfile -> md);
- obstack_specify_allocation_with_arg (&objfile -> type_obstack,
- 0, 0, xmmalloc, mfree,
- objfile -> md);
- }
- }
+ /* If we can support mapped symbol files, try to open/reopen the
+ mapped file that corresponds to the file from which we wish to
+ read symbols. If the objfile is to be mapped, we must malloc
+ the structure itself using the mmap version, and arrange that
+ all memory allocation for the objfile uses the mmap routines.
+ If we are reusing an existing mapped file, from which we get
+ our objfile pointer, we have to make sure that we update the
+ pointers to the alloc/free functions in the obstack, in case
+ these functions have moved within the current gdb. */
+
+ int fd;
+
+ fd = open_mapped_file (bfd_get_filename (abfd), bfd_get_mtime (abfd),
+ mapped);
+ if (fd >= 0)
+ {
+ CORE_ADDR mapto;
+ PTR md;
- if (mapped && (objfile == NULL))
- {
- warning ("symbol table for '%s' will not be mapped",
- bfd_get_filename (abfd));
- }
+ if (((mapto = map_to_address ()) == 0) ||
+ ((md = mmalloc_attach (fd, (PTR) mapto)) == NULL))
+ {
+ close (fd);
+ }
+ else if ((objfile = (struct objfile *) mmalloc_getkey (md, 0)) != NULL)
+ {
+ /* Update memory corruption handler function addresses. */
+ init_malloc (md);
+ objfile -> md = md;
+ objfile -> mmfd = fd;
+ /* Update pointers to functions to *our* copies */
+ obstack_chunkfun (&objfile -> psymbol_obstack, xmmalloc);
+ obstack_freefun (&objfile -> psymbol_obstack, mfree);
+ obstack_chunkfun (&objfile -> symbol_obstack, xmmalloc);
+ obstack_freefun (&objfile -> symbol_obstack, mfree);
+ obstack_chunkfun (&objfile -> type_obstack, xmmalloc);
+ obstack_freefun (&objfile -> type_obstack, mfree);
+ /* If already in objfile list, unlink it. */
+ unlink_objfile (objfile);
+ /* Forget things specific to a particular gdb, may have changed. */
+ objfile -> sf = NULL;
+ }
+ else
+ {
+ /* Set up to detect internal memory corruption. MUST be
+ done before the first malloc. See comments in
+ init_malloc() and mmcheck(). */
+
+ init_malloc (md);
+
+ objfile = (struct objfile *)
+ xmmalloc (md, sizeof (struct objfile));
+ memset (objfile, 0, sizeof (struct objfile));
+ objfile -> md = md;
+ objfile -> mmfd = fd;
+ objfile -> flags |= OBJF_MAPPED;
+ mmalloc_setkey (objfile -> md, 0, objfile);
+ obstack_specify_allocation_with_arg (&objfile -> psymbol_obstack,
+ 0, 0, xmmalloc, mfree,
+ objfile -> md);
+ obstack_specify_allocation_with_arg (&objfile -> symbol_obstack,
+ 0, 0, xmmalloc, mfree,
+ objfile -> md);
+ obstack_specify_allocation_with_arg (&objfile -> type_obstack,
+ 0, 0, xmmalloc, mfree,
+ objfile -> md);
+ }
+ }
+
+ if (mapped && (objfile == NULL))
+ {
+ warning ("symbol table for '%s' will not be mapped",
+ bfd_get_filename (abfd));
+ }
+ }
#else /* defined(NO_MMALLOC) || !defined(HAVE_MMAP) */
if (mapped)
@@ -304,8 +313,6 @@ void
free_objfile (objfile)
struct objfile *objfile;
{
- int mmfd;
-
/* First do any symbol file specific actions required when we are
finished with a particular symbol file. Note that if the objfile
is using reusable symbol information (via mmalloc) then each of
@@ -362,6 +369,8 @@ free_objfile (objfile)
{
/* Remember the fd so we can close it. We can't close it before
doing the detach, and after the detach the objfile is gone. */
+ int mmfd;
+
mmfd = objfile -> mmfd;
mmalloc_detach (objfile -> md);
objfile = NULL;
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 5c8710e..2e2b9e8 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -85,32 +85,25 @@ union type_stack_elt {
union type_stack_elt *type_stack;
int type_stack_depth, type_stack_size;
-extern void
-write_exp_elt PARAMS ((union exp_element));
+extern void write_exp_elt PARAMS ((union exp_element));
-extern void
-write_exp_elt_opcode PARAMS ((enum exp_opcode));
+extern void write_exp_elt_opcode PARAMS ((enum exp_opcode));
-extern void
-write_exp_elt_sym PARAMS ((struct symbol *));
+extern void write_exp_elt_sym PARAMS ((struct symbol *));
-extern void
-write_exp_elt_longcst PARAMS ((LONGEST));
+extern void write_exp_elt_longcst PARAMS ((LONGEST));
-extern void
-write_exp_elt_dblcst PARAMS ((double));
+extern void write_exp_elt_dblcst PARAMS ((double));
-extern void
-write_exp_elt_type PARAMS ((struct type *));
+extern void write_exp_elt_type PARAMS ((struct type *));
-extern void
-write_exp_elt_intern PARAMS ((struct internalvar *));
+extern void write_exp_elt_intern PARAMS ((struct internalvar *));
-extern void
-write_exp_string PARAMS ((struct stoken));
+extern void write_exp_string PARAMS ((struct stoken));
-extern void
-write_exp_bitstring PARAMS ((struct stoken));
+extern void write_exp_bitstring PARAMS ((struct stoken));
+
+extern void write_exp_elt_block PARAMS ((struct block *));
extern void
start_arglist PARAMS ((void));
diff --git a/gdb/regex.h b/gdb/regex.h
index 6348c3e..a4ed6d3 100644
--- a/gdb/regex.h
+++ b/gdb/regex.h
@@ -177,3 +177,5 @@ extern int re_exec ();
#ifdef SYNTAX_TABLE
extern char *re_syntax_table;
#endif
+
+extern int re_set_syntax ();
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 3b890d8..984d725 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -179,13 +179,24 @@ extern void
process_one_symbol PARAMS ((int, int, CORE_ADDR, char *,
struct section_offsets *, struct objfile *));
-extern void
-elfstab_build_psymtabs PARAMS ((struct objfile *objfile,
- struct section_offsets *section_offsets,
- int mainline,
- file_ptr staboff, unsigned int stabsize,
- file_ptr stabstroffset,
- unsigned int stabstrsize));
+extern void elfstab_build_psymtabs
+ PARAMS ((struct objfile *objfile,
+ struct section_offsets *section_offsets,
+ int mainline,
+ file_ptr staboff, unsigned int stabsize,
+ file_ptr stabstroffset,
+ unsigned int stabstrsize));
+
+extern void coffstab_build_psymtabs
+ PARAMS ((struct objfile *objfile,
+ struct section_offsets *section_offsets,
+ int mainline,
+ file_ptr staboff, unsigned int stabsize,
+ file_ptr stabstroffset,
+ unsigned int stabstrsize));
+
+extern void elfstab_offset_sections PARAMS ((struct objfile *,
+ struct partial_symtab *));
extern void
pastab_build_psymtabs PARAMS ((struct objfile *, struct section_offsets *,