From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1914 invoked by alias); 5 Mar 2007 23:20:06 -0000 Received: (qmail 1903 invoked by uid 22791); 5 Mar 2007 23:20:04 -0000 X-Spam-Check-By: sourceware.org Received: from rwcrmhc14.comcast.net (HELO rwcrmhc14.comcast.net) (216.148.227.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 05 Mar 2007 23:20:00 +0000 Received: from [172.22.0.103] (failure[71.63.50.10]) by comcast.net (rwcrmhc14) with ESMTP id <20070305231957m1400fuo30e>; Mon, 5 Mar 2007 23:19:57 +0000 Message-ID: <45ECA592.5080802@ringle.org> Date: Mon, 05 Mar 2007 23:20:00 -0000 From: Jon Ringle User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Jon Ringle , gdb@sourceware.org Subject: Re: gdbserver signals interfere with {next,step{,i}} References: <45EC780E.60705@ringle.org> <20070305201726.GA11385@caradoc.them.org> In-Reply-To: <20070305201726.GA11385@caradoc.them.org> Content-Type: multipart/mixed; boundary="------------030201030000000506080609" Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00068.txt.bz2 This is a multi-part message in MIME format. --------------030201030000000506080609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 955 Daniel Jacobowitz wrote: > On Mon, Mar 05, 2007 at 03:05:34PM -0500, Jon Ringle wrote: > >> Hello, >> >> I have an application that uses SIGUSR1 to receive timer interrupts. >> I've done 'handle SIGUSR1 nostop noprint' to avoid gdb from stopping on >> SIGUSR1. >> I've found that when debugging this application using gdbserver, that I >> can't use next, nexti, step, or stepi. When I use one of these commands, >> the application usually just continues without stopping at the next >> line/instruction. >> >> If I use a native gdb on the target the problem does not occur. >> If I disable my app from generating the SIGUSR1 and use gdbserver, the >> problem also goes away. >> > > I haven't seen this problem before. Can you make a small test case > which demonstrates the problem, maybe? > > Attached is a test case. > What target are you using? > > My target is armeb-linux. Thanks, Jon --------------030201030000000506080609 Content-Type: text/plain; name="gdbsignal-test.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbsignal-test.c" Content-length: 2190 #include #include #include static void signal_handler (int signo); static timer_t timer_id = -1; #define ERROR (-1) int i = 0; void signal_handler(int signo) { // Perform a use-less task i++; } void init_signals (void) { struct sigaction sig_act; struct sigevent evp; struct itimerspec ttime; /* initialize sig_act */ sig_act.sa_handler = (void*)signal_handler; sig_act.sa_flags = 0; sigemptyset(&sig_act.sa_mask); sigaction(SIGUSR1, &sig_act, 0); evp.sigev_value.sival_int = 0; evp.sigev_signo = SIGUSR1; timer_create (CLOCK_REALTIME, &evp, &timer_id); ttime.it_value.tv_sec = 0; /* 0 S */ ttime.it_value.tv_nsec = 20000000; /* 20mS */ ttime.it_interval.tv_sec = 0; /* 0 S */ ttime.it_interval.tv_nsec = 20000000; /* 20mS */ /* fire off the periodic timer - relative mode = 0 */ timer_settime(timer_id, 0, &ttime, NULL); } static int get_input(char *buffer, int size) { char c; int status, counter, dummy; counter= 0; c = 0; status = 0; while (c != '\r') { dummy = getc(stdin); c = (char)dummy; if ((dummy != EOF) && (dummy != 0)) { if ( isprint(c) && (counter < size-1) ) { buffer[counter++] = c; } else if ((c == '\r') || (c == '\n')) { /* return user's str length - while loop will terminate */ status = counter; c = '\r'; } else { ; /* Ignore any other characters */ } } else { memset (buffer, 0, size); counter = 0; if (dummy == 0) printf ("\nreceived NULL!\n"); else printf ("\n\nGot EOF!\n"); sleep(10); c = '\r'; status = ERROR; } } buffer[counter] = 0; return status; } void* thread(void* dummy) { init_signals(); while (1) ; return NULL; } int main(int argc, char* argv[]) { pthread_t tid; pthread_create(&tid, NULL, &thread, NULL); while (1) { char buffer[200]; printf ("Prompt %d> ", i); get_input(buffer, sizeof(buffer)); // Give ourselves something to next... printf("Got "); // <<<<<<<<<<<<< Put breakpoint here printf("'%s'", buffer); printf("\n"); } pthread_join(tid,NULL); return 0; } --------------030201030000000506080609--