Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
f1244846
Commit
f1244846
authored
5 months ago
by
Simon McVittie
Browse files
Options
Downloads
Patches
Plain Diff
slr-for-game-developers: Improve examples of how to set up gdbserver
Signed-off-by:
Simon McVittie
<
smcv@collabora.com
>
parent
54c7969d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#109126
passed
5 months ago
Stage: build
Stage: relocatable-install
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/slr-for-game-developers.md
+37
-3
37 additions, 3 deletions
docs/slr-for-game-developers.md
with
37 additions
and
3 deletions
docs/slr-for-game-developers.md
+
37
−
3
View file @
f1244846
...
@@ -893,7 +893,19 @@ but it does contain `gdbserver`, a `gdb` "stub" to which a full debugger
...
@@ -893,7 +893,19 @@ but it does contain `gdbserver`, a `gdb` "stub" to which a full debugger
can be connected.
can be connected.
To use
`gdbserver`
, either run it from an interactive shell in the
To use
`gdbserver`
, either run it from an interactive shell in the
container environment, or add it to your game's command-line.
container environment, or add it to your game's command-line
(perhaps via a wrapper script).
For example, instead of
```
$ ./my-game-executable $game_options
```
you could run
```
$ gdbserver 127.0.0.1:12345 ./my-game-executable $game_options
```
<details><summary>
Example for non-Steam games
</summary>
<details><summary>
Example for non-Steam games
</summary>
...
@@ -911,8 +923,30 @@ $ /path/to/steamlibrary/steamapps/common/SteamLinuxRuntime_sniper/run \
...
@@ -911,8 +923,30 @@ $ /path/to/steamlibrary/steamapps/common/SteamLinuxRuntime_sniper/run \
Alternatively, some games' launch scripts have a way to attach an external
Alternatively, some games' launch scripts have a way to attach an external
debugger given in an environment variable, such as
`GAME_DEBUGGER`
in
debugger given in an environment variable, such as
`GAME_DEBUGGER`
in
several Valve games, including the
`dota.sh`
script that launches DOTA 2.
several Valve games, including the
`dota.sh`
script that launches DOTA 2.
For games like this, export an environment variable similar to
If your game runs via a wrapper script, implementing the same pattern
`GAME_DEBUGGER="gdbserver 127.0.0.1:12345"`
.
seen in DOTA 2 is a convenient way to provide debugger integration.
For example:
```
#!/bin/sh
# my-game.sh
set
-e
# ... any other setup you want can go here ...
set
--
./bin/my-game
"
$@
"
if
[
-n
"
${
GAME_DEBUGGER
-
}
"
]
;
then
set
--
$GAME_DEBUGGER
"
$@
"
fi
exec
"
$@
"
```
For games that implement this pattern,
export an environment variable similar to
`GAME_DEBUGGER="gdbserver 127.0.0.1:12345"`
to enable the
`gdbserver`
.
When
`gdbserver`
is used like this, it will pause until a debugger is
When
`gdbserver`
is used like this, it will pause until a debugger is
attached.
attached.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment