delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | simnav AT gmail DOT com |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | SIGALRM and debugger |
Date: | Thu, 28 Jun 2007 09:33:01 -0700 |
Organization: | http://groups.google.com |
Lines: | 60 |
Message-ID: | <1183048381.830011.194660@g4g2000hsf.googlegroups.com> |
NNTP-Posting-Host: | 88.40.73.114 |
Mime-Version: | 1.0 |
X-Trace: | posting.google.com 1183048382 6178 127.0.0.1 (28 Jun 2007 16:33:02 GMT) |
X-Complaints-To: | groups-abuse AT google DOT com |
NNTP-Posting-Date: | Thu, 28 Jun 2007 16:33:02 +0000 (UTC) |
User-Agent: | G2/1.0 |
X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4,gzip(gfe),gzip(gfe) |
Complaints-To: | groups-abuse AT google DOT com |
Injection-Info: | g4g2000hsf.googlegroups.com; posting-host=88.40.73.114; |
posting-account=rJqH6A0AAADn24l60w-jp4A6NuOfth4S | |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
I've set with settitimer a 50msec timer and I've installed a function to handle SIGALRM that is correctly called every 50msec. Often a problem occours: if I set a breakpoint in main code when I press F8 to proceed to next instruction, software crash reporting a general protection fault (SIGSEGV) in a location that's checked with gdb seems to be invalid; there is no kind of problem if I don't set breakpoints. Is this a known problem of djgpp or I did something wrong ? Thank you. Best regards. Simone Navari. Here is the code I've used (i put breakpoint if Hello printf). #include <pc.h> #include <stdio.h> #include <sys/time.h> #include <signal.h> void f(int n) { printf("+\n"); } int main(void) { void(*old)(int); struct itimerval timer; asm("sti"); timer.it_interval.tv_sec=0; timer.it_interval.tv_usec=50000; timer.it_value.tv_sec=0; timer.it_value.tv_usec=2000; setitimer(ITIMER_REAL,&timer,NULL); old=signal(SIGALRM,f); while(1) { if(kbhit()) { int c=getkey(); if(c=='A') { printf("Hello\n"); } if(c==0x0d) { break; } } } signal(SIGALRM,old); }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |