2002-02-13 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Thu, 14 Feb 2002 01:57:36 +0000 (01:57 +0000)
committerMichael Snyder <msnyder@vmware.com>
Thu, 14 Feb 2002 01:57:36 +0000 (01:57 +0000)
* gcore.c (gcore_command): Use gcore_default_target instead of NULL.
(default_gcore_mach): Just return 0, work around a problem in bfd.
(default_gcore_target): OK to return NULL if exec_bfd is null.
(make_mem_sec): Use a cast, avoid a warning.

* procfs.c (find_memory_regions_callback): Use a cast instead of
calling host_pointer_to_address (which complains if
sizeof (host pointer) != sizeof (target pointer)).
(procfs_make_note_section): Avoid overflow in psargs string.

gdb/ChangeLog
gdb/gcore.c
gdb/procfs.c

index 778714149e04919c10b00635a16fec0d7544e465..b8b2a3e734676c13db2c46da14571be220348eaf 100644 (file)
@@ -1,5 +1,15 @@
 2002-02-13  Michael Snyder  <msnyder@redhat.com>
 
+       * gcore.c (gcore_command): Use gcore_default_target instead of NULL.
+       (default_gcore_mach): Just return 0, work around a problem in bfd.
+       (default_gcore_target): OK to return NULL if exec_bfd is null.
+       (make_mem_sec): Use a cast, avoid a warning.
+
+       * procfs.c (find_memory_regions_callback): Use a cast instead of
+       calling host_pointer_to_address (which complains if 
+       sizeof (host pointer) != sizeof (target pointer)).
+       (procfs_make_note_section): Avoid overflow in psargs string.
+
        * procfs.c (procfs_make_note_section): Make the default 
        implementation return an error.
 
index 56c1da414cd7ada01d3ff4738189720e1068d1fb..494efad460835e647dde2945af198bd7bb02bd04 100644 (file)
@@ -63,7 +63,7 @@ gcore_command (char *args, int from_tty)
                      "Opening corefile '%s' for output.\n", corefilename);
 
   /* Open the output file. */
-  if (!(obfd = bfd_openw (corefilename, NULL /*default_gcore_target ()*/)))
+  if (!(obfd = bfd_openw (corefilename, default_gcore_target ())))
     {
       error ("Failed to open '%s' for output.", corefilename);
     }
@@ -117,16 +117,20 @@ gcore_command (char *args, int from_tty)
 static unsigned long
 default_gcore_mach (void)
 {
+#if 1  /* See if this even matters... */
+  return 0;
+#else
 #ifdef TARGET_ARCHITECTURE
   const struct bfd_arch_info * bfdarch = TARGET_ARCHITECTURE;
 
   if (bfdarch != NULL)
     return bfdarch->mach;
-#endif
+#endif /* TARGET_ARCHITECTURE */
   if (exec_bfd == NULL)
     error ("Can't find default bfd machine type (need execfile).");
 
   return bfd_get_mach (exec_bfd);
+#endif /* 1 */
 }
 
 static enum bfd_architecture
@@ -149,9 +153,9 @@ default_gcore_target (void)
 {
   /* FIXME -- this may only work for ELF targets.  */
   if (exec_bfd == NULL)
-    error ("Can't find default bfd target for corefile (need execfile).");
-
-  return bfd_get_target (exec_bfd);
+    return NULL;
+  else
+    return bfd_get_target (exec_bfd);
 }
 
 /*
@@ -344,8 +348,8 @@ make_mem_sec (bfd *obfd,
   if (info_verbose)
     {
       fprintf_filtered (gdb_stdout, 
-                       "Save segment, %ld bytes at 0x%s\n",
-                       size, paddr_nz (addr));
+                       "Save segment, %lld bytes at 0x%s\n",
+                       (long long) size, paddr_nz (addr));
     }
 
   bfd_set_section_size (obfd, osec, size);
index aec61bcc86956e8441b4658910d785f71d270862..55e0496bc78573bfd7635a54d6bc6fbb4af283c2 100644 (file)
@@ -5388,7 +5388,7 @@ find_memory_regions_callback (struct prmap *map,
                                           void *),
                              void *data)
 {
-  return (*func) (host_pointer_to_address ((void *) map->pr_vaddr),
+  return (*func) ((CORE_ADDR) map->pr_vaddr,
                  map->pr_size, 
                  (map->pr_mflags & MA_READ) != 0,
                  (map->pr_mflags & MA_WRITE) != 0,
@@ -5793,6 +5793,7 @@ procfs_make_note_section (bfd *obfd, int *note_size)
   char psargs[80] = {'\0'};
   procinfo *pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0);
   char *note_data = NULL;
+  char *inf_args;
   struct procfs_corefile_thread_data thread_args;
 
   if (get_exec_file (0))
@@ -5800,11 +5801,14 @@ procfs_make_note_section (bfd *obfd, int *note_size)
       strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
       strncpy (psargs, get_exec_file (0), 
               sizeof (psargs));
-      if (get_inferior_args ())
+
+      inf_args = get_inferior_args ();
+      if (inf_args && *inf_args &&
+         strlen (inf_args) < ((int) sizeof (psargs) - (int) strlen (psargs)))
        {
          strncat (psargs, " ", 
                   sizeof (psargs) - strlen (psargs));
-         strncat (psargs, get_inferior_args ()
+         strncat (psargs, inf_args
                   sizeof (psargs) - strlen (psargs));
        }
     }
This page took 0.031737 seconds and 4 git commands to generate.