LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2011, 02:47 PM   #16
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30

This is my open_port function, in case it sheds any light...

Code:
int comm_handler::open_port(const char* modemdevice) {

        fd = open(modemdevice, O_RDWR | O_NOCTTY );
        if (fd == -1) {
                syslog(LOG_ERR,"Could not open comm port");
                exit(-1);
        }
        else {
                fcntl(fd,F_SETFL,O_ASYNC);
                tcgetattr(fd,&options);
                options.c_cflag |= (CLOCAL | CREAD);
                options.c_cflag &= ~PARENB;
                options.c_cflag &= ~CSTOPB;
                options.c_cflag &= ~CSIZE;
                options.c_cflag |= CS8;
                options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
                options.c_oflag &= ~OPOST;
                options.c_iflag &= ~(ICRNL|IXON|IXOFF);
                options.c_cc[VMIN]=0;
                options.c_cc[VTIME]=0;
                cfsetispeed(&options,BAUDRATE);
                cfsetospeed(&options,BAUDRATE);
                tcsetattr(fd,TCSANOW,&options);
        }
        syslog(LOG_ERR,"comm_handler::open_port reports fd = %d",fd);
        return fd;
}
 
Old 03-09-2011, 03:15 PM   #17
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by wje_lq View Post
Oh! Well, then.

It turns out I have one of those. A US Robotics Courier. Once a month I use it to dial out to the National Bureau of Standards folks to find out what time it is. I wrote a C program which does this. As long as I was doing it, I wrote (inside the source file) a 950-line comment on how to program your modem in C. Can't hurt to give it a look-see, right?

For at least the next two weeks, you can get it here.
Cool. Grabbed a copy and am going through it now. Thanks alot!
 
Old 03-09-2011, 03:30 PM   #18
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
Now I'm gettting these in my syslogs...

Code:
 segfault at 2e ip 0000002e sp bfeceb80 error 4 in alarmd[8048000+11000]
"alarmd" is the name of the executable. I have no idea what anything else means.
 
Old 03-09-2011, 06:01 PM   #19
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Another thought. After you did the upgrade, did you reboot? Is it possible that some of the machinery that makes the serial port work is now out of sync with the kernel/driver/libraries, and needs a reboot to get things right again? That wouldn't explain why mionicom seems to be immune to the problem, but easy enough to try, even if it is a bit Windows-ish.

Pretty sure the 'ip' and 'sp' in your error message are the Instruction Pointer and Stack Pointer registers, respectively. You'd find those useful, I think, if you had a core dump to analyze.

--- rod.

Last edited by theNbomr; 03-09-2011 at 06:03 PM.
 
Old 03-10-2011, 08:10 AM   #20
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by theNbomr View Post
Another thought. After you did the upgrade, did you reboot? Is it possible that some of the machinery that makes the serial port work is now out of sync with the kernel/driver/libraries, and needs a reboot to get things right again? That wouldn't explain why mionicom seems to be immune to the problem, but easy enough to try, even if it is a bit Windows-ish.
I did reboot. It's part of the process of the installation and I did it again when I noticed the program had stopped working.

Quote:
Pretty sure the 'ip' and 'sp' in your error message are the Instruction Pointer and Stack Pointer registers, respectively. You'd find those useful, I think, if you had a core dump to analyze.
And if I had any clue what to do with them. Alas, my debugging skills are mediocre at best. If you have a pointer to where I might be able to learn some more, I'd appreciate it. I have googled but it looks a little like dark magic to me and I don't have a clue where to start.
 
Old 03-10-2011, 08:31 AM   #21
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Have you tried to build and run any other program? I wonder if your GCC installation is fried.
 
Old 03-10-2011, 09:14 AM   #22
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
I haven't, but I have a sneaking suspicion it may be a hosed library. At the moment I'm downgrading the machine to the last known good installation where the program worked. I have to get it running again. I'm wondering if it didn't have something to do with the upgrade procedure since both boxes were upgraded the same way. I may grab an old machine and do a fresh install of the new OS and see if my program will run on it.
 
Old 03-10-2011, 10:05 AM   #23
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Well, my only take on the IP & SP matter is that the IP is a very low value (0x2E). I don't know this for sure, but my hunch is that it is in code that is part of the C startup code, and executing before it has reached your C main() function. By extension of this logic, it would indeed point to a problem with the C startup code that may come from a shareable object library.

Did this problem start without having re-built your application, or did it work fine until after you re-built it? If the former, then it would seem also to point to a shared object library problem. Is it possible that there is a 64/32-bit aspect to the problem (ie ld.so finding the wrong version first, now, where it previously found the correct one first). If you run ldd against your compiled application, does it list any libraries that have changed since your upgrade? Any libs that exist in more than one location?

Sorry to be throwing ideas at you in a scattershot fashion. I'm just trying to open up some ideas for exploration.

--- rod.
 
Old 03-10-2011, 11:04 AM   #24
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by theNbomr View Post
Well, my only take on the IP & SP matter is that the IP is a very low value (0x2E). I don't know this for sure, but my hunch is that it is in code that is part of the C startup code, and executing before it has reached your C main() function. By extension of this logic, it would indeed point to a problem with the C startup code that may come from a shareable object library.

Did this problem start without having re-built your application, or did it work fine until after you re-built it? If the former, then it would seem also to point to a shared object library problem. Is it possible that there is a 64/32-bit aspect to the problem (ie ld.so finding the wrong version first, now, where it previously found the correct one first). If you run ldd against your compiled application, does it list any libraries that have changed since your upgrade? Any libs that exist in more than one location?
I rebuilt the application because it wouldn't stay running. I have run into this in the past with an operating system upgrade (it started with Slackware 7, I believe) and usually a recompile fixes it. I will run ldd and see what it says and also check for duplicate libraries.

Quote:
Sorry to be throwing ideas at you in a scattershot fashion. I'm just trying to open up some ideas for exploration.
Don't apologize. I appreciate any help you can give me. At this point I'm out of ideas, so even scattershot ones are more than welcome.
 
Old 03-10-2011, 12:42 PM   #25
tsg
Member
 
Registered: Mar 2008
Posts: 155

Original Poster
Rep: Reputation: 30
Downgrading the server worked. The application runs fine. Now to find out why.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"netstat -l" gives "segmentation fault" Earwig Linux - Newbie 2 03-31-2010 04:12 PM
/etc/rc.d/rc.sysinit: line 46: 819 Segmentation fault LC_ALL=C fgrep -q "/dev " /proc RMLinux Linux - Newbie 1 12-01-2008 02:53 AM
sunbird 0.3 does not start, error: Segmentation fault : "$prog" ${1+"$@"} polemon Ubuntu 8 01-08-2007 04:22 AM
why iam getting problems like "...too many files opened" or "segmentation fault" naren_0101bits Linux - Newbie 2 07-19-2004 12:20 PM
Writing to "/dev/usb/hiddev*" and to "/proc/bus/usb/00B/00S" throw an arror EI stpg Programming 0 07-14-2004 05:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration