From: "Ajay Patel" <ajayp@kymasys.com>
To: gdb@sources.redhat.com
Subject: ppc: GDB terminates with signal SIGTRAP
Date: Fri, 22 Jul 2005 00:02:00 -0000 [thread overview]
Message-ID: <1121990511.25452@horse.he.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hi,
I have a simple threaded program. (Program attached)
The program is compiled with STATIC linking.
When I setup a breakpoint in newly created thread
(setup breakpoint at run_thread1) and run this program
it terminates with
"Program terminated with signal SIGTRAP, Trace/breakpoint trap." error.
I have tried this with gdb 6.3 (gdb_6.3-6 patch)
and gdb(6.3.0.0-1.21rh).
I have compiled the program with glibc 2.3.4 & gcc 3.4.3.
I have also compiled the program with glibc 2.3.5 and gcc 4.0.
(Kernel version 2.6.11)
But gdb always terminates.
If I compile the program with dynamic linking it does
not have any problem.
Any help/Suggestion to debug this problem?
Thanks in advance for the help.
Ajay
[-- Attachment #2: pthread_test.c --]
[-- Type: application/octet-stream, Size: 1825 bytes --]
/* $OpenBSD: pthread_kill.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */
/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
/*
* Verify that pthread_kill does the right thing, i.e. the signal
* is delivered to the correct thread and proper signal processing
* is performed.
*/
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdio.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
static void
act_handler (int signal, siginfo_t * siginfo, void *context)
{
struct sigaction sa;
char *str;
sigaction (SIGUSR1, NULL, &sa);
if (sa.sa_handler != SIG_DFL)
abort ();
if (siginfo == NULL)
abort ();
asprintf (&str, "act_handler: signal %d, siginfo %p, context %p\n",
signal, siginfo, context);
write (STDOUT_FILENO, str, (size_t)strlen(str));
free (str);
}
static void *
run_thread1 (void *arg)
{
printf ("Starting THREAD1\n");
while (1) {
sleep(4);
printf ("THREAD1 is going back to sleep\n");
}
}
static void *
run_thread2 (void *arg)
{
printf ("Starting THREAD2\n");
while (1) {
sleep(4);
printf ("THREAD2 is going back to sleep\n");
}
}
int
main (int argc, char **argv)
{
int i;
pthread_t thread1;
pthread_t thread2;
struct sigaction act;
act.sa_sigaction = act_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = SA_SIGINFO | SA_RESETHAND | SA_NODEFER;
sigaction (SIGUSR1, &act, NULL);
pthread_create (&thread1, NULL, run_thread1, NULL);
pthread_create (&thread2, NULL, run_thread2, NULL);
sleep (1);
while (1) {
sleep(4);
printf ("Main thread is going back to sleep\n");
}
}
reply other threads:[~2005-07-22 0:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1121990511.25452@horse.he.net \
--to=ajayp@kymasys.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).