buildsym.c
buildsym.h
c-exp.y
+call-cmds.h
coffread.c
command.c
command.h
+Sat Mar 28 22:22:06 1992 John Gilmore (gnu at cygnus.com)
+
+ Create and use macros for iterating on symtabs, psymtabs, msymbols.
+
+ * minsyms.c (iterate_over_msymbols): Remove; clunky and slow.
+ * symfile.h, symtab.h (iterate_over_msymbols): Remove prototype
+ * coffread.c (coff_symfile_read): iterate_over_symtabs => ALL_SYMTABS.
+ (patch_opaque_types): Avoid dummy args and result.
+ * objfiles.c (have_partial_symbols, have_full_symbols,
+ have_minimal_symbols): explicit iteration => ALL_OBJFILES; simplify.
+ (iterate_over_objfiles, iterate_over_symtabs,
+ iterate_over_psymtabs): Remove, clunky and slow.
+ * objfiles.h: Replace iterate_over_* prototypes with ALL_SYMTABS,
+ ALL_PSYMTABS, and ALL_MSYMBOLS macros.
+ * symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
+ dump_objfile): Remove dummy args and results. Move filename
+ comparisons to callers.
+ (printsyms_command, printpsyms_command, printmsyms_command,
+ printobjfiles_command): iterate_over_* => ALL_*. Compare filenames.
+ * symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
+ lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
+ list_symbols, make_symbol_completion_list): Replace explicit
+ iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
+ Eliminate Dijkstra flag crap, break out of loops with gotos.
+ (lookup_symtab_1): Protect '/' tests from short filenames.
+ (cplus_mangled_symbol): Move inline into lookup_symbol.
+ * xcoffexec.c (relocate_objfile_msymbols): Remove poor hack.
+ (relocate_minimal_symbol): Move inline to vmap_symtab.
+ (vmap_symtab): Replace iteration with ALL_OBJFILES,
+ iterate_over_msymbols with ALL_MSYMBOLS.
+
+ Misc cleanup prior to release.
+
+ * Makefile.in (VERSION): Roll to 4.4.7.
+ (HFILES): Add call-cmds.h.
+ * call-cmds.h: New header for command fns called by other files.
+ * breakpoint.c (watchpoints_info): Remove, same as breakpoints_info.
+ (breakpoint_1): Remove unused type arg. Change callers.
+
+ * dwarfread.c (dwarf_build_psymtabs): Remove mainline test.
+ * mipsread.c (compare_symtabs, compare_psymtabs): Remove, unused.
+ * mipsread.c: Add prototypes for all static functions.
+
+ * symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
+ dump_blockvector, dump_block, dump_addrchass, dump_namespace,
+ dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove, unused.
+ * xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
+ dump_blockvector, dump_block, dump_addrchass, dump_namespace,
+ dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove 2nd
+ unused copy!
+
+ * buildsym.c (define_symbol): Handle global register variables
+ (from Pierre Willard). Complain if register numbers are too large.
+ * target.c (nomemory): Now that higher levels examine errno, give EIO.
+ * tm-sparc.h: Don't #include <sun4/reg.h>.
+ * sparc-tdep.c (sparc_frame_chain, frame_saved_pc): Remove
+ dependency on <sun4/reg.h>. Start to handle cross-byte-order.
+
+ * language.h: Avoid forward enum declaration.
+ * configure.in, tm-sun4os5.h, xm-sun4os5.h, config/sun4os5.mh,
+ config/sun4os5.mt: New host and target.
+ * defs.h (errno): #include <errno.h> rather than assuming int.
+ From Pierre Willard.
+
+ * breakpoint.c, breakpoint.h, buildsym.c, coffread.c, cplus-dem.c,
+ dbxread.c, dwarfread.c, elfread.c, infcmd.c, infrun.c, inftarg.c,
+ language.c, main.c, mem-break.c, mips-tdep.c, mipsread.c,
+ partial-stab.h, remote.c, saber.suppress, symfile.c, symtab.c,
+ valops.c, valprint.c, xcoffread.c, c-exp.y, m2-exp.y, blockframe.c,
+ command.c, core.c, exec.c, gdbtypes.h, parse.c, printcmd.c, solib.c,
+ sparc-xdep.c, utils.c, value.h, values.c: Lint.
+
+Sat Mar 28 02:43:26 1992 John Gilmore (gnu at cygnus.com)
+
+ * buildsym.c (read_range_type): Avoid int overflow by using unsigned.
+ * dbxread.c (dbx_symfile_init): Remove bogus `lvalue cast'.
+ * language.h (enum exp_opcode): Avoid forward enum def.
+ * main.c (define_command, user_defined_command): Lint.
+ * mem-break.c, xcoffread.c: Lint.
+ * solib.c: Only #include <a.out.h> on SunOS, not SVR4.
+
Sun Mar 29 14:16:22 1992 Per Bothner (bothner@cygnus.com)
* Merged in latest RS6000 diffs from Metin G. Ozisik.
#define yyval c_val
#define yylloc c_lloc
-static void
-__yy_bcopy PARAMS ((char *, char *, int));
-
-int
yyparse PARAMS ((void));
int
func_mod: '(' ')'
{ $$ = 0; }
| '(' nonempty_typelist ')'
- { free ($2); $$ = 0; }
+ { free ((PTR)$2); $$ = 0; }
;
type : ptype
| type '(' typebase COLONCOLON '*' ')' '(' nonempty_typelist ')'
{ $$ = lookup_member_type
(lookup_function_type ($1), $3);
- free ($8); }
+ free ((PTR)$8); }
;
typebase
while (*list && !strcmp ((*list)->name, name))
{
p = (*list)->next;
- free (*list);
+ free ((PTR)*list);
*list = p;
}
if (!strcmp (c->next->name, name))
{
p = c->next->next;
- free (c->next);
+ free ((PTR)c->next);
c->next = p;
}
else
if (p - str > line_size - 1)
{
line_size = p - str + 1;
- free (line_buffer);
+ free ((PTR)line_buffer);
line_buffer = (char *) xmalloc (line_size);
}
strncpy (line_buffer, str, p - str);
if (matches == 0)
{
- free (matchlist);
+ free ((PTR)matchlist);
matchlist = 0;
}
else
CLEAR_SOLIB ();
#endif
if (core_ops.to_sections) {
- free (core_ops.to_sections);
+ free ((PTR)core_ops.to_sections);
core_ops.to_sections = NULL;
core_ops.to_sections_end = NULL;
}
p += 1;
{
int r, i;
- int non_empty = 0;
string tname;
string trawname;
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
+#include "buildsym.h"
#define STREQ(a,b) (strcmp((a),(b))==0)
elf_symfile_finish PARAMS ((struct objfile *));
static void
-elf_symtab_read PARAMS ((bfd *, CORE_ADDR, int, struct objfile *));
+elf_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *));
static void
record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
FIXME: The section names should not be hardwired strings. */
static void
-elf_locate_sections (abfd, sectp, eip)
- bfd *abfd;
+elf_locate_sections (ignore_abfd, sectp, eip)
+ bfd *ignore_abfd;
asection *sectp;
PTR eip;
{
SYNOPSIS
- void elf_symtab_read (bfd *abfd, CORE_ADDR addr, int mainline,
+ void elf_symtab_read (bfd *abfd, CORE_ADDR addr,
struct objfile *objfile)
DESCRIPTION
*/
static void
-elf_symtab_read (abfd, addr, mainline, objfile)
+elf_symtab_read (abfd, addr, objfile)
bfd *abfd;
CORE_ADDR addr;
- int mainline;
struct objfile *objfile;
{
unsigned int storage_needed;
/* Process the normal ELF symbol table first. */
- elf_symtab_read (abfd, addr, mainline, objfile);
+ elf_symtab_read (abfd, addr, objfile);
/* Now process the DWARF debugging information, which is contained in
special ELF sections. We first have to find them... */
just a stub. */
static void
-elf_new_init (objfile)
- struct objfile *objfile;
+elf_new_init (ignore)
+ struct objfile *ignore;
{
buildsym_new_init ();
}
just a stub. */
static void
-elf_symfile_init (objfile)
- struct objfile *objfile;
+elf_symfile_init (ignore)
+ struct objfile *ignore;
{
}
/* Work with executable files, for GDB.
- Copyright 1988, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include <ctype.h>
#include <sys/stat.h>
-extern char *getenv();
-extern void child_create_inferior (), child_attach ();
-extern void symbol_file_command ();
+/* Prototypes for local functions */
+
+static void
+add_to_section_table PARAMS ((bfd *, sec_ptr, PTR));
+
+static void
+exec_close PARAMS ((int));
+
+static void
+file_command PARAMS ((char *, int));
+
+static void
+set_section_command PARAMS ((char *, int));
+
+static void
+exec_files_info PARAMS ((struct target_ops *));
+
+extern int info_verbose;
/* The Binary File Descriptor handle for the executable file. */
extern struct target_ops exec_ops;
/* ARGSUSED */
-void
+static void
exec_close (quitting)
int quitting;
{
bfd_close (exec_bfd);
exec_bfd = NULL;
}
- if (exec_ops.sections) {
- free (exec_ops.sections);
- exec_ops.sections = NULL;
- exec_ops.sections_end = NULL;
+ if (exec_ops.to_sections) {
+ free ((PTR)exec_ops.to_sections);
+ exec_ops.to_sections = NULL;
+ exec_ops.to_sections_end = NULL;
}
}
+/* Process the first arg in ARGS as the new exec file.
+
+ Note that we have to explicitly ignore additional args, since we can
+ be called from file_command(), which also calls symbol_file_command()
+ which can take multiple args. */
+
void
-exec_file_command (filename, from_tty)
- char *filename;
+exec_file_command (args, from_tty)
+ char *args;
int from_tty;
{
+ char **argv;
+ char *filename;
+
target_preopen (from_tty);
/* Remove any previous exec file. */
/* Now open and digest the file the user requested, if any. */
- if (filename)
+ if (args)
{
char *scratch_pathname;
int scratch_chan;
- filename = tilde_expand (filename);
+ /* Scan through the args and pick up the first non option arg
+ as the filename. */
+
+ if ((argv = buildargv (args)) == NULL)
+ {
+ nomem (0);
+ }
+ make_cleanup (freeargv, (char *) argv);
+
+ for (; (*argv != NULL) && (**argv == '-'); argv++) {;}
+ if (*argv == NULL)
+ {
+ error ("no exec file name was specified");
+ }
+
+ filename = tilde_expand (*argv);
make_cleanup (free, filename);
scratch_chan = openp (getenv ("PATH"), 1, filename,
error ("\"%s\": not in executable format: %s.",
scratch_pathname, bfd_errmsg (bfd_error));
- if (build_section_table (exec_bfd, &exec_ops.sections,
- &exec_ops.sections_end))
+ if (build_section_table (exec_bfd, &exec_ops.to_sections,
+ &exec_ops.to_sections_end))
error ("Can't find the file sections in `%s': %s",
exec_bfd->filename, bfd_errmsg (bfd_error));
(29K springs to mind) need this info for now. */
{
struct section_table *p;
- for (p = exec_ops.sections; p < exec_ops.sections_end; p++)
+ for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
if (!strcmp (".text", bfd_section_name (p->bfd, p->sec_ptr)))
{
text_start = p->addr;
What a novelty. Why did GDB go through four major releases before this
command was added? */
-void
+static void
file_command (arg, from_tty)
char *arg;
int from_tty;
table_pp_char is a char * to get it through bfd_map_over_sections;
we cast it back to its proper type. */
-void
+static void
add_to_section_table (abfd, asect, table_pp_char)
bfd *abfd;
sec_ptr asect;
- char *table_pp_char;
+ PTR table_pp_char;
{
struct section_table **table_pp = (struct section_table **)table_pp_char;
flagword aflag;
(*table_pp)++;
}
+/* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
+ Returns 0 if OK, 1 on error. */
+
int
build_section_table (some_bfd, start, end)
bfd *some_bfd;
if (count == 0)
abort(); /* return 1? */
if (*start)
- free (*start);
+ free ((PTR)*start);
*start = (struct section_table *) xmalloc (count * sizeof (**start));
*end = *start;
bfd_map_over_sections (some_bfd, add_to_section_table, (char *)end);
boolean res;
struct section_table *p;
CORE_ADDR nextsectaddr, memend;
- boolean (*xfer_fn) ();
+ boolean (*xfer_fn) PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
if (len <= 0)
abort();
xfer_fn = write? bfd_set_section_contents: bfd_get_section_contents;
nextsectaddr = memend;
- for (p = target->sections; p < target->sections_end; p++)
+ for (p = target->to_sections; p < target->to_sections_end; p++)
{
if (p->addr <= memaddr)
if (p->endaddr >= memend)
#endif /* REG_STACK_SEGMENT */
#endif FIXME
\f
-static void
-exec_files_info ()
+void
+print_section_info (t, abfd)
+ struct target_ops *t;
+ bfd *abfd;
{
struct section_table *p;
- printf_filtered ("\t`%s', ", bfd_get_filename(exec_bfd));
+ printf_filtered ("\t`%s', ", bfd_get_filename(abfd));
wrap_here (" ");
- printf_filtered ("file type %s.\n", bfd_get_target(exec_bfd));
+ printf_filtered ("file type %s.\n", bfd_get_target(abfd));
- for (p = exec_ops.sections; p < exec_ops.sections_end; p++) {
+ for (p = t->to_sections; p < t->to_sections_end; p++) {
printf_filtered ("\t%s", local_hex_string_custom (p->addr, "08"));
- printf_filtered (" - %s is %s\n",
- local_hex_string_custom (p->endaddr, "08"),
- bfd_section_name (exec_bfd, p->sec_ptr));
+ printf_filtered (" - %s", local_hex_string_custom (p->endaddr, "08"));
+ if (info_verbose)
+ printf_filtered (" @ %s",
+ local_hex_string_custom (p->sec_ptr->filepos, "08"));
+ printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr));
+ if (p->bfd != abfd) {
+ printf_filtered (" in %s", bfd_get_filename (p->bfd));
+ }
+ printf_filtered ("\n");
}
}
+static void
+exec_files_info (t)
+ struct target_ops *t;
+{
+ print_section_info (t, exec_bfd);
+}
+
static void
set_section_command (args, from_tty)
char *args;
/* Parse out new virtual address */
secaddr = parse_and_eval_address (args);
- for (p = exec_ops.sections; p < exec_ops.sections_end; p++) {
+ for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++) {
if (!strncmp (secname, bfd_section_name (exec_bfd, p->sec_ptr), seclen)
&& bfd_section_name (exec_bfd, p->sec_ptr)[seclen] == '\0') {
offset = secaddr - p->addr;
p->addr += offset;
p->endaddr += offset;
- exec_files_info();
+ if (from_tty)
+ exec_files_info(&exec_ops);
return;
}
}
0, 0, /* insert_breakpoint, remove_breakpoint, */
0, 0, 0, 0, 0, /* terminal stuff */
0, 0, /* kill, load */
- 0, 0, /* call fn, lookup sym */
+ 0, /* lookup sym */
child_create_inferior,
0, /* mourn_inferior */
file_stratum, 0, /* next */
extern struct type *
lookup_fundamental_type PARAMS ((struct objfile *, int));
+extern void
+fill_in_vptr_fieldno PARAMS ((struct type *));
+
/* printcmd.c */
extern void
}
static void
-show_check (arg, from_tty)
- char *arg;
+show_check (ignore, from_tty)
+ char *ignore;
int from_tty;
{
cmd_show_list(showchecklist, from_tty, "");
#define yyval m2_val
#define yylloc m2_lloc
+#if 0
static char *
make_qualname PARAMS ((char *, char *));
+#endif
static int
parse_number PARAMS ((int));
static void
yyerror PARAMS ((char *));
-static void
-__yy_bcopy PARAMS ((char *, char *, int));
-
int
yyparse PARAMS ((void));
}
}
+#if 0 /* Unused */
static char *
make_qualname(mod,ident)
char *mod, *ident;
strcat(new,ident);
return new;
}
-
+#endif /* 0 */
static void
yyerror(msg)
/* IF this is the topmost frame AND
* (this proc does not have debugging information OR
* the PC is in the procedure prologue)
- * THEN create a "hueristic" proc_desc (by analyzing
+ * THEN create a "heuristic" proc_desc (by analyzing
* the actual code) to replace the "official" proc_desc.
*/
proc_desc = (struct mips_extra_func_info *)sym->value.value;
{
mips_extra_func_info_t proc_desc;
CORE_ADDR saved_pc = FRAME_SAVED_PC(frame);
- if (current_objfile->ei.entry_file_lowpc)
+
+ if (symfile_objfile->ei.entry_file_lowpc)
{ /* has at least the __start symbol */
if (saved_pc == 0 || inside_entry_file (saved_pc)) return 0;
}
itself if the code at PC does not look like a function prologue,
PC+4 if it does (our caller does not need anything more fancy). */
-CORE_ADDR mips_skip_prologue(pc)
+CORE_ADDR
+mips_skip_prologue(pc)
CORE_ADDR pc;
{
struct symbol *f;
register struct funcall *call = funcall_chain;
funcall_chain = call->next;
arglist_len = call->arglist_len;
- free (call);
+ free ((PTR)call);
return val;
}
for (call = funcall_chain; call; call = next)
{
next = call->next;
- free (call);
+ free ((PTR)call);
}
}
\f
psymtab_include_list = (char **)
alloca ((includes_allocated *= 2) *
sizeof (char *));
- bcopy (orig, psymtab_include_list,
- includes_used * sizeof (char *));
+ memcpy ((PTR)psymtab_include_list, (PTR)orig,
+ includes_used * sizeof (char *));
}
#endif /* DBXREAD_ONLY */
psymtab_include_list = (char **)
alloca ((includes_allocated *= 2) *
sizeof (char *));
- bcopy (orig, psymtab_include_list,
- includes_used * sizeof (char *));
+ memcpy ((PTR)psymtab_include_list, (PTR)orig,
+ includes_used * sizeof (char *));
}
continue;
(struct partial_symtab **)
alloca ((dependencies_allocated *= 2)
* sizeof (struct partial_symtab *));
- bcopy (orig, dependency_list,
+ memcpy ((PTR)dependency_list, (PTR)orig,
(dependencies_used
* sizeof (struct partial_symtab *)));
#ifdef DEBUG_INFO
/* Passing illegal enumeration value */
suppress 70 on error
/* Passing illegal enumeration value */
+suppress 80 on first_link_map_member
+/* Returning invalid pointer */
suppress 110 in printf_filtered
/* Signed/unsigned memory retrieval */
suppress 110 in fprintf_filtered
/* Statement not reached */
suppress 529 in value_from_register
/* Statement not reached */
+suppress 529 in solib_create_inferior_hook
+/* Constant in conditional */
suppress 530
/* Empty body of statement */
suppress 546 in net_quit
/* Function exits through bottom */
suppress 546 in unpack_long
/* Function exits through bottom */
+suppress 558 in solib_create_inferior_hook
+/* Constant in conditional */
suppress 558 in read_range_type
/* Constant in conditional */
suppress 558 in process_one_symbol
/* Constant in conditional */
suppress 558 in value_from_register
/* Constant in conditional */
+suppress 558 in add_enum_psymbol
+/* Constant in conditional */
+suppress 558 in add_partial_symbol
+/* Constant in conditional */
+suppress 558 mfree.c
+/* Constant in conditional */
+suppress 558 mmalloc.c
+/* Constant in conditional */
+suppress 558 mrealloc.c
+/* Constant in conditional */
suppress 560 in solib_address
/* Assignment within conditional */
suppress 560 in solib_info
/* Formal param not used */
suppress 590 on signo
/* Formal param not used */
-suppress 652 in ../bfd/libaout.h
+suppress 652
/* The declaration has no effect */
suppress 442 in ../bfd/archive.c
/* Escape sequence in string literal has null value */
#include <link.h>
#include <sys/param.h>
#include <fcntl.h>
-#include <a.out.h>
+
+#ifndef SVR4_SHARED_LIBS
+ /* SunOS shared libs need the nlist structure. */
+#include <a.out.h>
+#endif
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
+#include "objfiles.h"
#include "gdbcore.h"
#include "command.h"
#include "target.h"
static CORE_ADDR
locate_base PARAMS ((void));
+static void
+solib_map_sections PARAMS ((struct so_list *));
+
+#ifdef SVR4_SHARED_LIBS
+
static int
look_for_base PARAMS ((int, CORE_ADDR));
static CORE_ADDR
bfd_lookup_symbol PARAMS ((bfd *, char *));
-static void
-solib_map_sections PARAMS ((struct so_list *));
-
-#ifndef SVR4_SHARED_LIBS
+#else
static void
solib_add_common_symbols PARAMS ((struct rtc_symb *, struct objfile *));
#endif /* SVR4_SHARED_LIBS */
+#ifdef SVR4_SHARED_LIBS
+
/*
LOCAL FUNCTION
if (storage_needed > 0)
{
- symbol_table = (asymbol **) bfd_xmalloc (storage_needed);
- back_to = make_cleanup (free, symbol_table);
+ symbol_table = (asymbol **) xmalloc (storage_needed);
+ back_to = make_cleanup (free, (PTR)symbol_table);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
return (1);
}
+#endif
+
/*
LOCAL FUNCTION
{
if (so_list_head -> sections)
{
- free (so_list_head -> sections);
+ free ((PTR)so_list_head -> sections);
}
if (so_list_head -> so_bfd)
{
bfd_close (so_list_head -> so_bfd);
}
next = so_list_head -> next;
- free(so_list_head);
+ free((PTR)so_list_head);
so_list_head = next;
}
debug_base = 0;
void
solib_create_inferior_hook()
{
- CORE_ADDR debug_addr;
- int in_debugger;
- CORE_ADDR in_debugger_addr;
- CORE_ADDR breakpoint_addr;
- int i, j;
if ((debug_base = locate_base ()) == 0)
{
}
\f
void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
char *core_reg_sect;
unsigned core_reg_size;
int which;
- unsigned int reg_addr; /* Unused in this version */
+ unsigned int ignore; /* reg addr, unused in this version */
{
if (which == 0) {
while ((ptr = cleanup_chain) != old_chain)
{
cleanup_chain = ptr->next;
- free (ptr);
+ free ((PTR)ptr);
}
}
{
for (i = 0; i < VALUE_HISTORY_CHUNK; i++)
if (val = value_history_chain->values[i])
- free (val);
+ free ((PTR)val);
next = value_history_chain->next;
- free (value_history_chain);
+ free ((PTR)value_history_chain);
value_history_chain = next;
}
value_history_count = 0;
SET_TRAPPED_INTERNALVAR (var, val, 0, 0, 0);
#endif
- free (var->value);
+ free ((PTR)var->value);
var->value = value_copy (val);
release_value (var->value);
}
{
var = internalvars;
internalvars = var->next;
- free (var->name);
- free (var->value);
- free (var);
+ free ((PTR)var->name);
+ free ((PTR)var->value);
+ free ((PTR)var);
}
}