From 0256270d646c14bc4e75322b48338ba571f89a89 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 9 Oct 1992 04:51:32 +0000 Subject: [PATCH] * remote-nindy.c (nindy_load): Replacement version from Steve Chamberlain, doesn't require forking to run "strip" or "sx". --- gdb/ChangeLog | 5 ++++ gdb/remote-nindy.c | 68 +++++++++++++++++++++++----------------------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5d20586e18a..8ae612490d4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 9 00:28:25 1992 Ken Raeburn (raeburn@cambridge.cygnus.com) + + * remote-nindy.c (nindy_load): Replacement version from Steve + Chamberlain, doesn't require forking to run "strip" or "sx". + Thu Oct 8 18:27:35 1992 Stu Grossman (grossman at cygnus.com) * Makefile.in (HFILES): Add nm-*.h files. diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index 2fc965f6501..0840bb69997 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 */ -- 2.30.2