d10v_frame_find_saved_regs (frame, &fsr);
- if (frame->return_pc == IMEM_START)
+ if (frame->return_pc == IMEM_START || inside_entry_file(frame->return_pc))
return (CORE_ADDR)0;
if (!fsr.regs[FP_REGNUM])
}
if (fsr->regs[LR_REGNUM])
- fi->return_pc = ((read_memory_unsigned_integer(fsr->regs[LR_REGNUM],2) - 1) << 2) | IMEM_START;
+ fi->return_pc = (read_memory_unsigned_integer(fsr->regs[LR_REGNUM],2) << 2) | IMEM_START;
else
- fi->return_pc = ((read_register(LR_REGNUM) - 1) << 2) | IMEM_START;
+ fi->return_pc = (read_register(LR_REGNUM) << 2) | IMEM_START;
/* th SP is not normally (ever?) saved, but check anyway */
if (!fsr->regs[SP_REGNUM])
struct frame_info *fi;
{
struct frame_saved_regs dummy;
-
- if (fi->next && ((fi->pc & 0xffff) == 0))
- fi->pc = fi->next->return_pc;
-
d10v_frame_find_saved_regs (fi, &dummy);
}
char *args;
int from_tty;
{
- long long num1, num2;
+ LONGEST num1, num2;
printf_filtered ("PC=%04x (0x%x) PSW=%04x RPT_S=%04x RPT_E=%04x RPT_C=%04x\n",
read_register (PC_REGNUM), (read_register (PC_REGNUM) << 2) + IMEM_START,
read_register (PSW_REGNUM),
write_register (SP_REGNUM, (LONGEST)(val & 0xffff));
}
+void
+d10v_write_fp (val)
+ CORE_ADDR val;
+{
+ write_register (FP_REGNUM, (LONGEST)(val & 0xffff));
+}
+
+CORE_ADDR
+d10v_read_fp ()
+{
+ return (read_register(FP_REGNUM) | DMEM_START);
+}
+
CORE_ADDR
d10v_fix_call_dummy (dummyname, start_sp, fun, nargs, args, type, gcc_p)
char *dummyname;
struct type *arg_type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (arg_type);
contents = VALUE_CONTENTS(arg);
- val = extract_signed_integer (contents, len);
if (len > 4)
{
/* put on stack and pass pointers */
value_ptr arg = args[i];
struct type *arg_type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (arg_type);
- contents = VALUE_CONTENTS(arg);
- val = extract_signed_integer (contents, len);
if (len > 4)
{
/* use a pointer to previously saved data */
}
else
{
+ contents = VALUE_CONTENTS(arg);
+ val = extract_signed_integer (contents, len);
+ /* printf("push: type=%d len=%d val=0x%x\n",arg_type->code,len,val); */
+ if (arg_type->code == TYPE_CODE_PTR)
+ {
+ if ( (val & 0x3000000) == 0x1000000)
+ {
+ /* function pointer */
+ val = (val & 0x3FFFF) >> 2;
+ len = 2;
+ }
+ else
+ {
+ /* data pointer */
+ val &= 0xFFFF;
+ len = 2;
+ }
+ }
+
if (regnum < 6 )
{
if (len == 4)
char regbuf[REGISTER_BYTES];
char *valbuf;
{
- memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype));
+ int len;
+ /* printf("RET: VALTYPE=%d len=%d r2=0x%x\n",valtype->code, TYPE_LENGTH (valtype), (int)*(short *)(regbuf+REGISTER_BYTE(2))); */
+ if (valtype->code == TYPE_CODE_PTR)
+ {
+ short snum;
+ snum = (short)extract_address (regbuf + REGISTER_BYTE (2), 2);
+ store_address ( valbuf, 4, D10V_MAKE_DADDR(snum));
+ }
+ else
+ {
+ len = TYPE_LENGTH (valtype);
+ if (len == 1)
+ {
+ unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (2), 2);
+ store_unsigned_integer (valbuf, 1, c);
+ }
+ else
+ memcpy (valbuf, regbuf + REGISTER_BYTE (2), len);
+ }
}
/* The following code implements access to, and display of, the D10V's
#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 */
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);
&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 */
&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;
+}
+
\f
/* Reset all data structures in gdb which may contain references to symbol
table data. */
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:
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;
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 */