Author Topic: Need help with debugging new xatrix mod  (Read 2441 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: 15765
  • Help Destroy America: VOTE DEMOCRAT
    • View Profile
    • Focalor's Horrible Website: We Rape You Til The Room Stinks
  • 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: 1372
    • 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:

Costigan_Q2

November 11, 2024, 06:41:06 AM
"Stay cozy folks.

Everything is gonna be fine."

There'll be no excuses for having TDS after January 20th, there'll be no excuses AT ALL!!!
 

|iR|Focalor

November 06, 2024, 03:28:50 AM
 

RailWolf

November 05, 2024, 03:13:44 PM
Nice :)

Tom Servo

November 04, 2024, 05:05:24 PM
The Joe Rogan Experience episode 223 that dropped a couple hours ago with Musk, they're talking about Quake lol.

Costigan_Q2

November 04, 2024, 03:37:55 PM
Stay cozy folks.

Everything is gonna be fine.
 

|iR|Focalor

October 31, 2024, 08:56:37 PM

Costigan_Q2

October 17, 2024, 06:31:53 PM
Not activated your account yet?

Activate it now! join in the fun!

Tom Servo

October 11, 2024, 03:35:36 PM
HAHAHAHAHAHA
 

|iR|Focalor

October 10, 2024, 12:19:41 PM
I don't worship the devil. Jesus is Lord, friend. He died for your sins. He will forgive you if you just ask.
 

rikwad

October 09, 2024, 07:57:21 PM
Sorry, I couldn't resist my inner asshole.

Show 50 latest
Welcome, Guest. Please login or register.
November 21, 2024, 12:55:57 PM

Login with username, password and session length