-
Notifications
You must be signed in to change notification settings - Fork 13
Using gdb to debug the chiventure tests
If a test fails because of a crash or a segmentation fault, you can use gdb to pinpoint where the crash is happening. The first thing you'll need to do is to identify the exact test that is failing. To do this, you need to run a specific test program (not the ctest
program that is run by GitHub Actions). For example, if you wanted to run the Action Management tests, you would run this from inside the build/
directory (assuming you've already run cmake
and make
)
$ tests/action_management/test-action_management
If any of the tests fail, you will see something like this:
[----] /home/student/repos/chiventure/tests/action_management/test_item_item_actions.c:213: Unexpected signal caught below this line!
[FAIL] item_item_actions::wrong_kind_ITEM: CRASH!
The name of the test appears after [FAIL]
, except we'll need to replace ::
with /
. So the above test is actually item_item_actions/wrong_kind_ITEM
. To run only that test, we need to use the --filter
option, like this:
$ tests/action_management/test-action_management --filter "item_item_actions/wrong_kind_ITEM"
To actually debug the test, we need to tell Criterion that we want to run the test with GDB. Internally, Criterion will actually use the gdbserver
command we described in Homework #4.
$ tests/action_management/test-action_management --filter "item_item_actions/wrong_kind_ITEM" --debug=gdb --debug-transport=tcp:1234
NOTE: If you get an error that refers to tcp:1234: cannot resolve name: Temporary failure in name resolution
, you will need to run this before you run the tests:
TMP_HOSTS=$(mktemp); echo 'tcp localhost' > $TMP_HOSTS; export HOSTALIASES=$TMP_HOSTS
(you only need to run this once per terminal, not every time you want to run the test program)
If you run the tests with the --debug
and --debug-transport
option, the tests won't run right away and, instead, they will pause with the following message:
Listening on port 1234
NOTE: If you get an error that says Can't bind address: Address already in use.
, try choosing a number other than 1234
in the --debug-transport
option.
Now, in a separate terminal, run gdb
with the same test program. In this example, that would be the following:
$ gdb tests/action_management/test-action_management
Notice how we don't need to specify any other parameters. Once GDB starts, run the following:
target remote :1234
Followed by:
continue
The test will now run and, if it segfaults, GDB will tell you where the segfault is happening. If you're unsure of how to proceed from here, you may want to review the Micro Editor section of Homework #4.
-
Action Management
-
Battles
- Design Document
- Text Based Combat in Other Games
- User Stories
- Wishlist
- Battle Planning 2022
- Battle User Stories Review 2022
- Structs in Other Modules Related to Battles 2022
- Stat Changes Design Document
- Run Function Design Document
- CLI Integration Design Document
- Move Changes Design Document
- Unstubbing Stubs Design Document
- Battle Items and Equipment Design Document
- Battle Item Stats
- Battles Demo Design Document
- Battles Testing Moves, Items, and Equipment Design Document
- Sound integration with battle (design document)
-
Custom Actions
-
Custom Scripts
-
DSL
-
CLI
-
Enhanced CLI
-
Game-State
-
Graphics
- Design Plan
- Design document for integrating split screen graphics with chiventure
- GDL (Graphical Description Language)
- Graphics Sandbox
- Design Document for NPC Graphics and Dialogue
- Feature Wishlist (Spring 2021)
- Installing and Building raylib on a VM
- LibSDL Research
- Module Interactions
- Working with Raylib and SSH
- raylib
- GDL
-
Linking the Libzip and Json C to chiventure on CSIL machines
-
Lua
-
NPC
- Dependencies: Player class, Open world, Battle
- Action Documentation
- Design Document for NPC Generation in Openworld
- Design and Planning
- Establishing Dependencies
- Implementation of Custom Scripts
- Independent Feature: NPC Movement Design Document
- Player Interaction Design and Planning
- Dialogue
- Design Document for NPC Dialogue and Action Implementation
- Loading NPCs from WDL Files
- NPC Battle Integration Design Document
- NPC Battle Integration Changes Design Document
-
Open World
- Autogeneration and Game State
- Deciding an integration approach
- Designing approach for static integration into chiventure
- Feature Wishlist
- Generation Module Design layout
- Potential connections to the rest of chiventure
- Single Room Generation Module Design
- Source Document
- User Stories
- World Generation Algorithm Plan
- Loading OpenWorld Attribute from WDL
-
Player Class
-
Player
-
Quests
-
Rooms
-
Skill Trees
- Avoiding soft locks in skill tree integration
- Components of Exemplary Skill Trees
- Design Document and Interface Guide
- Environment interactions based on skill characteristics
- Integrating complex skill (combined, random, sequential, etc.) implementation
- Integration of a Leveling System
- Potential Integration with existing WDL
- Research on game balancing in regards to skill trees
- Research on skill tree support in modern day game engines
- SkillTree Wiki Summary
- Skilltree "effect" implementation and roadmap
- Summary of md doc file for skilltrees
- Design ideas in connection to other features
- Summary of Skill Tree Integration 2022
- The Difficulty of the Reading the World
- Complex Skills Summary
-
Sound
-
Stats
-
WDL