It/Installing and Debugging the Source Code: Difference between revisions
< It
Jump to navigation
Jump to search
(Created page with "{{otherlang2| | jp = Installing and Debugging the Source Code:jp | es = Installing and Debugging the Source Code:es | fr = Installing and Debugging the Source Code:fr | ru = I...") |
No edit summary |
||
Line 9: | Line 9: | ||
== Installing == | == Installing == | ||
# Avvia il [[Source SDK]] e scegli "Create Mod". Guarda [[Create a Mod]] per più informazioni. | # Avvia il [[Source SDK]] e scegli "Create Mod". Guarda [[Create a Mod|Creare una mod]] per più informazioni. | ||
# [[Compiler Choices|Scegli un compiler]] | # [[Compiler Choices|Scegli un compiler]] | ||
# Inizia con la [[Your First Entity|Tua prima entitá]]. | # Inizia con la [[Your First Entity|Tua prima entitá]]. | ||
Per compilare il tuo codice con Linux, guarda [[Compiling under Linux|Compilare con Linux]]. | Per compilare il tuo codice con Linux, guarda [[Compiling under Linux|Compilare con Linux]]. Per ottenere il codice più recente guarda [https://github.com/ValveSoftware GitHub]. | ||
== Debugging == | == Debugging == | ||
'''Debugging' | '''Debugging' é il processo di una persona che osserva il funzionamento del Programma. Può rivelare il motivo di crash e bug. | ||
=== Windows === | === Windows === | ||
# | # Sii sicuro che stai lavorando con la configurazione Debug, anziche Release. | ||
# | # Nella Solution Explorer (Microsoft Visual C++), fai tasto destro sul progetto attivo (quello col grassetto) e scegli "Properties". Non importa se stai lavorando con il server o col client. | ||
# | # Nella finestra che appare scegli "Debugging". | ||
# Change ''Command'' to the path to the .exe file you want to launch (the same on that runs when you play the game/mod in question, e.g. <code>C:\Steam\SteamApps\common\source sdk base 2007\hl2.exe</code>). | # Change ''Command'' to the path to the .exe file you want to launch (the same on that runs when you play the game/mod in question, e.g. <code>C:\Steam\SteamApps\common\source sdk base 2007\hl2.exe</code>). | ||
# Change ''Command Arguments'' to read something like <code>-allowdebug -dev -sw -game "C:\Steam\SteamApps\SourceMods\MyMod"</code> | # Change ''Command Arguments'' to read something like <code>-allowdebug -dev -sw -game "C:\Steam\SteamApps\SourceMods\MyMod"</code> |
Revision as of 17:37, 1 March 2019
Installing
- Avvia il Source SDK e scegli "Create Mod". Guarda Creare una mod per più informazioni.
- Scegli un compiler
- Inizia con la Tua prima entitá.
Per compilare il tuo codice con Linux, guarda Compilare con Linux. Per ottenere il codice più recente guarda GitHub.
Debugging
Debugging' é il processo di una persona che osserva il funzionamento del Programma. Può rivelare il motivo di crash e bug.
Windows
- Sii sicuro che stai lavorando con la configurazione Debug, anziche Release.
- Nella Solution Explorer (Microsoft Visual C++), fai tasto destro sul progetto attivo (quello col grassetto) e scegli "Properties". Non importa se stai lavorando con il server o col client.
- Nella finestra che appare scegli "Debugging".
- Change Command to the path to the .exe file you want to launch (the same on that runs when you play the game/mod in question, e.g.
C:\Steam\SteamApps\common\source sdk base 2007\hl2.exe
). - Change Command Arguments to read something like
-allowdebug -dev -sw -game "C:\Steam\SteamApps\SourceMods\MyMod"
- Change Working Directory to the folder containing the .exe you chose for Command e.g.
C:\Steam\SteamApps\common\source sdk base 2007
.
You can now press F5 at any time to start debugging. (If you really do want to debug in Release mode, repeat the above for that configuration. But don't expect the results to be very useful).
The paths will be unique to the version of the SDK being used. For example, with Source SDK 2013, the settings for a single player mod might be:
Command: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\hl2.exe Command Arguments: -allowdebug -dev -sw -condebug -console -toconsole -game "C:\My_Mod\source-sdk-2013\sp\game\mod_hl2" +map my_map Working Directory: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\

Run-time attachment
If you want to debug a process that is already running, choose Debug > Attach to Process... and select it from the list.
Linux
- Disable OPTFLAGS in the root makefile
- Uncomment DEBUG in your project's makefile.
Confermare:Change it to read
-O0 -g -ggdb3
. - Make and Install
- Open a terminal window and cd to the location of the executable you are running
- Perform
gdb srcds_linux
(or whatever the name is) - Perform
run <parameters>
to start the program
- On a crash ("segfault"), do
bt
("backtrace") to see the callstack. - To break into the debugger, press Ctrl+C; to continue afterwards perform
cont
. - To set a breakpoint, do
break <function>
. Seehelp breakpoint
for more details. - To print an expression, do
print <expr>
.