From: Jon Ringle <jon@ringle.org>
To: Jon Ringle <jon@ringle.org>, gdb@sourceware.org
Subject: Re: gdbserver signals interfere with {next,step{,i}}
Date: Mon, 05 Mar 2007 23:20:00 -0000 [thread overview]
Message-ID: <45ECA592.5080802@ringle.org> (raw)
In-Reply-To: <20070305201726.GA11385@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 955 bytes --]
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. <cid:part1.03040401.03010207@ringle.org>
> What target are you using?
>
>
My target is armeb-linux.
Thanks,
Jon
[-- Attachment #2: gdbsignal-test.c --]
[-- Type: text/plain, Size: 2190 bytes --]
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
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;
}
next prev parent reply other threads:[~2007-03-05 23:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-05 20:06 Jon Ringle
2007-03-05 20:17 ` Daniel Jacobowitz
2007-03-05 23:20 ` Jon Ringle [this message]
2007-03-06 1:43 ` Michael Snyder
2007-03-06 1:48 ` [SPAM] " Jon Ringle
2007-03-06 2:11 ` Michael Snyder
2007-03-06 2:25 ` [SPAM] " Jon Ringle
2007-03-06 12:25 ` Daniel Jacobowitz
2007-03-06 14:31 ` Jon Ringle
2007-03-06 14:39 ` Daniel Jacobowitz
2007-03-06 14:57 ` Jon Ringle
2007-03-06 19:46 ` Michael Snyder
2007-03-06 20:18 ` Jon Ringle
2007-03-06 20:19 ` Daniel Jacobowitz
2007-03-06 19:41 ` Michael Snyder
2007-03-06 20:10 ` Jon Ringle
2007-03-06 2:40 ` Jon Ringle
2007-03-06 5:07 ` Jon Ringle
2007-03-06 1:17 ` Michael Snyder
2007-03-06 1:30 ` Jon Ringle
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=45ECA592.5080802@ringle.org \
--to=jon@ringle.org \
--cc=gdb@sourceware.org \
/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