aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-nindy.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@cygnus>1992-10-09 04:51:32 +0000
committerKen Raeburn <raeburn@cygnus>1992-10-09 04:51:32 +0000
commit0256270d646c14bc4e75322b48338ba571f89a89 (patch)
treed6c8f90dd462bccb408b86bf1d6f87e853d89b81 /gdb/remote-nindy.c
parent439a4936c31d03a62b5b71468e803b44190cdb71 (diff)
downloadfsf-binutils-gdb-0256270d646c14bc4e75322b48338ba571f89a89.zip
fsf-binutils-gdb-0256270d646c14bc4e75322b48338ba571f89a89.tar.gz
fsf-binutils-gdb-0256270d646c14bc4e75322b48338ba571f89a89.tar.bz2
* remote-nindy.c (nindy_load): Replacement version from Steve
Chamberlain, doesn't require forking to run "strip" or "sx".
Diffstat (limited to 'gdb/remote-nindy.c')
-rw-r--r--gdb/remote-nindy.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 2fc965f..0840bb6 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -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,8 +941,8 @@ specified when you started GDB.",
0, /* lookup_symbol */
nindy_create_inferior,
nindy_mourn_inferior,
- 0, /* can_run */
- 0, /* notice_signals */
+ 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 */