* breakpoint.h (ALL_BREAKPOINTS_SAFE): Add.

* breakpoint.c (breakpoint_re_set):  Use ALL_BREAKPOINTS_SAFE.
* symtab.c (find_pc_symtab):  Handle having no objfiles.
* infcmd.c:  Fix comment.
* objfiles.c (free_all_objfiles):  Add.
* symfile.h (ALL_OBJFILES, ALL_OBJFILES_SAFE):  Add.
* symfile.c (symbol_file_command):  free all objfiles when
specifying a new symbol file.
(reread_symbols):  Stat the file name, don't fstat the descriptor.
This commit is contained in:
John Gilmore
1992-02-27 16:28:59 +00:00
parent 5c83e859b9
commit cba0d141fb
5 changed files with 684 additions and 1015 deletions

View File

@ -1,3 +1,21 @@
Thu Feb 27 06:11:05 1992 John Gilmore (gnu at cygnus.com)
* breakpoint.h (ALL_BREAKPOINTS_SAFE): Add.
* breakpoint.c (breakpoint_re_set): Use ALL_BREAKPOINTS_SAFE.
* symtab.c (find_pc_symtab): Handle having no objfiles.
* infcmd.c: Fix comment.
* objfiles.c (free_all_objfiles): Add.
* symfile.h (ALL_OBJFILES, ALL_OBJFILES_SAFE): Add.
* symfile.c (symbol_file_command): free all objfiles when
specifying a new symbol file.
(reread_symbols): Stat the file name, don't fstat the descriptor.
Tue Feb 25 19:31:19 1992 Stu Grossman (grossman at cygnus.com)
* dbxread.c (end_psymtab): Delete empty psymtabs.
* symfile.c (allocate_psymtab): Recycle empty psymtabs.
* symfile.h (struct objfile): Add free_psymtabs.
Sat Feb 22 02:00:32 1992 John Gilmore (gnu at cygnus.com) Sat Feb 22 02:00:32 1992 John Gilmore (gnu at cygnus.com)
* Makefile.in (VERSION): Roll to gdb-4.4.4. * Makefile.in (VERSION): Roll to gdb-4.4.4.

View File

