aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1998-01-23 15:44:12 +0000
committerFred Fish <fnf@specifix.com>1998-01-23 15:44:12 +0000
commit77636dea0a8b2f31d21b86b9013a123dcbb10e05 (patch)
tree2df5e68461c4f959679b155fe513f26cfef89d27 /gdb/symfile.c
parentb7c05d37e2b4416aa87080a91e0434f2eb194eda (diff)
downloadgdb-77636dea0a8b2f31d21b86b9013a123dcbb10e05.zip
gdb-77636dea0a8b2f31d21b86b9013a123dcbb10e05.tar.gz
gdb-77636dea0a8b2f31d21b86b9013a123dcbb10e05.tar.bz2
* config/d10v/tm-d10v.h (CALL_DUMMY): Define as "{ 0 }".
(TARGET_READ_FP): Define to d10v_read_fp rather than d10v_read_sp. (TARGET_WRITE_FP): Define to d10v_write_fp rather than d10v_write_sp. (d10v_write_fp, d10v_read_fp): Add prototypes. * symtab.c (decode_line_1): Remove assignment of sals[0].pc field. * symfile.c (simple_overlay_update, simple_overlay_update_1): Ignore the size of overlay sections. This check is redundant anyway. * printcmd.c (print_frame_args): Ditto. * valops.c (value_fetch_lazy): Ditto. * values.c (unpack_long): Ditto. * d10v-tdep.c (d10v_frame_chain, d10v_frame_find_saved_regs, d10v_init_extra_frame_info): Fix some minor bugs so the finish command works properly. (show_regs): Change num1 and num2 types from "long long" to "LONGEST". (d10v_read_fp, d10v_write_fp): New functions. (d10v_push_arguments): Remove unneeded assigns to "val" and "contents". (d10v_push_arguments): Fix for pointers and structs. (d10v_extract_return_value): Fix for pointers and chars.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c171
1 files changed, 121 insertions, 50 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 650c4c3..936ffc9 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -52,6 +52,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define O_BINARY 0
#endif
+int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
+
/* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */
@@ -998,41 +1000,62 @@ generic_load (filename, from_tty)
for (s = loadfile_bfd->sections; s; s = s->next)
{
if (s->flags & SEC_LOAD)
- {
- bfd_size_type size;
-
- size = bfd_get_section_size_before_reloc (s);
- if (size > 0)
- {
- char *buffer;
- struct cleanup *old_chain;
- bfd_vma lma;
-
- data_count += size;
-
- buffer = xmalloc (size);
- old_chain = make_cleanup (free, buffer);
-
- lma = s->lma;
- lma += load_offset;
-
- /* Is this really necessary? I guess it gives the user something
- to look at during a long download. */
- printf_filtered ("Loading section %s, size 0x%lx lma ",
- bfd_get_section_name (loadfile_bfd, s),
- (unsigned long) size);
- print_address_numeric (lma, 1, gdb_stdout);
- printf_filtered ("\n");
-
- bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
-
- if (target_write_memory (lma, buffer, size) != 0)
- error ("Memory access error while loading section %s.",
- bfd_get_section_name (loadfile_bfd, s));
-
- do_cleanups (old_chain);
- }
- }
+ {
+ bfd_size_type size;
+
+ size = bfd_get_section_size_before_reloc (s);
+ if (size > 0)
+ {
+ char *buffer;
+ struct cleanup *old_chain;
+ bfd_vma lma;
+ unsigned long l = size / 100;
+ int err;
+ char *sect;
+ unsigned long sent;
+ unsigned long len;
+
+ l = l > 100 ? l : 100;
+ data_count += size;
+
+ buffer = xmalloc (size);
+ old_chain = make_cleanup (free, buffer);
+
+ lma = s->lma;
+ lma += load_offset;
+
+ /* Is this really necessary? I guess it gives the user something
+ to look at during a long download. */
+ printf_filtered ("Loading section %s, size 0x%lx lma ",
+ bfd_get_section_name (loadfile_bfd, s),
+ (unsigned long) size);
+ print_address_numeric (lma, 1, gdb_stdout);
+ printf_filtered ("\n");
+
+ bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
+
+ sect = bfd_get_section_name (loadfile_bfd, s);
+ sent = 0;
+ do
+ {
+ len = (size - sent) < l ? (size - sent) : l;
+ sent += len;
+ err = target_write_memory (lma, buffer, len);
+ if (ui_load_progress_hook)
+ if (ui_load_progress_hook (sect, sent))
+ error ("Canceled the download");
+ lma += len;
+ buffer += len;
+ }
+ while (err == 0 && sent < size);
+
+ if (err != 0)
+ error ("Memory access error while loading section %s.",
+ bfd_get_section_name (loadfile_bfd, s));
+
+ do_cleanups (old_chain);
+ }
+ }
}
end_time = time (NULL);
@@ -1424,6 +1447,8 @@ allocate_symtab (filename, objfile)
&objfile -> symbol_obstack);
symtab -> fullname = NULL;
symtab -> language = deduce_language_from_filename (filename);
+ symtab -> debugformat = obsavestring ("unknown", 7,
+ &objfile -> symbol_obstack);
/* Hook it to the objfile it comes from */
@@ -1460,15 +1485,54 @@ allocate_psymtab (filename, objfile)
&objfile -> psymbol_obstack);
psymtab -> symtab = NULL;
- /* Hook it to the objfile it comes from */
+ /* Prepend it to the psymtab list for the objfile it belongs to.
+ Psymtabs are searched in most recent inserted -> least recent
+ inserted order. */
psymtab -> objfile = objfile;
psymtab -> next = objfile -> psymtabs;
objfile -> psymtabs = psymtab;
+#if 0
+ {
+ struct partial_symtab **prev_pst;
+ psymtab -> objfile = objfile;
+ psymtab -> next = NULL;
+ prev_pst = &(objfile -> psymtabs);
+ while ((*prev_pst) != NULL)
+ prev_pst = &((*prev_pst) -> next);
+ (*prev_pst) = psymtab;
+ }
+#endif
return (psymtab);
}
+void
+discard_psymtab (pst)
+ struct partial_symtab *pst;
+{
+ struct partial_symtab **prev_pst;
+
+ /* From dbxread.c:
+ Empty psymtabs happen as a result of header files which don't
+ have any symbols in them. There can be a lot of them. But this
+ check is wrong, in that a psymtab with N_SLINE entries but
+ nothing else is not empty, but we don't realize that. Fixing
+ that without slowing things down might be tricky. */
+
+ /* First, snip it out of the psymtab chain */
+
+ prev_pst = &(pst->objfile->psymtabs);
+ while ((*prev_pst) != pst)
+ prev_pst = &((*prev_pst)->next);
+ (*prev_pst) = pst->next;
+
+ /* Next, put it on a free list for recycling */
+
+ pst->next = pst->objfile->free_psymtabs;
+ pst->objfile->free_psymtabs = pst;
+}
+
/* Reset all data structures in gdb which may contain references to symbol
table data. */
@@ -1795,14 +1859,21 @@ init_psymbol_list (objfile, total_symbols)
objfile -> global_psymbols.size = total_symbols / 10;
objfile -> static_psymbols.size = total_symbols / 10;
- objfile -> global_psymbols.next =
- objfile -> global_psymbols.list = (struct partial_symbol **)
- xmmalloc (objfile -> md, objfile -> global_psymbols.size
- * sizeof (struct partial_symbol *));
- objfile -> static_psymbols.next =
- objfile -> static_psymbols.list = (struct partial_symbol **)
- xmmalloc (objfile -> md, objfile -> static_psymbols.size
- * sizeof (struct partial_symbol *));
+
+ if (objfile -> global_psymbols.size > 0)
+ {
+ objfile -> global_psymbols.next =
+ objfile -> global_psymbols.list = (struct partial_symbol **)
+ xmmalloc (objfile -> md, (objfile -> global_psymbols.size
+ * sizeof (struct partial_symbol *)));
+ }
+ if (objfile -> static_psymbols.size > 0)
+ {
+ objfile -> static_psymbols.next =
+ objfile -> static_psymbols.list = (struct partial_symbol **)
+ xmmalloc (objfile -> md, (objfile -> static_psymbols.size
+ * sizeof (struct partial_symbol *)));
+ }
}
/* OVERLAYS:
@@ -2456,14 +2527,14 @@ simple_overlay_update_1 (osect)
size = bfd_get_section_size_before_reloc (osect->the_bfd_section);
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
- cache_ovly_table[i][LMA] == osect->the_bfd_section->lma &&
- cache_ovly_table[i][SIZE] == size)
+ cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
+ cache_ovly_table[i][SIZE] == size */)
{
read_target_int_array (cache_ovly_table_base + i * TARGET_INT_BYTES,
(int *) &cache_ovly_table[i], 4);
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
- cache_ovly_table[i][LMA] == osect->the_bfd_section->lma &&
- cache_ovly_table[i][SIZE] == size)
+ cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
+ cache_ovly_table[i][SIZE] == size */)
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
@@ -2518,8 +2589,8 @@ simple_overlay_update (osect)
size = bfd_get_section_size_before_reloc (osect->the_bfd_section);
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == osect->the_bfd_section->vma &&
- cache_ovly_table[i][LMA] == osect->the_bfd_section->lma &&
- cache_ovly_table[i][SIZE] == size)
+ cache_ovly_table[i][LMA] == osect->the_bfd_section->lma /* &&
+ cache_ovly_table[i][SIZE] == size */)
{ /* obj_section matches i'th entry in ovly_table */
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out */