Making a thread to harvest suggestions. Any help is appreciated.
Original system is a 32-bit Fedora Core 5 box. New system is a 64-bit Debian install. It's an Intel Core2Duo running kernel 2.6.18-6-amd64, x86_64.
Our code is somewhat custom but primarily the same as project-eqemu trunk, last changelog March 23rd 09.
Old gcc version is 4.1.2 (20070502), new gcc version is gcc 4.1.2 (20061115, prerelease, fair enough debian is cautious).
We brought our source tree over to the new machine and immediately tackled these issues:
Code:
../common/TCPConnection.cpp: In member function `bool TCPConnection::GetSockName(char*, uint16*)':
../common/TCPConnection.cpp:148: error: cannot convert `size_t*' to `socklen_t*' for argument `3' to `int getsockname(int, sockaddr*, socklen_t*)'
- Had to modify common/TCPConnection.cpp to force addrlen variable to type of socklen_t* instead of size_t*
- Modifying makefiles to use -march=nocona instead of -march=i686, removed compile flags -DI386. ( gcc <= 4.3 doesn't have the core2 arch and nocona was suggested
here )
Behavior:
./zone - Segfaults.
GDB:
Code:
GNU gdb 6.4.90-debian
This GDB was configured as "x86_64-linux-gnu".
(gdb) file zone
Reading symbols from /home/eqemu/eqemu/zone...done.
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /home/eqemu/eqemu/zone
[Thread debugging using libthread_db enabled]
[New Thread 47341244287360 (LWP 28527)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47341244287360 (LWP 28527)]
0x00002b0e7d77f580 in strlen () from /lib/libc.so.6
(gdb) bt
#0 0x00002b0e7d77f580 in strlen () from /lib/libc.so.6
#1 0x00002b0e7d751560 in vfprintf () from /lib/libc.so.6
#2 0x0000000000519f57 in EQEMuLog::write (this=0x837de0, id=Debug, fmt=0x6ac522 "Starting Log: %s")
at ../common/debug.cpp:160
#3 0x00000000005197b4 in EQEMuLog::open (this=0x837de0, id=Debug) at ../common/debug.cpp:111
#4 0x0000000000519ab8 in EQEMuLog::writePVA (this=0x2d2d2d2d2d2d2d2d, id=Debug, prefix=0x7fff2df9a8c0 "[RULES__CHANGE] ",
fmt=0x6e0fb8 "Resetting running rules to default values", argptr=0x7fff2df9a9e0) at ../common/debug.cpp:190
#5 0x000000000065451e in log_messageVA (type=<value optimized out>,
fmt=0x6e0fb8 "Resetting running rules to default values", args=0x7fff2df9a9e0) at ../common/logsys_eqemu.cpp:37
#6 0x00000000006545b2 in log_message (type=757935405, fmt=0x6ac522 "Starting Log: %s") at ../common/logsys_eqemu.cpp:28
#7 0x0000000000652b97 in RuleManager::ResetRules (this=0x8aab50) at ../common/rulesys.cpp:170
#8 0x0000000000653653 in RuleManager (this=0x8aab50) at ../common/rulesys.cpp:96
#9 0x00000000004b57d6 in __static_initialization_and_destruction_0 (__initialize_p=<value optimized out>,
__priority=<value optimized out>) at net.cpp:120
#10 0x00000000004b5810 in global constructors keyed to spells_loaded () at net.cpp:1370
#11 0x0000000000694696 in __do_global_ctors_aux ()
#12 0x00000000004672bb in _init ()
#13 0x0000000000693a60 in Raid::DisbandRaid ()
Previous frame inner to this frame (corrupt stack?)
Juicy bit in frame #2, EQEMuLog::write():160
Code:
(gdb) list 140,165
140 fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
141 #else
142 fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
143 #endif
144
145 va_list argptr;
146 va_start(argptr, fmt);
147 if (dofile)
148 vfprintf( fp[id], fmt, argptr );
149 if(logCallbackFmt[id]) {
150 msgCallbackFmt p = logCallbackFmt[id];
151 p(id, fmt, argptr );
152 }
153 if (pLogStatus[id] & 2) {
154 if (pLogStatus[id] & 8) {
155 fprintf(stderr, "[%s] ", LogNames[id]);
156 vfprintf( stderr, fmt, argptr );
157 }
158 else {
159 fprintf(stdout, "[%s] ", LogNames[id]);
160 vfprintf( stdout, fmt, argptr );
161 }
162 }
163 va_end(argptr);
164 if (dofile)
165 fprintf(fp[id], "\n");
Segfault in vprintf(), doh.
This bug report for Debian suggests:
Quote:
You are missing a #include <string.h>. And don't forget to always build with -Wall.
|
However, debug.cpp where EQEMuLog::write() is located already includes string.h (line 6).
Going ahead and posting this for assistance, but still researching the issue with vprintf and whatnot. Might be a dead-end or not, we'll see.
Thanks for any help, all.