@ -113,7 +113,7 @@ static void
breakpoints_info PARAMS ((char *, int)); breakpoints_info PARAMS ((char *, int));
static void static void
breakpoint_1 PARAMS ((int, int)); breakpoint_1 PARAMS ((int, enum bptype));
static bpstat static bpstat
bpstat_alloc PARAMS ((struct breakpoint *, bpstat)); bpstat_alloc PARAMS ((struct breakpoint *, bpstat));
@ -143,8 +143,17 @@ extern int demangle; /* Print de-mangled symbol names? */
/* Are we executing breakpoint commands? */ /* Are we executing breakpoint commands? */
static int executing_breakpoint_commands; static int executing_breakpoint_commands;
/* Walk the following statement or block through all breakpoints.
ALL_BREAKPOINTS_SAFE does so even if the statment deletes the current
breakpoint. */
#define ALL_BREAKPOINTS(b) for (b = breakpoint_chain; b; b = b->next) #define ALL_BREAKPOINTS(b) for (b = breakpoint_chain; b; b = b->next)
#define ALL_BREAKPOINTS_SAFE(b,tmp) \
for (b = breakpoint_chain; \
b? (tmp=b->next, 1): 0; \
b = tmp)
/* Chain of all breakpoints defined. */ /* Chain of all breakpoints defined. */
struct breakpoint *breakpoint_chain; struct breakpoint *breakpoint_chain;
@ -810,7 +819,7 @@ bpstat_stop_status (pc, frame_address)
int real_breakpoint = 0; int real_breakpoint = 0;
#endif #endif
/* Root of the chain of bpstat's */ /* Root of the chain of bpstat's */
struct bpstat__struct root_bs[1]; struct bpstat root_bs[1];
/* Pointer to the last thing in the chain currently. */ /* Pointer to the last thing in the chain currently. */
bpstat bs = root_bs; bpstat bs = root_bs;
@ -2229,11 +2238,11 @@ breakpoint_re_set_one (bint)
void void
breakpoint_re_set () breakpoint_re_set ()
{ {
struct breakpoint *b; struct breakpoint *b, *temp;
static char message1[] = "Error in re-setting breakpoint %d:\n"; static char message1[] = "Error in re-setting breakpoint %d:\n";
char message[sizeof (message1) + 30 /* slop */]; char message[sizeof (message1) + 30 /* slop */];
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS_SAFE (b, temp)
{ {
b->symtab = 0; /* Be sure we don't point to old dead symtab */ b->symtab = 0; /* Be sure we don't point to old dead symtab */
sprintf (message, message1, b->number); /* Format possible error msg */ sprintf (message, message1, b->number); /* Format possible error msg */

View File

@ -163,6 +163,20 @@ free_objfile (objfile)
(*objfile -> free) (objfile); (*objfile -> free) (objfile);
} }
/* Free all the object files at once. */
void
free_all_objfiles ()
{
struct objfile *objfile, *temp;
ALL_OBJFILES_SAFE (objfile, temp)
{
free_objfile (objfile);
}
}
/* Many places in gdb want to test just to see if we have any partial /* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are currently symbols available. This function returns zero if none are currently
available, nonzero otherwise. */ available, nonzero otherwise. */

View File

@ -553,16 +553,13 @@ symbol_file_command (args, from_tty)
dont_repeat (); dont_repeat ();
if (args == NULL) if (args == NULL)
{
if (symfile_objfile)
{ {
if ((have_full_symbols () || have_partial_symbols ()) if ((have_full_symbols () || have_partial_symbols ())
&& from_tty && from_tty
&& !query ("Discard symbol table from `%s'? ", && !query ("Discard symbol table from `%s'? ",
symfile_objfile -> name)) symfile_objfile -> name))
error ("Not confirmed."); error ("Not confirmed.");
free_objfile (symfile_objfile); free_all_objfiles ();
}
symfile_objfile = NULL; symfile_objfile = NULL;
/* FIXME, this does not account for the main file and subsequent /* FIXME, this does not account for the main file and subsequent
files (shared libs, dynloads, etc) having different formats. files (shared libs, dynloads, etc) having different formats.
@ -769,6 +766,8 @@ reread_symbols ()
struct objfile *objfile; struct objfile *objfile;
long new_modtime; long new_modtime;
int reread_one = 0; int reread_one = 0;
struct stat new_statbuf;
int res;
/* With the addition of shared libraries, this should be modified, /* With the addition of shared libraries, this should be modified,
the load time should be saved in the partial symbol tables, since the load time should be saved in the partial symbol tables, since
@ -779,7 +778,14 @@ reread_symbols ()
the_big_top: the_big_top:
for (objfile = object_files; objfile; objfile = objfile->next) { for (objfile = object_files; objfile; objfile = objfile->next) {
if (objfile->obfd) { if (objfile->obfd) {
new_modtime = bfd_get_mtime (objfile->obfd); res = stat (objfile->name, &new_statbuf);
if (res != 0) {
/* FIXME, should use print_sys_errmsg but it's not filtered. */
printf_filtered ("`%s' has disappeared; keeping its symbols.\n",
objfile->name);
continue;
}
new_modtime = new_statbuf.st_mtime;
if (new_modtime != objfile->mtime) { if (new_modtime != objfile->mtime) {
printf_filtered ("`%s' has changed; re-reading symbols.\n", printf_filtered ("`%s' has changed; re-reading symbols.\n",
objfile->name); objfile->name);
@ -799,7 +805,6 @@ the_big_top:
if (reread_one) if (reread_one)
breakpoint_re_set (); breakpoint_re_set ();
} }
/* Functions to handle complaints during symbol reading. */ /* Functions to handle complaints during symbol reading. */
@ -957,9 +962,16 @@ allocate_psymtab (filename, objfile)
{ {
struct partial_symtab *psymtab; struct partial_symtab *psymtab;
if (objfile -> free_psymtabs)
{
psymtab = objfile -> free_psymtabs;
objfile -> free_psymtabs = psymtab -> next;
}
else
psymtab = (struct partial_symtab *) psymtab = (struct partial_symtab *)
obstack_alloc (&objfile -> psymbol_obstack, obstack_alloc (&objfile -> psymbol_obstack,
sizeof (struct partial_symtab)); sizeof (struct partial_symtab));
(void) memset (psymtab, 0, sizeof (struct partial_symtab)); (void) memset (psymtab, 0, sizeof (struct partial_symtab));
psymtab -> filename = obsavestring (filename, strlen (filename), psymtab -> filename = obsavestring (filename, strlen (filename),
&objfile -> psymbol_obstack); &objfile -> psymbol_obstack);

File diff suppressed because it is too large Load Diff