sun386 host/target/native separation
[deliverable/binutils-gdb.git] / gdb / remote-nindy.c
index dcc552a1fa2900e3a9f3df3d3f80beb56ea6b09a..0840bb6999726fa93551f803d814f3e055a17b67 100644 (file)
@@ -276,41 +276,41 @@ nindy_load( filename, from_tty )
     char *filename;
     int from_tty;
 {
-  char *tmpfile;
-  struct cleanup *old_chain;
-  char *scratch_pathname;
-  int scratch_chan;
-
-  if (!filename)
-    filename = get_exec_file (1);
-
-  filename = tilde_expand (filename);
-  make_cleanup (free, filename);
-
-  scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
-                       &scratch_pathname);
-  if (scratch_chan < 0)
-    perror_with_name (filename);
-  close (scratch_chan);                /* Slightly wasteful FIXME */
-
-  have_regs = regs_changed = 0;
-  mark_breakpoints_out();
-  inferior_pid = 0;
-  dcache_flush();
-
-  tmpfile = coffstrip(scratch_pathname);
-  if ( tmpfile ){
-         old_chain = make_cleanup (unlink,tmpfile);
-         immediate_quit++;
-         ninDownload( tmpfile, !from_tty );
-/* FIXME, don't we want this merged in here? */
-         immediate_quit--;
-         do_cleanups (old_chain);
+  asection *s;
+  /* Can't do unix style forking on a VMS system, so we'll use bfd to do
+     all the work for us 
+     */
+
+  bfd *file = bfd_openr(filename,0);
+  if (!file) 
+  {
+    perror_with_name(filename);
+    return;
   }
+  
+  if (!bfd_check_format(file, bfd_object)) 
+  {
+    error("can't prove it's an object file\n");
+    return;
+  }
+  
+  for ( s = file->sections; s; s=s->next) 
+  {
+    if (s->flags & SEC_LOAD) 
+    {
+      char *buffer = xmalloc(s->_raw_size);
+      bfd_get_section_contents(file, s, buffer, 0, s->_raw_size);
+      printf("Loading section %s, size %x vma %x\n",
+            s->name, 
+            s->_raw_size,
+            s->vma);
+      ninMemPut(s->vma, buffer, s->_raw_size);
+      free(buffer);
+    }
+  }
+  bfd_close(file);
 }
 
-
-
 /* Return the number of characters in the buffer before the first DLE character.
  */
 
@@ -941,6 +941,8 @@ specified when you started GDB.",
        0, /* lookup_symbol */
        nindy_create_inferior,
        nindy_mourn_inferior,
+       0,              /* can_run */
+       0, /* notice_signals */
        process_stratum, 0, /* next */
        1, 1, 1, 1, 1,  /* all mem, mem, stack, regs, exec */
        0, 0,                   /* Section pointers */
This page took 0.02411 seconds and 4 git commands to generate.