Date: Tue, 13 Jun 2000 09:25:13 +0530
Message-Id: <200006130355.JAA02699@midpec.com>
From: Prashant TR
To: djgpp-workers AT delorie DOT com
Subject: Patches for FSDB to look for .exe files
Reply-To: djgpp-workers AT delorie DOT com
Ok, here goes...
--- djgpp/src/debug/fsdb/ed.c~0 Tue Jun 13 09:14:45 2000
+++ djgpp/src/debug/fsdb/ed.c Tue Jun 13 09:10:31 2000
@@ -67,6 +67,8 @@
int main(int argc, char **argv)
{
int i;
+ char *dotptr;
+ char *fname;
char cmdline[128];
jmp_buf start_state;
int argno;
@@ -116,7 +118,20 @@
exit (1);
}
- syms_init(argv[argno]);
+ /* Try adding the .exe extension to it and try again. */
+ fname = alloca(strlen(argv[argno] + 5));
+ strcpy(fname,argv[argno]);
+
+ if (!__file_exists(fname))
+ {
+ dotptr = rindex(fname,'.');
+ if (_USE_LFN || dotptr == NULL)
+ strcat(fname,".exe");
+ else
+ if (dotptr < rindex(fname,'/') || dotptr < rindex(fname,'\\'))
+ strcat(fname,".exe");
+ }
+ syms_init(fname);
cmdline[1] = 0;
for (i = argno + 1; argv[i]; i++) {
@@ -126,7 +141,7 @@
i = strlen(cmdline+1);
cmdline[0] = i;
cmdline[i+1] = 13;
- if(v2loadimage(argv[argno],cmdline,start_state)) {
+ if (v2loadimage(fname,cmdline,start_state)) {
printf("Load failed for image %s\n",argv[1]);
exit(1);
}
[Forwarded message from the DJGPP list].
------- Start of forwarded message -------
Date: Mon, 12 Jun 2000 15:36:57 +0300 (IDT)
From: Eli Zaretskii
To: Kalum Somaratna aka Grendel
cc: garyroughton AT netzero DOT net, djgpp AT delorie DOT com
Subject: Re: Need help with FSDB/EDEBUG32 before I lose my mind
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Mon, 12 Jun 2000, Kalum Somaratna aka Grendel wrote:
> > D:\djgpp>fsdb hello
> > hello: No such file or directory (ENOENT)
> > Load failed for image lines
> >
> > What then is "debug-image", if not the executable?
>
> Yes it is in the executable, but please specify the *full name* of the
> executable, hello.exe *not* just hello...
>
> ie fsdb hello.exe will work.
Actually, even "fsdb hello" will work, provided that there is a file
`hello' in that directory. But many users say "gcc -o hello.exe",
which only creates `hello.exe'. If you say "gcc -o hello", that would
produce both `hello' and `hello.exe', and "fsdb hello" will work.
Note that chapter 12 in the FAQ explicitly tells you to say "gdb foo.exe".
> I know it might seem stupid that a dos debugger doesn't do this itself
Patches to fsdb to make it look for .exe are welcome.
------- End of forwarded message -------