aboutsummaryrefslogtreecommitdiff
path: root/gdb/coffread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-01-21 18:05:13 +0000
committerTom Tromey <tromey@redhat.com>2013-01-21 18:05:13 +0000
commit46212e0bb5c0c74454045ef9410f80f1c9b44ddd (patch)
tree90b988eca506f669c864e94101c58c296bfb6e16 /gdb/coffread.c
parent9d2ceabe7fb356a5905dec679f87a40f4e5a896a (diff)
downloadgdb-46212e0bb5c0c74454045ef9410f80f1c9b44ddd.zip
gdb-46212e0bb5c0c74454045ef9410f80f1c9b44ddd.tar.gz
gdb-46212e0bb5c0c74454045ef9410f80f1c9b44ddd.tar.bz2
* buildsym.c (patch_subfile_names): Use set_last_source_file.
(start_symtab): Make 'name' and 'dirname' const. Use set_last_source_file. (restart_symtab, reset_symtab_globals): Use set_last_source_file. (last_source_file): Define. Now static. (set_last_source_file, get_last_source_file): New functions. * buildsym.h (last_source_file): Don't declare. (start_symtab): Update. (set_last_source_file, get_last_source_file): Declare. * coffread.c (complete_symtab): Use set_last_source_file. (coff_end_symtab): Likewise. (coff_symtab_read): Use set_last_source_file, get_last_source_file. * dbxread.c (read_dbx_symtab, read_ofile_symtab): Use set_last_source_file. (process_one_symbol): Use get_last_source_file. * mdebugread.c (parse_partial_symbols): Use set_last_source_file. (psymtab_to_symtab_1): Use get_last_source_file. * xcoffread.c (process_linenos): Use get_last_source_file. (complete_symtab): Use set_last_source_file. (read_xcoff_symtab): Use set_last_source_file, get_last_source_file. (scan_xcoff_symtab): Use set_last_source_file.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r--gdb/coffread.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 9e62207..62565a8 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -396,9 +396,7 @@ coff_start_symtab (const char *name)
static void
complete_symtab (const char *name, CORE_ADDR start_addr, unsigned int size)
{
- if (last_source_file != NULL)
- xfree (last_source_file);
- last_source_file = xstrdup (name);
+ set_last_source_file (name);
current_source_start_addr = start_addr;
current_source_end_addr = start_addr + size;
}
@@ -417,7 +415,7 @@ coff_end_symtab (struct objfile *objfile)
SECT_OFF_TEXT (objfile));
/* Reinitialize for beginning of new file. */
- last_source_file = NULL;
+ set_last_source_file (NULL);
}
static struct minimal_symbol *
@@ -745,7 +743,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
coffread_objfile = objfile;
nlist_bfd_global = objfile->obfd;
nlist_nsyms_global = nsyms;
- last_source_file = NULL;
+ set_last_source_file (NULL);
memset (opaque_type_chain, 0, sizeof opaque_type_chain);
if (type_vector) /* Get rid of previous one. */
@@ -766,7 +764,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
if (cs->c_symnum == next_file_symnum && cs->c_sclass != C_FILE)
{
- if (last_source_file)
+ if (get_last_source_file ())
coff_end_symtab (objfile);
coff_start_symtab ("_globals_");
@@ -782,7 +780,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
/* Special case for file with type declarations only, no
text. */
- if (!last_source_file && SDB_TYPE (cs->c_type)
+ if (!get_last_source_file () && SDB_TYPE (cs->c_type)
&& cs->c_secnum == N_DEBUG)
complete_symtab (filestring, 0, 0);
@@ -831,7 +829,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
/* Complete symbol table for last object file
containing debugging information. */
- if (last_source_file)
+ if (get_last_source_file ())
{
coff_end_symtab (objfile);
coff_start_symtab (filestring);
@@ -1121,7 +1119,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
read_pe_exported_syms (objfile);
}
- if (last_source_file)
+ if (get_last_source_file ())
coff_end_symtab (objfile);
/* Patch up any opaque types (references to types that are not defined