Raised This Month: $51 Target: $400
 12% 

Nemod for Linux loads-- debugging


  
 
 
Thread Tools Display Modes
Author Message
Mattie
Veteran Member
Join Date: Jan 2005
Old 10-11-2005 , 23:04   Nemod for Linux loads-- debugging
#1

Edit: Thanks to showdax for his help on this.

-Mattie
Mattie is offline
Spinner
Member
Join Date: Nov 2004
Location: Michcigan
Old 10-11-2005 , 23:38  
#2

delete please
Spinner is offline
Spinner
Member
Join Date: Nov 2004
Location: Michcigan
Old 10-12-2005 , 00:00  
#3

please delete.
Spinner is offline
Spinner
Member
Join Date: Nov 2004
Location: Michcigan
Old 10-12-2005 , 00:19  
#4

(another useless post of mine)
Spinner is offline
showdax
Senior Member
Join Date: Dec 2004
Old 10-12-2005 , 07:29  
#5

Your plugin isn't making the engine search for server_i486.so like it does for fysh's version.

Here's strace output from your plugin loading:

Code:
open("../cstrike/addons/neomattie_i486.so", O_RDONLY) = 9
read(9, [data]", 512) = 512
fstat64(9, {st_mode=S_IFREG|0744, st_size=680842, ...}) = 0
old_mmap(NULL, 732664, PROT_READ|PROT_EXEC, MAP_PRIVATE, 9, 0) = 0x5e0000
old_mmap(0x665000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 9, 0x84000) = 0x665000
old_mmap(0x66f000, 146936, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x66f000
close(9)                                = 0
open("./tls/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/server_i486.so", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("./i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./mmx/server_i486.so", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("./server_i486.so", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("bin/tls/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/server_i486.so", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/local/lib/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 9
fstat64(9, {st_mode=S_IFREG|0644, st_size=43226, ...}) = 0
old_mmap(NULL, 43226, PROT_READ, MAP_PRIVATE, 9, 0) = 0xb31a1000
close(9)                                = 0
open("/lib/tls/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/server_i486.so", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/usr/lib/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
It has no idea where to find the shared object that you linked to. For some reason though, it's happy to look harder for fysh's plugin:

Code:
open("../cstrike/addons/serverplugin_nemod_i486.so", O_RDONLY) = 9
read(9, [data], 512) = 512
fstat64(9, {st_mode=S_IFREG|0755, st_size=1060335, ...}) = 0
old_mmap(NULL, 1060128, PROT_READ|PROT_EXEC, MAP_PRIVATE, 9, 0) = 0x8ee1000
old_mmap(0x8fb4000, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 9, 0xd2000) = 0x8fb4000
old_mmap(0x8fc1000, 142624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x8fc1000
close(9)                                = 0
open("./tls/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/server_i486.so", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("./i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./mmx/server_i486.so", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("./server_i486.so", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("bin/tls/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/tls/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("bin/server_i486.so", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/local/lib/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/tls/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/tls/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/tls/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/tls/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/i686/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/i686/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/mmx/server_i486.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("cstrike/bin/server_i486.so", O_RDONLY) = 9
read(9, [data], 512) = 512
fstat64(9, {st_mode=S_IFREG|0600, st_size=227492, ...}) = 0
close(9)                                = 0
mprotect(0x8ee1000, 864256, PROT_READ|PROT_WRITE) = 0
mprotect(0x8ee1000, 864256, PROT_READ|PROT_EXEC) = 0
write(1, "[NemoD] Loading interfaces\n", 27) = 27
write(1, "[NemoD] Interfaces loaded, Initializing commands\n", 49) = 49
write(1, "[NemoD] Commands initialized, finding server ConVars\n", 53) = 53
mmap2(NULL, 4213858304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 EINVAL (Invalid argument)
mmap2(NULL, 4213993472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 EINVAL (Invalid argument)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 30027 detached
That time it looked in the mod directory for it. I'm not sure why it does that for his and not yours, but maybe you should diff the source of both and see what difference is making it do that.

I made a symbolic link for server_i486.so to the engine's bin directory just to see if it would load then, and it did:

Code:
plugin_load ../cstrike/addons/neomattie
[NeoMattie Plugin (Nemod Lite)] Loading interfaces
[NeoMattie Plugin (Nemod Lite)] Interfaces loaded, Initializing commands
[NeoMattie Plugin (Nemod Lite)] Commands initialized, finding server ConVars
[NeoMattie Plugin (Nemod Lite)] ConVars found, hooking functions
[NeoMattie Plugin (Nemod Lite)] Functions hooked
Loaded plugin "../cstrike/addons/neomattie"
I've loaded it multiple times and haven't been able to get it to segfault just by loading. I haven't tested any of the features though. It does segfault when you shut down the server though:

Code:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218535296 (LWP 30234)]
0x012c5e25 in ConCommandBase::FindCommand ()
   from bin/engine_i686.so
(gdb) bt
#0  0x012c5e25 in ConCommandBase::FindCommand ()
   from bin/engine_i686.so
#1  0x011586cd in Cmd_ExecuteString ()
   from bin/engine_i686.so
#2  0x01158a76 in Cbuf_Execute () from bin/engine_i686.so
#3  0x01196bbe in _Host_RunFrame ()
   from bin/engine_i686.so
#4  0x0119731d in Host_RunFrame ()
   from bin/engine_i686.so
#5  0x0119f67c in CHostState::State_Run ()
   from bin/engine_i686.so
#6  0x0119f910 in CHostState::FrameUpdate ()
   from bin/engine_i686.so
#7  0x0119fa57 in HostState_Frame ()
   from bin/engine_i686.so
#8  0x011ef408 in CEngine::Frame ()
   from bin/engine_i686.so
#9  0x011eea5e in CDedicatedServerAPI::RunFrame ()
   from bin/engine_i686.so
#10 0x00520682 in RunServer () from bin/dedicated_i686.so
#11 0x00520905 in CDedicatedAppSystemGroup::Main () from bin/dedicated_i686.so
#12 0x0055d352 in CAppSystemGroup::Run () from bin/dedicated_i686.so
#13 0x0055d352 in CAppSystemGroup::Run () from bin/dedicated_i686.so
---Type <return> to continue, or q <return> to quit---
#14 0x00520cff in main () from bin/dedicated_i686.so
#15 0x0804903d in main ()
But I don't think you should be giving away money, I think you should keep the source to the plugin public.
showdax is offline
Send a message via MSN to showdax
Mattie
Veteran Member
Join Date: Jan 2005
Old 10-12-2005 , 09:09  
#6

Code:
Your plugin isn't making the engine search for server_i486.so like it does for fysh's version.
Well, this wasn't true from my testing. In fact, I didn't even need the server link initially. I added that later to see if I could match his ldd output 100%.

My straces look so different from yours. Mine never appears to search for dependencies before failing.

I'll see if creating the symbolic link helps on my machine, though.

Thanks for the fresh perspective,
-Mattie
Mattie is offline
showdax
Senior Member
Join Date: Dec 2004
Old 10-12-2005 , 09:21  
#7

Quote:
Originally Posted by Mattie
Well, this wasn't true from my testing. In fact, I didn't even need the server link initially. I added that later to see if I could match his ldd output 100%.
How would anything in the plugin even work if it didn't link? It uses tons of symbols from the server binary. It doesn't scan memory under Linux to find objects and functions from the server binary, at least from what I could tell.

Edit: Posting your strace logs would be helpful.
showdax is offline
Send a message via MSN to showdax
Mattie
Veteran Member
Join Date: Jan 2005
Old 10-12-2005 , 09:47  
#8

Quote:
Originally Posted by showdax
Your plugin isn't making the engine search for server_i486.so like it does for fysh's version.
I linked against a relative directory structure of "cstrike/bin". I'm not certain how he adds the search path to automatically check there, but I'm hard-coding the relative path for now since it gets it loading.

Thanks for your help, showdax. I tried hours of different link options and ldd viewing. When I strace'd before, I wasn't linking against server_i486.so, so it must have been choking on the missing symbols while loading (and either strace doesn't show that or I misunderstood it).

Thanks, again.
-Mattie
Mattie is offline
showdax
Senior Member
Join Date: Dec 2004
Old 10-12-2005 , 11:36  
#9

Here's what I would put in your Makefile:

Code:
SRCDS = /absolute/path/to/srcds

# ...

all:
	# existing commands
	ln -sf $(SRCDS)/cstrike/bin/server_i486.so server_i486.so
	# your $(MAKE) command
I don't know if that'll make the engine search in the mod dir though, but at least it'll link properly and you won't have undefined symbols.
showdax is offline
Send a message via MSN to showdax
Mattie
Veteran Member
Join Date: Jan 2005
Old 10-12-2005 , 11:52  
#10

Quote:
Originally Posted by showdax
Here's what I would put in your Makefile:

Code:
SRCDS = /absolute/path/to/srcds

# ...

all:
	# existing commands
	ln -sf $(SRCDS)/cstrike/bin/server_i486.so server_i486.so
	# your $(MAKE) command
I don't know if that'll make the engine search in the mod dir though, but at least it'll link properly and you won't have undefined symbols.
The binary already linked against the .so previously, so I'm not sure what you're recommending. (I just hadn't again strace'd since I began linking against server_i486.so.)

Now I'm using a copy rather than a symbolic link, but I'm linking it from the relative cstrike/bin location and this path is being mirrored in ldd as the load path for it when loads into srcds. As a result, it appears to load just fine now. I just need to begin debugging the crashes it causes (for me it dies very early).

Thanks again for your help. I've sent you a PM.
-Mattie
Mattie is offline
 



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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode