* Makefile.am (libbfd.h): Add "Extracted from.." comment.
[deliverable/binutils-gdb.git] / gdb / target.c
index 95ec4ef650a43f1d00a7ada3a60d54caf642b346..2cd492809f45d954b709d7b2b24e5d15652ca1c0 100644 (file)
@@ -861,9 +861,9 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
 
   if (!write && trust_readonly)
     {
-      /* User-settable option, "trust-readonly".  If true, then
-        memory from any SEC_READONLY bfd section may be read
-        directly from the bfd file. */
+      /* User-settable option, "trust-readonly-sections".  If true,
+         then memory from any SEC_READONLY bfd section may be read
+         directly from the bfd file. */
 
       struct section_table *secp;
 
@@ -871,9 +871,11 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
           secp < current_target.to_sections_end;
           secp++)
        {
-         if (memaddr >= secp->addr && memaddr < secp->endaddr)
-           return xfer_memory (memaddr, myaddr, len, 0, 
-                               attrib, &current_target);
+         if (bfd_get_section_flags (secp->bfd, secp->the_bfd_section) 
+             & SEC_READONLY)
+           if (memaddr >= secp->addr && memaddr < secp->endaddr)
+             return xfer_memory (memaddr, myaddr, len, 0, 
+                                 attrib, &current_target);
        }
     }
 
@@ -947,10 +949,10 @@ target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
       while (reg_len > 0)
        {
          if (region->attrib.cache)
-           res = dcache_xfer_memory(target_dcache, memaddr, myaddr,
+           res = dcache_xfer_memory (target_dcache, memaddr, myaddr,
                                     reg_len, write);
          else
-           res = do_xfer_memory(memaddr, myaddr, reg_len, write,
+           res = do_xfer_memory (memaddr, myaddr, reg_len, write,
                                 &region->attrib);
              
          if (res <= 0)
@@ -1650,32 +1652,48 @@ debug_to_post_wait (ptid_t ptid, int status)
                      PIDGET (ptid), status);
 }
 
+static void
+debug_print_register (const char * func, int regno)
+{
+  fprintf_unfiltered (gdb_stdlog, "%s ", func);
+  if (regno >= 0 && regno < NUM_REGS + NUM_PSEUDO_REGS
+      && REGISTER_NAME (regno) != NULL && REGISTER_NAME (regno)[0] != '\0')
+    fprintf_unfiltered (gdb_stdlog, "(%s)", REGISTER_NAME (regno));
+  else
+    fprintf_unfiltered (gdb_stdlog, "(%d)", regno);
+  if (regno >= 0)
+    {
+      int i;
+      unsigned char *buf = alloca (MAX_REGISTER_RAW_SIZE);
+      read_register_gen (regno, buf);
+      fprintf_unfiltered (gdb_stdlog, " = ");
+      for (i = 0; i < REGISTER_RAW_SIZE (regno); i++)
+       {
+         fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
+       }
+      if (REGISTER_RAW_SIZE (regno) <= sizeof (LONGEST))
+       {
+         fprintf_unfiltered (gdb_stdlog, " 0x%s %s",
+                             paddr_nz (read_register (regno)),
+                             paddr_d (read_register (regno)));
+       }
+    }
+  fprintf_unfiltered (gdb_stdlog, "\n");
+}
+
 static void
 debug_to_fetch_registers (int regno)
 {
   debug_target.to_fetch_registers (regno);
-
-  fprintf_unfiltered (gdb_stdlog, "target_fetch_registers (%s)",
-                     regno != -1 ? REGISTER_NAME (regno) : "-1");
-  if (regno != -1)
-    fprintf_unfiltered (gdb_stdlog, " = 0x%lx %ld",
-                       (unsigned long) read_register (regno),
-                       (unsigned long) read_register (regno));
-  fprintf_unfiltered (gdb_stdlog, "\n");
+  debug_print_register ("target_fetch_registers", regno);
 }
 
 static void
 debug_to_store_registers (int regno)
 {
   debug_target.to_store_registers (regno);
-
-  if (regno >= 0 && regno < NUM_REGS)
-    fprintf_unfiltered (gdb_stdlog, "target_store_registers (%s) = 0x%lx %ld\n",
-                       REGISTER_NAME (regno),
-                       (unsigned long) read_register (regno),
-                       (unsigned long) read_register (regno));
-  else
-    fprintf_unfiltered (gdb_stdlog, "target_store_registers (%d)\n", regno);
+  debug_print_register ("target_store_registers", regno);
+  fprintf_unfiltered (gdb_stdlog, "\n");
 }
 
 static void
@@ -2295,5 +2313,5 @@ result in significant performance improvement for remote targets.",
   add_com ("monitor", class_obscure, do_monitor_command,
           "Send a command to the remote monitor (remote targets only).");
 
-  target_dcache = dcache_init();
+  target_dcache = dcache_init ();
 }
This page took 0.028954 seconds and 4 git commands to generate.