public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kranasian Soul X (RDX4)" <kranasian_soul@excite.com>
To: help-gcc@gnu.org, help@gnu.org
Cc: dctd@mudspring.uplb.edu.ph
Subject: Help, Weird GCC behavior
Date: Sun, 04 Mar 2001 01:39:00 -0000	[thread overview]
Message-ID: <10264606.983698734507.JavaMail.imail@bessie.excite.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2901 bytes --]

To all experts in GCC memory allocation,

Please help me... 

My thesis is having problems.  I have been pain-stakingly building a
Civ-like Game Server Platform for online gaming.  I have tried a lot of
memory debuggers but after weeks of debugging, I have found out that the
souce of the Segmentation fault is a return() statement.  What could
possibly occur in a return statement that would cause a segmentation fault? 
I used MALLOC_CHECK_=1 flag to try to see if it is related to malloc and it
displays

malloc(): top chunk corrupt
realloc(): not a valid ptr 0xXXXXXX

I don't know what could possibly cause an error in my return statement when
the return line in a function is

	return(Return);

nothing different with this one since i have been using Return as a return
variable by convention.  I have attached my Server Files with this email. 
Please help.


Detail:
The data structures in the Game Server has become quite complex for an easy
explaination but if the tar file will be extracted, all files needed for the
Server be there.  Just in case you want to see the error for yourself...
please, extract the attachment compile it with these options (At least I
do).

gcc -oGameServer -lm -lncurses -lpthread GameServer.c

Execute GameServer and say "Y" to the prompt. and press two returns or
ENTER.  It will put the server online.  It will listen to port 4621.  The
SIGSEGV will not arise until the third connection. (Why?)
To establish a connection:

telnet <Game HOST> 4621

when connected:  (the server will respond with a connection) type

N<TAB><username><TAB><password><TAB><Name><ENTER>

<TAB> -> must be a single tab as a delimiter
<ENTER> -> the carriage return
<username> -> any name (max 8 chars)
<password> -> any password (max 15 chars)
<Name> -> any name (max 20 chars)

The letter N stands for New Player.  It is included.

try doing this with different usernames for 3 times.  A SIGSEGV will arrise.


To help you (and me) locate the source of the problem, every connection task
displays the status.  The last display before the SIGSEGV is four "+"
plusses "++++" which is printed before the return(Return); statement.  This
function is located in MapQueryRoutines.c under GetSightChunk().  see
print("++++");
The function call process starts with:

ThreadNewConnection() in file TNewConnection.c calls
CreateBase() in file PlayerRoutines.c calls
NotifyTileChange in file APlayerRelations.c calls
GetSightChunk in file MapQueryRoutines.c
  ^- where the error occurs.

I don't know if the fault is with me.  As I think it is.  any clue?

Thank you very, very much for reading up to this part.


Greatest Thanks,

Dan Cedric Delima
Kranasian Soul X


"Articulus Primus Dalestini Conquerum Hex"
"Altari Motif Art Tagoni"
"Soldevi solembe"





_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/


[-- Attachment #2: gameserver.tar.gz --]
[-- Type: application/x-gzip, Size: 38435 bytes --]

             reply	other threads:[~2001-03-04  1:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-04  1:39 Kranasian Soul X (RDX4) [this message]
2001-03-05 10:42 jlw

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=10264606.983698734507.JavaMail.imail@bessie.excite.com \
    --to=kranasian_soul@excite.com \
    --cc=dctd@mudspring.uplb.edu.ph \
    --cc=help-gcc@gnu.org \
    --cc=help@gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).