Debugging w FTE

Contents:

Poking and watching variables
emulating ping
using addr2line
intentional crashes for analysis
unintentional CRASHES - The Stack Trace
Using GDB
How to run multiple clients on one machine

POKING AND WATCHING

1. set sv_cheats to ‘1’

2. To get a complete list (dump) of current entities, (as well as globals) with all their variables:
‘savegame foo’ (this saves a text file called ‘modname/saves/foo.lvc’) [Spoike: I’d suggest the savegame_legacy command due to it being a simpler format, but meh, deathmatch mod.]

3. open foo.lvc and, and find the number of the entity you want to watch

4. To get 1 entitys fields

poke_ssqc 1.netname

poke_ssqc 1.lefty

watchpoint_ssqc 1.velocity

watchpoint_ssqc 1.current_way.origin

poke_ssqc 203.current_way.origin
poke_ssqc 203.classname

watchpoint_ssqc 209.origin

watchpoint_ssqc 2.health

OMC: ok, I thought that to (realistically) do watchpoint_ssqc if you need number of the entity you want to watch: http://www.attackersgored.com/?p=2028
or just save that entity off into a global so that you can watch that – a bit like self.

GET INFO ON AN ENTITY BY POINTING TO IT

r_showfields 1

WATCHING A CVAR

Spoike: there’s a -watch <cvar> commandline arg you can use to print when cvars change values.

============

to emulate ping:

sv_minping 300

net_fakeloss 0.25

========

addr2line

addr2line – used to convert a memory address to  the file names and line number in the engine code

Client crashing windows

  1. run the debug client, lets call it ‘foo.exe’
  2. make it crash
  3. In MINGW64: go to the folder containing foo.exe
  4. $ addr2line -e foo.exe -f
  5. On the next line paste the (clipboarded) output
  6. Copy the output of addr2line
  7. send to Spike

===============

intentional crashes

Debugging AGR Server (Linux)

  1. run debug build
  2. +developer 1 and turn OFF -nodumpstack
  3. put abort(); where the weird condition happens
  4. make it crash, get the output, which should look somethign like this:

Error: signal SIGABRT:
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcf)[0x7fd0f3fc1fff]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7fd0f3fc342a]
./fteqw-code/engine/debug/fteqw-sv(+0x69cd3)[0x5648b489bcd3]
./fteqw-code/engine/debug/fteqw-sv(+0x6804d)[0x5648b489a04d]
./fteqw-code/engine/debug/fteqw-sv(+0x1524c4)[0x5648b49844c4]
./fteqw-code/engine/debug/fteqw-sv(+0x15224f)[0x5648b498424f]
./fteqw-code/engine/debug/fteqw-sv(+0x146131)[0x5648b4978131]
./fteqw-code/engine/debug/fteqw-sv(+0x146057)[0x5648b4978057]

5. AT the console (FTE server is not running, we just crashed it , remember?) run addr2line (to translate those addresses to the relevant function names), using the info between the (), after the ‘abort’ line, eg (based on the above output):

addr2line -f -e ./fteqw-code/engine/debug/fteqw-sv 0x69cd3 0x6804d 0x1524c4 0x15224f 0x146131 0x146057

6. This will output the function names

DEBUGGING CRASHES – The Stack Trace

Open ssqccore.txt. This file contains the last thread before the crash, multiple functions, followed by a list of globals, followed by the entity list, and the list of every .variable and their values (if the value is non zero).

GDB

  1. run MSYs264
  2. navigate to the dir of the exe
  3. at the command line:

gdb -ex=r --args fteqw64.exe -game fortress -nohome +map mmap34h -basedir C:/AGR

MISCELLANEOUS (NOT SURE *EXACTLY* WHAT THESE DO)

+set worker_count 0

MULTIPLE CLIENTS ON ONE MACHINE

`cl_splitscreen 3` adds 3 additional players (aka: seats)

how do you switch bertween players?

http://fte.triptohell.info/wiki/index.php/Cl_splitscreen

in_forceseat 1-4

csqc owns the screen. there’s still only one instance of your csprogs.dat running so if your csqc is drawing only one screen then only one screen you get. adding support for the other seats is a little annoying, but can also help with mvd playback too; if you plug in multiple keyboards+mice+gamepads then those additional input devices are meant to automatically control the other seats, but you can also bind stuff eg `bind kp_uparrow +p2 forward` or whatever that key name was; but yeah, `bind f1 in_forceseat 1` etc is usually enough for testing purposes.

Nov 08 23:59:44 btw using cl_splitscreen ‘does something’ to my ‘0’ key
Nov 09 00:00:04 o.O
Nov 09 00:00:10 it eats it?
Nov 09 00:00:11 that’s interesting
Nov 09 00:00:24 what’s its binding?
Nov 09 00:00:26 ie when at menu, 0 is ignored
Nov 09 00:01:15 ok 1st player is fine
Nov 09 00:01:41 bind 0 “impulse 10”
Nov 09 00:01:45 ie normal
Nov 09 00:01:55 ie i switched to forceseat 2
Nov 09 00:02:55 ah switched back to forceseat 1, 0 is gone here too now
Nov 09 00:03:29 o.O
Nov 09 00:03:54 hmm.. and now when i type “bind”
Nov 09 00:04:07 the console autocompletes “bind ALT”
Nov 09 00:04:18 sry
Nov 09 00:04:20 i mean
Nov 09 00:04:29 now when i type “bind”
Nov 09 00:04:47 when you press ‘space’, the console autocompletes with “bind ALT”
Nov 09 00:05:20 also
Nov 09 00:05:23 “Bad user command: 5”
Nov 09 00:06:02 forcing the seat too high? :/
Nov 09 00:06:51 no im still within 1-3
Nov 09 00:07:56 ah, theres a forceseat 0
Nov 09 00:11:39 hmmm 8 and 9 dont work either
Nov 09 00:11:57 1-7 are fine
Nov 09 00:12:25 in case its relevant, 1-7 are menu options, 8 prev screen, 9 next screen, 0 is ‘done’
Nov 09 00:12:54 ugh not ‘screen’, lemme rephrase
Nov 09 00:13:06 in case its relevant, 1-7 are menu options, 8 prev menu, 9 next menu, 0 is ‘done’
Nov 09 00:15:01 cl_weaponpreselect 0?

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>