Date: Wed, 14 Jun 2000 20:33:28 +0530
Message-Id: <200006141503.UAA00730@midpec.com>
From: Prashant TR
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp-workers AT delorie DOT com
In-reply-to: (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:
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
Precedence: bulk
> > +@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
@@ -10,6 +11,7 @@
#include "go32.h"
#include "dos.h"
#include
+#include
#include /* 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.