* gdb 7.3.50-2 crash
@ 2011-10-16 11:01 Ken Brown
2011-10-27 12:11 ` Ken Brown
0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2011-10-16 11:01 UTC (permalink / raw)
To: cygwin
gdb 7.3.50-2 crashes with a segfault if a file is loaded and the
following two command lines are sent:
server interpreter mi "-file-list-exec-source-files"
server list
To reproduce, run `gdb t.exe' and then type in those two lines. Here
t.exe can be any executable, I think. I tried several and got the crash
every time. Specifically, it happens with a standard "Hello, world!"
program:
$ cat t.c
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
This crash explains the problem reported in
http://cygwin.com/ml/cygwin/2011-09/msg00172.html
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb 7.3.50-2 crash
2011-10-16 11:01 gdb 7.3.50-2 crash Ken Brown
@ 2011-10-27 12:11 ` Ken Brown
2011-10-27 19:55 ` Christopher Faylor
0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2011-10-27 12:11 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 823 bytes --]
On 10/16/2011 7:01 AM, Ken Brown wrote:
> gdb 7.3.50-2 crashes with a segfault if a file is loaded and the
> following two command lines are sent:
>
> server interpreter mi "-file-list-exec-source-files"
> server list
I don't know if it helps, but I've modified the STC from
http://cygwin.com/ml/cygwin/2011-10/msg00472.html to apply to the
present problem. I had to uncomment the sleep (1) to get it to run
properly on my Linux system. I also made the STC run "gdb --annotate=3"
even though the crash occurs with just "gdb", because that's how gdb is
run by emacs in the situation that led to this bug report.
The STC assumes that you have hello.exe in the current directory.
$ cat > hello.c << EOF
#include <stdio.h>
int
main ()
{
printf("Hello, world!\n");
return 0;
}
EOF
$ gcc -g -o hello hello.c
Ken
[-- Attachment #2: gdbsegv.cc --]
[-- Type: text/plain, Size: 1452 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pty.h>
#include <string.h>
#include <sys/wait.h>
void get_output (int fd);
int
main (int argc, const char **argv)
{
int master;
pid_t pid;
if ((pid = forkpty (&master, NULL, NULL, NULL)) < 0)
{
perror ("forkpty");
exit (1);
}
/* child */
if (pid == 0)
{
const char *av[100];
int i = 0;
#ifdef STRACE_GDB
av[i++] = "strace";
av[i++] = "-o";
av[i++] = "/tmp/strace.out";
#ifdef __CYGWIN__
av[i++] = "--mask=all+paranoid";
#endif
#endif
av[i++] = argv[1] ?: "gdb";
fprintf (stderr, "*** using %s\n", av[0]);
av[i++] = "--annotate=3";
av[i++] = "hello.exe";
av[i] = NULL;
execvp (av[0], (char * const *) av);
/* shouldn't get here */
exit (1);
}
/* parent */
const char *input[20];
int i = 0;
input[i++] = "server interpreter mi \"-file-list-exec-source-files\"\n";
input[i++] = "server list\n";
input[i++] = "q\n";
input[i] = NULL;
for (int i = 0; input[i]; ++i)
{
write (master, input[i], strlen (input[i]));
sleep (1);
}
get_output (master);
wait (NULL);
}
void
get_output (int fd)
{
char buf[4096];
while (1)
{
int nread = read (fd, buf, sizeof (buf));
if (nread > 0)
write (STDOUT_FILENO, buf, nread);
else
{
printf ("No more output. nread %d\n", nread);
break;
}
}
}
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gdb 7.3.50-2 crash
2011-10-27 12:11 ` Ken Brown
@ 2011-10-27 19:55 ` Christopher Faylor
0 siblings, 0 replies; 3+ messages in thread
From: Christopher Faylor @ 2011-10-27 19:55 UTC (permalink / raw)
To: cygwin, Ken Brown
On Thu, Oct 27, 2011 at 08:11:39AM -0400, Ken Brown wrote:
>On 10/16/2011 7:01 AM, Ken Brown wrote:
>> gdb 7.3.50-2 crashes with a segfault if a file is loaded and the
>> following two command lines are sent:
>>
>> server interpreter mi "-file-list-exec-source-files"
>> server list
>
>I don't know if it helps, but I've modified the STC from
>http://cygwin.com/ml/cygwin/2011-10/msg00472.html to apply to the
>present problem. I had to uncomment the sleep (1) to get it to run
>properly on my Linux system. I also made the STC run "gdb --annotate=3"
>even though the crash occurs with just "gdb", because that's how gdb is
>run by emacs in the situation that led to this bug report.
>
>The STC assumes that you have hello.exe in the current directory.
I haven't tried your new STC but I have confirmed that the crash
goes away with a newer version of gdb. I'll roll out a new update
over the weekend.
cgf
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-27 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-16 11:01 gdb 7.3.50-2 crash Ken Brown
2011-10-27 12:11 ` Ken Brown
2011-10-27 19:55 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).