[Debug] Confine GDB breakpoint stops to the world thread#3
Open
r-log wants to merge 1 commit into
Open
Conversation
Breakpoint call sites in WorldSocket (ACE network threads) and DatabaseMysql (DB worker thread) could drive EnterStop off the world thread, racing the unguarded RSP state and never actually pausing the world. Latch the world thread id on the first OnWorldUpdate tick and reject EnterBreak from any other thread (the hit is already counted). The same foreign sites also reached GdbBp::Matches / Hit before that guard, racing g_entries (std::vector) against Arm/Disarm on the world thread and incrementing a non-atomic g_hits. Serialise g_entries with a mutex and make g_hits atomic; correct the stale "needs no locking" note.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the review on mangoszero#406 — merge this into your
masterand it lands in the PR.Confines the GDB breakpoint cooperative stop to the world thread, closing the two races from the review:
WorldSocket(ACE net threads) andDatabaseMysql(DB worker) could driveEnterStopoff the world thread, racing the unguarded RSP state so the world never actually pauses. Latch the world thread id on the firstOnWorldUpdatetick (correct spot —Init()runs on main, before the world thread starts) and rejectEnterBreakfrom any other thread; the hit is already counted.GdbBp::Matches/Hitbefore the guard, racingg_entries(std::vector) againstArm/Disarmand bumping a non-atomicg_hits. Serialiseg_entrieswith a mutex, makeg_hitsatomic, and fix the now-stale "needs no locking" comment.4 files, +47/-6. Compiles clean on MSVC 2022 / Release (
game.lib+mangosd.exe, 0 warnings / 0 errors). Not yet runtime-tested with a live debugger session — happy to smoke that and test on Linux once it's in.