delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/14/13:39:48

Date: Wed, 14 Jun 2000 20:33:28 +0530
Message-Id: <200006141503.UAA00730@midpec.com>
From: Prashant TR <tr AT midpec DOT com>
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp-workers AT delorie DOT com
In-reply-to: <Pine.SUN.3.91.1000614121903.29091L-100000@is> (message from Eli
Zaretskii on Wed, 14 Jun 2000 12:19:24 +0300 (IDT))
Subject: Re: Patches for FSDB to look for .exe files
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000614121903 DOT 29091L-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> > +@findex fsdb, check for EXEs
> 
> It's better to write this like so:
> 
>   @findex fsdb AT r{, check for .EXE extension}
> 
> File name or parts thereof should have the @file markup.  Thus,
> @file{.exe} is a better way than ``.EXE''.
> 
> Other than that, it's fine with me.

Ok, that's done. Is this fine?

Prashant

--- djgpp/src/debug/fsdb/ed.c~0	Tue Jun 13 09:14:45 2000
+++ djgpp/src/debug/fsdb/ed.c	Wed Jun 14 20:27:27 2000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <stdio.h>
@@ -10,6 +11,7 @@
 #include "go32.h"
 #include "dos.h"
 #include <debug/syms.h>
+#include <sys/system.h>
 #include <libc/file.h>	/* Workaround for stderr bug below */
 
 extern char *source_path;
@@ -67,6 +69,9 @@
 int main(int argc, char **argv)
 {
   int i;
+  char *dotptr;
+  char *fname;
+  const _v2_prog_type *prog;
   char cmdline[128];
   jmp_buf start_state;
   int argno;
@@ -116,7 +121,27 @@
       exit (1);
     }
 
-  syms_init(argv[argno]);
+  fname = alloca(strlen(argv[argno] + 5));
+  strcpy(fname,argv[argno]);
+
+  prog = _check_v2_prog(fname,-1);
+  if (!prog->valid)
+    {
+      /* Try adding the .exe extension to it and try again. */
+      dotptr = rindex(fname,'.');
+      if (_USE_LFN || dotptr == NULL)
+	strcat(fname,".exe");
+      else
+	if (dotptr < rindex(fname,'/') || dotptr < rindex(fname,'\\'))
+	  strcat(fname,".exe");
+    }
+  prog = _check_v2_prog(fname,-1);
+  if (!prog->valid || prog->object_format!=_V2_OBJECT_FORMAT_COFF)
+    {
+      printf("Load failed for image %s\n",argv[1]);
+      exit(1);
+    }
+  syms_init(fname);
 
   cmdline[1] = 0;
   for (i = argno + 1; argv[i]; i++) {
@@ -126,10 +151,11 @@
   i = strlen(cmdline+1);
   cmdline[0] = i;
   cmdline[i+1] = 13;
-  if(v2loadimage(argv[argno],cmdline,start_state)) {
-    printf("Load failed for image %s\n",argv[1]);
-    exit(1);
-  }
+  if (v2loadimage(fname,cmdline,start_state))
+    {
+      printf("Load failed for image %s\n",argv[1]);
+      exit(1);
+    }
 
   edi_init(start_state);
   stdout->_file = dup(fileno(stdout));
--- djgpp/src/docs/kb/wc204.txi~0	Tue Jun 13 21:14:25 2000
+++ djgpp/src/docs/kb/wc204.txi	Wed Jun 14 20:26:10 2000
@@ -5,3 +5,7 @@
 
 @findex uname AT r{, CPU type detection}
 Ability to report the exact CPU type in @code{uname}.
+
+@findex fsdb AT r{, check for EXE extension}
+@code{fsdb} checks for executables and loads them even if
+the extension @file{.exe} isn't given in the command line.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019