Author Topic: Need help with debugging new xatrix mod  (Read 1476 times)

Offline SquiSHeR

  • Full Member
  • ***
  • Posts: 127
  • test
    • View Profile
  • Rated:
Need help with debugging new xatrix mod
« on: April 03, 2017, 09:30:02 AM »
Hello friends,

currently I am working on adding xatrix multiplayer code to the openffa mod by skuller in order to get a nice new xatrix game library for ffa. I doubt there are any xatrix players out there at the moment, but hopefully this way I can motivate ffa-server admins to add this gametype to their ffa games.

Unfortunately I have no c programming language knowledge (I write PHP code most of the time).

Nevertheless I managed to sucessfully merge the 3.20 xatrix gamelib code to the openffa code so that it even compiles without errors - yay :). It was quite hard for me since skuller modified a lot code which deals with items and especially weapons - I had to readapt this changes onto the xatrix code aswell.
Xatrix items are displayed, can be picked up and the weapons seem to fire correctly. The only issue is with traps. Once I throw a trap and jump right into it, the server crashes with a memoryaccess error (no more details given).

Could someone of the more experienced Q2 mod developers help me with debugging? I have absolutely no idea how to debug a c library crashing issue. How can I get more informatin about the source of the error?

My current working state is available on github: https://github.com/Niehztog/openffa

Once I managed to fix this bug I plan to merge in more changes, first the 3.24 xatrix gamelibrary changes by knightmare and later even the q2plus/tastyspleen additions especially for ionripper and traps. This would make openffa a fully qualified alternative to the quake2plus implementation.

My motivation is to bring more attention to the mission packs. I think there is no reason to not have them in the baseq2 main gamelibrary code, since everybody has them, they add nice new variety to items, gameplay-style and weapons and they contain no new playing-modes which would justify excluding them to mod-subdirectories.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline |iR|Focalor

  • Irrepressibly Profuse Member
  • *
  • Posts: 14262
  • OFFO
    • View Profile
    • Focalor's Lair @ Tastyspleen.net
  • Rated:
Re: Need help with debugging new xatrix mod
« Reply #1 on: April 03, 2017, 11:48:30 AM »
Debugging? This looks like a job for... CAPTAIN SMARTASS!!!  ;D

<span data-s9e-mediaembed="youtube" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" scrolling="no" style="background:url(https://i.ytimg.com/vi/GihPc3PUorw/hqdefault.jpg) 50% 50% / cover;border:0;height:100%;left:0;position:absolute;width:100%" src="https://www.youtube.com/embed/GihPc3PUorw"></iframe></span></span><br /><a href="https://www.youtube.com/v/GihPc3PUorw" target="_blank" class="new_win">https://www.youtube.com/v/GihPc3PUorw</a>

But seriously... Yes, there are still a few Xatrix players. I dunno if he still gets online much, but Exterminader used to have a Xatrix server he rented from Quadz, dunno if he still does. But him, Debbie, and several others used to get on nightly for some Xatrix playing, and sometimes I'd swing through for a few maps if they were on. I'd certainly play it more if I saw other people were on.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline SquiSHeR

  • Full Member
  • ***
  • Posts: 127
  • test
    • View Profile
  • Rated:
Re: Need help with debugging new xatrix mod
« Reply #2 on: April 05, 2017, 07:00:49 AM »
I figured it out after hours of googling and watching debugging turorials  ;D

I installed gdb on my dev machine and started the game with
Code: [Select]
gdb --args r1q2ded +set dedicated 1 +set game xatrix +set ip localhost +set port 27910 +exec server.cfg

then I told gdb where to look for the openffa source files and started the game
Code: [Select]
dir /home/devuser/openffa
run

Then after the crash happened I could clearly see some really helpful information
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff66be73e in ClientObituary (inflictor=<optimized out>,
    attacker=<optimized out>, self=<optimized out>) at p_client.c:347
347             self->client->resp.frags[frag].suicides++;

the crash is fixed now  ;D

I could use some help with testing though...
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

Offline QwazyWabbit

  • Carpal Tunnel Member
  • ******
  • Posts: 1300
    • View Profile
  • Rated:
Re: Need help with debugging new xatrix mod
« Reply #3 on: April 06, 2017, 04:54:12 PM »
I'll try to test on my PC and on my Linux but I don't care much for gdb. I'm so old and experienced and spoiled with visual studio that I'm useless on gdb.

Regarding debugging, the makefile in that repo is pretty tight and seems to be geared for optimization and release more than development. Remove the -fvisibility=hidden switch in line 30 and I think you'll see more symbols in the debugger. In line 22, consider also changing -O2 to -Og to prevent compiler optimization from screwing up the debugger. Processors these days are fast enough that you shouldn't see performance problems and you can change it back to O2 for your active servers.

Segmentation faults usually mean you've dereferenced a NULL pointer (very common in Q2 code) or a pointer that's pointing to something it shouldn't. This usually means the function that faulted was passed a bad pointer when it was called and you can trace up the call stack to see which function called it. Whether that means you have defend against it in the callee or not pass the bad argument in the caller will depend on what you see in the debug.
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus

 

El Box de Shoutamente

Last 10 Shouts:

 

[BTF]Fatknitty

October 28, 2020, 06:54:07 AM
them bots r back on DM...  please send help fast!
 

Admin

October 26, 2020, 11:12:00 AM
Ban list updated.

otg

October 26, 2020, 08:58:27 AM
there are bots back spam chatting and taking up slots. please fix!
 

|iR|Focalor

October 24, 2020, 02:23:53 PM
 

adz1La

October 18, 2020, 12:05:02 AM
 ;)
 

|iR|Focalor

October 10, 2020, 11:35:41 PM
 

beaver{KEA}

October 07, 2020, 06:16:38 PM
6V6+ ON RA2 NOW

pepp5

October 06, 2020, 03:19:43 PM
My standard way of encouraging people to quit farting around and start the match:  Eddie Van Halen up.  RIP EVH.
 

quadz

October 06, 2020, 01:17:03 PM
R.I.P. Eddie Van Halen :(
 

Admin

September 23, 2020, 09:43:07 AM
It's the same VPN-using misanthrope who's been at this for months. Recently switched to sending private messages.

Show 50 latest
Welcome, Guest. Please login or register.
October 30, 2020, 10:09:17 AM

Login with username, password and session length