* config/d10v/tm-d10v.h (CALL_DUMMY): Define as "{ 0 }".
authorFred Fish <fnf@specifix.com>
Fri, 23 Jan 1998 15:44:12 +0000 (15:44 +0000)
committerFred Fish <fnf@specifix.com>
Fri, 23 Jan 1998 15:44:12 +0000 (15:44 +0000)
(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.

gdb/ChangeLog
gdb/ChangeLog-gdbtk
gdb/Makefile.in
gdb/config/d10v/tm-d10v.h
gdb/d10v-tdep.c
gdb/symfile.c
gdb/symtab.c
gdb/values.c

index 7e09828fd79d05b28b40639514af5273f212c1a7..7e097718868e93a8261aedb1213c6bd829820a5d 100644 (file)
@@ -1,3 +1,24 @@
+Fri Jan 23 07:47:06 1998  Fred Fish  <fnf@cygnus.com>
+
+       * 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.
+
 Tue Jan 20 18:53:18 1998  Stan Shebs  <shebs@andros.cygnus.com>
 
        * configure.tgt (i386-*-mach*, m88*-*-mach3*): Remove config
index a1c04864284edfd73f7153e1254ad480c49bfe6a..55bdd34b1b6166e6a615ce039ffa14d68d3df89e 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jan 23 07:47:06 1998  Fred Fish  <fnf@cygnus.com>
+
+       * Makefile.in (uninstall): Remove installed gdbtcl dir, if one
+       was installed.
+
 Thu Jan 15 12:42:28 1998  Keith Seitz  <keiths@onions.cygnus.com>
 
        * gdbtk.c (gdb_immediate_command): New function which does not buffer any
index 3e2c7d9e167326959010220bb0bb3631d6a91cea..1eb6644a26ac42380d4ad5904acbda990d2db2b6 100644 (file)
@@ -578,16 +578,16 @@ install-only:
                fi ; \
                $(INSTALL_PROGRAM) gdb$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \
                $(INSTALL_DATA) $(srcdir)/gdb.1 $(man1dir)/$$transformed_name.1
-               # start-sanitize-gdbtk
-               $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl ; \
-               $(SHELL) $(srcdir)/../mkinstalldirs \
-                       $(datadir)/gdbtcl/images \
-                       $(datadir)/gdbtcl/images2 ; \
-               cd $(srcdir)/gdbtcl2 ; \
-               for i in *.tcl images/*.gif images2/*.gif tclIndex; \
-                 do \
-                       $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \
-                 done ;
+       # start-sanitize-gdbtk
+       $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl ; \
+       $(SHELL) $(srcdir)/../mkinstalldirs \
+               $(datadir)/gdbtcl/images \
+               $(datadir)/gdbtcl/images2 ; \
+       cd $(srcdir)/gdbtcl2 ; \
+       for i in *.tcl images/*.gif images2/*.gif tclIndex; \
+         do \
+               $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \
+         done ;
        # end-sanitize-gdbtk
        @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do 
 
@@ -600,6 +600,9 @@ uninstall: force
                  true ; \
                fi ; \
                rm -f $(bindir)/$$transformed_name$(EXEEXT) $(man1dir)/$$transformed_name.1
+       # start-sanitize-gdbtk
+       rm -rf $(datadir)/gdbtcl
+       # end-sanitize-gdbtk
        @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do 
 
 # We do this by grepping through sources.  If that turns out to be too slow,
index 5f248b19ff49efba64ee7d56413ab385a033caab..ca1ef07eecbab0f698b24f8fd371228b413bd47a 100644 (file)
@@ -236,7 +236,7 @@ When it hits the breakpoint, clear the break point and pop the old register cont
 off the stack.
 */
 
-#define CALL_DUMMY             { }  
+#define CALL_DUMMY             { }  
 #define PUSH_DUMMY_FRAME
 #define CALL_DUMMY_START_OFFSET        0       
 #define CALL_DUMMY_LOCATION    AT_ENTRY_POINT
@@ -286,11 +286,13 @@ void d10v_write_pc PARAMS ((CORE_ADDR val, int pid));
 CORE_ADDR d10v_read_pc PARAMS ((int pid));
 void d10v_write_sp PARAMS ((CORE_ADDR val));
 CORE_ADDR d10v_read_sp PARAMS ((void));
+void d10v_write_fp PARAMS ((CORE_ADDR val));
+CORE_ADDR d10v_read_fp PARAMS ((void));
 
 #define TARGET_READ_PC(pid)            d10v_read_pc (pid)
 #define TARGET_WRITE_PC(val,pid)       d10v_write_pc (val, pid)
-#define TARGET_READ_FP()               d10v_read_sp ()
-#define TARGET_WRITE_FP(val)           d10v_write_sp (val)
+#define TARGET_READ_FP()               d10v_read_fp ()
+#define TARGET_WRITE_FP(val)           d10v_write_fp (val)
 #define TARGET_READ_SP()               d10v_read_sp ()
 #define TARGET_WRITE_SP(val)           d10v_write_sp (val)
 
index 9ca62a5980877e39f6c31164dc37374b2fb401a0..5b9e980e8be4de271ed9feed179b9d6ffe9c2f2f 100644 (file)
@@ -199,7 +199,7 @@ d10v_frame_chain (frame)
 
   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])
@@ -369,9 +369,9 @@ d10v_frame_find_saved_regs (fi, fsr)
       }
 
   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])
@@ -395,10 +395,6 @@ d10v_init_extra_frame_info (fromleaf, fi)
      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);
 }
 
@@ -407,7 +403,7 @@ show_regs (args, from_tty)
      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),
@@ -497,6 +493,19 @@ d10v_write_sp (val)
   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;
@@ -563,7 +572,6 @@ d10v_push_arguments (nargs, args, sp, struct_return, struct_addr)
       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 */
@@ -580,8 +588,6 @@ d10v_push_arguments (nargs, args, sp, struct_return, struct_addr)
       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 */
@@ -597,6 +603,25 @@ d10v_push_arguments (nargs, args, sp, struct_return, struct_addr)
        }
       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)
@@ -649,7 +674,25 @@ d10v_extract_return_value (valtype, regbuf, valbuf)
      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
index 650c4c3b267f87743819f352b2fab7624ec42a6e..936ffc9dd51d04f939a4f60101964b5ffb468272 100644 (file)
@@ -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;
+}
+
 \f
 /* 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 */
index e79b9b5a30fb4509648484c12b8b6aca7b0e58bc..9a8201c7518a5dea18f408b34d7b87686ef9de61 100644 (file)
@@ -2102,7 +2102,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
        xmalloc (sizeof (struct symtab_and_line));
       values.nelts = 1;
       values.sals[0] = find_pc_line (pc, 0);
-      values.sals[0].pc = pc;
       return values;
     }
 
index 0ffd5a63cb3fa2209fdad2f8da6d87ddd1b6afd4..69c19a6399ce358ed5e46861f5aa3c576a4ac694 100644 (file)
@@ -634,6 +634,10 @@ unpack_long (type, valaddr)
     case TYPE_CODE_REF:
       /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
         whether we want this to be true eventually.  */
+#ifdef GDB_TARGET_IS_D10V
+      if (len == 2)
+         return D10V_MAKE_DADDR(extract_address (valaddr, len));
+#endif
       return extract_address (valaddr, len);
 
     case TYPE_CODE_MEMBER:
This page took 0.039093 seconds and 4 git commands to generate.