I need help finding cause of the segmentation fault in my server.c.
I've been using gdb line by line for this pset and I finally think I can use it. However, it reports the seg fault at the line 130 which is the reset() function.
// accept connections one at a time
while (true)
{
// reset server's state
reset();
// wait/(block (am) until client is connected
if (connected())
{ etc...
- which of course is not code that I wrote, but comes with the file given to us.
I realize it will be caused by my code, but how can I find the problem when it only reports an issue with this line?
I've run valgrind and it actually says I have no leaks and no errors. Although, does Valgrind actually work for server.c if not running it with telnet etc?
Please tell me how you'd like me to upload my code... I've stepped through almost line by line with gdb and my variables seem to all be correct. Sometimes gdb has my query variable optimized out - so maybe the issue is there - but the pointers to the query value seem to be all correct. I don't know the way around finding a variable value if gdb decides to optimise out...
Thanks very much in advance. I have spent days and days on this pset and I just can't solve this myself.