[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system/3922: gdb --pid is totally broken in OpenBSD 3.6
- To: bugs@openbsd.org
- Subject: Re: system/3922: gdb --pid is totally broken in OpenBSD 3.6
- From: djm@mindrot.org (Damien Miller)
- Date: Sat, 11 Sep 2004 23:18:32 +1000 (EST)
On Sat, 11 Sep 2004, Otto Moerbeek wrote:
> On Sat, 11 Sep 2004, Frank Denis wrote:
>
> > >Synopsis: gdb --pid is totally broken in OpenBSD 3.6
>
> When attaching to a process, the executable should be specified:
This patch enforces this on the commandline, but it is still possible
to screw up gdb using the "attach" command interactively. I can see a
API to figure out whether gdb has loaded a symfile at that point.
Index: gdb/main.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils/gdb/main.c,v
retrieving revision 1.3
diff -u -r1.3 main.c
--- gdb/main.c 21 May 2004 20:23:09 -0000 1.3
+++ gdb/main.c 11 Sep 2004 13:01:52 -0000
@@ -526,6 +526,14 @@
quiet = 1;
}
+ if (corearg != NULL && symarg == NULL)
+ {
+ fprintf_unfiltered (gdb_stderr,
+ _("%s: `--pid' specified but no program specified\n"),
+ argv[0]);
+ exit (1);
+ }
+
/* Initialize all files. Give the interpreter a chance to take
control of the console via the init_ui_hook()) */
gdb_init (argv[0]);