* ppc: GDB terminates with signal SIGTRAP
@ 2005-07-22 0:02 Ajay Patel
0 siblings, 0 replies; only message in thread
From: Ajay Patel @ 2005-07-22 0:02 UTC (permalink / raw)
To: gdb
[-- 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");
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-07-22 0:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-22 0:02 ppc: GDB terminates with signal SIGTRAP Ajay Patel
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).