Repository navigation
LLDB: fixes for two issues from the #2527 review - #2627
Merged
Merged
Conversation
DoEvaluate set mEvalAllowCalls and mEvalAllowProperties from the evaluation's flags and never cleared them. Autocomplete resolves the target of a member access through EvaluateBeefPath outside of any evaluation, so it ran property getters whenever the last evaluation had been allowed to make calls. After an Immediate panel evaluation, typing 'obj.Prop.m' in the Watch or Immediate panel called Prop's getter in the debuggee on every keystroke. The two flags now only hold for the duration of DoEvaluate (SetAndRestoreValue), which a pending evaluation's continuation goes through as well. DbgAutocompleteGetters counts a getter's calls: autocomplete before any evaluation leaves it alone, and without this it ran after one that made calls. Found by bfiete's review of beefytech#2527.
HotCleanupImages frees an earlier hot load's images once no hot symbol, patched entry, register or stack word points into them. It never saw what HotApplyDataFixups wrote into the original tables, which can point back into the image it came from. Each compile's vdata links its string literal table into the chain the executable's table starts. A compile that adds no new symbol leaves its vdata image referenced only by that chain, so the next compile freed it and a later one reused the memory. String.CheckLiterals then followed the overwritten link, here back into the chain itself, and recursed until the stack overflowed: Intern() crashed with SIGSEGV. An image that any data fixup applied from is now pinned and never freed, which is what Windows does for every hot image. Images that only held replaced methods are freed as before; the vdata kept is about 28KB per compile in the test. HotSwap_FreedImages makes six hot compiles that alternate new literals and ones the program already has, and crashed on the sixth without this. Found by bfiete's review of beefytech#2527.
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.
Fixes for two issues from the #2527 review.
Autocomplete could run property getters.
DoEvaluatesetmEvalAllowCalls/mEvalAllowPropertiesand left them set. Autocomplete (and memory-watch setup) resolve paths outside an evaluation, so after any evaluation that allowed calls, typingobj.Prop.in the watch window ranget__Propin the target. The flags are now scoped toDoEvaluatewithSetAndRestoreValue.Test:
DbgAutocompleteGetters. A counting getter goes from 1 to 2 after autocomplete without the fix, and stays at 1 with it.Hot swap freed images that data fixups still referenced.
HotCleanupImagesfreed any old hot image with no references from symbols, patched entries, registers or stacks. But data fixups write pointers into the original tables that point back into the image they came from: merged vtable entries, copied type data, and the string literal table link thatString.CheckLiterals/Internwalk. Once that image was freed and its memory reused by a later load, the literal chain was corrupt. Images that a fixup applied from are now pinned. This keeps each compile's vdata object, roughly 28KB per hot compile on the test project. Code-only images are still freed.Test:
HotSwap_FreedImages. Six compiles that swap between existing literals, ending in SIGSEGV inInternwithout the fix.Test1 suite: 52/52 on Linux.