You are here:

C/va_start compiled with Linux

Advertisement


Question
I fixed my va_list problem.
so I have a new question for you.
I compiled my c program that creates a Q and uses IPC to put a message in a given Q to be picked up by another module. when I run it in RH-Linux I get segmentation error. like:
[2]+  Segmentation fault      /dev/unix_c_dev/qm/qt/mar
Segmentation fault

how can I find out more about it, to debug it, etc?
regards,
Montana.



-------------------------
Followup To
Question -
can you answer a RedHat Linux compile error on a C code regarding va_start(va_list pt, msg)?
regards,
Montana
Answer -
If you can post the error, I can try to answer it:-)

Answer
Most of the segmentation fault are because of faulty usage of pointers.
If you are getting a core file, you can use it to get the stack trace and see where it got the signal.
Otherwise, compile your code with -g option and then use gdb to run it.
If you do stepping, you will hit the line where it is getting the seg-fault.
Check the values of pointers and other variables at that place! Definitely there will be some problem, which you can find out:-)
It will help you to correct the problem.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.