Thu Jul 18 01:22:01 1996 Geoffrey Noer <noer@cygnus.com>
authorGeoffrey Noer <noer@cygnus>
Thu, 18 Jul 1996 08:29:09 +0000 (08:29 +0000)
committerGeoffrey Noer <noer@cygnus>
Thu, 18 Jul 1996 08:29:09 +0000 (08:29 +0000)
        * symfile.c (symfile_bfd_open):
        * exec.c (exec_file_command): for __GO32__ and __WIN32__ systems,
        free the user from having to type the .exe extension.

gdb/ChangeLog
gdb/exec.c
gdb/symfile.c

index 85c8aaa26a68783d9e32a13aec405f22b707fbf4..22ce466435632e9d5210127f6f76b81e36253a6d 100644 (file)
@@ -1,3 +1,9 @@
+Thu Jul 18 01:22:01 1996  Geoffrey Noer  <noer@cygnus.com>
+
+       * symfile.c (symfile_bfd_open): 
+       * exec.c (exec_file_command): for __GO32__ and __WIN32__ systems,
+       free the user from having to type the .exe extension.
+
 Wed Jul 17 06:54:50 1996  Mark Alexander  <marka@cygnus.com>
 
        * mon960-rom.c: Shorten the mon960_inits string to a single
index e866ab6bf773792a3df17055a599ea3d3bcb521a..e95454d8bc9879934a4f769ce1922c3f42604357 100644 (file)
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "frame.h"
@@ -183,13 +183,30 @@ exec_file_command (args, from_tty)
       scratch_chan = openp (getenv ("PATH"), 1, filename, 
                            write_files? O_RDWR|O_BINARY: O_RDONLY|O_BINARY, 0,
                            &scratch_pathname);
+#if defined(__GO32__) || defined(__WIN32__)
+      if (scratch_chan < 0)
+      {
+       char *exename = alloca (strlen (filename) + 5);
+       strcat (strcpy (exename, filename), ".exe");
+       scratch_chan = openp (getenv ("PATH"), 1, exename, write_files ?
+               O_RDWR|O_BINARY : O_RDONLY|O_BINARY, 0, &scratch_pathname);
+      }
+#endif
       if (scratch_chan < 0)
        perror_with_name (filename);
-
       exec_bfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
+
       if (!exec_bfd)
        error ("\"%s\": could not open as an executable file: %s",
               scratch_pathname, bfd_errmsg (bfd_get_error ()));
+
+      /* At this point, scratch_pathname and exec_bfd->name both point to the
+        same malloc'd string.  However exec_close() will attempt to free it
+        via the exec_bfd->name pointer, so we need to make another copy and
+        leave exec_bfd as the new owner of the original copy. */
+      scratch_pathname = strdup (scratch_pathname);
+      make_cleanup (free, scratch_pathname);
+      
       if (!bfd_check_format (exec_bfd, bfd_object))
        {
          /* Make sure to close exec_bfd, or else "run" might try to use
index cdf12a674b4fda3428f1caab2d91f26820444ed1..1d91e7f2a6e28bded0b91f0a5286af46b4a2bd41 100644 (file)
@@ -838,6 +838,15 @@ symfile_bfd_open (name)
 
   /* Look down path for it, allocate 2nd new malloc'd copy.  */
   desc = openp (getenv ("PATH"), 1, name, O_RDONLY | O_BINARY, 0, &absolute_name);
+#if defined(__GO32__) || defined(__WIN32__)
+  if (desc < 0)
+    {
+      char *exename = alloca (strlen (name) + 5);
+      strcat (strcpy (exename, name), ".exe");
+      desc = openp (getenv ("PATH"), 1, exename, O_RDONLY | O_BINARY,
+                    0, &absolute_name);
+    }
+#endif
   if (desc < 0)
     {
       make_cleanup (free, name);
This page took 0.042727 seconds and 4 git commands to generate.