Skip to content

[lldb] Fix local buffer not being popped #10718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

augusto2112
Copy link

  • Explanation: On a recent change in GetDynamicTypeAndAddress_Existential, the local buffer was being pushed but never popped. This fixes the issue by introducing a new RAII data structure that will pop the local buffer when out of scope.
  • Scope: Fixes potentially failing dynamic type resolution.
  • Issues: rdar://148137949
  • Risk: Low. This just makes sure the local buffer is popped after every time it is pushed, and the patch is fairly straightforward.
  • Testing: Added a new test.
  • Reviewers: @adrian-prantl

On a recent change in GetDynamicTypeAndAddress_Existential, the
local buffer was being pushed but never popped. This fixes the issue by
introducing a new RAII data structure that will pop the local buffer
when out of scope.

rdar://148137949
@augusto2112 augusto2112 requested a review from adrian-prantl May 21, 2025 00:05
@augusto2112 augusto2112 requested a review from a team as a code owner May 21, 2025 00:05
@augusto2112
Copy link
Author

@swift-ci test

uint64_t local_buffer_size) {
MemoryReaderLocalBufferHolder::~MemoryReaderLocalBufferHolder() {
if (m_memory_reader)
m_memory_reader->popLocalBuffer();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format

MemoryReaderLocalBufferHolder(LLDBMemoryReader *memory_reader)
: m_memory_reader(memory_reader) {}

LLDBMemoryReader *m_memory_reader;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LLDBMemoryReader *m_memory_reader;
LLDBMemoryReader *m_memory_reader = nullptr;

class LLDBMemoryReader;
class MemoryReaderLocalBufferHolder {
public:
MemoryReaderLocalBufferHolder() : m_memory_reader(nullptr) {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MemoryReaderLocalBufferHolder() : m_memory_reader(nullptr) {}
MemoryReaderLocalBufferHolder() = default;

@adrian-prantl adrian-prantl merged commit 455ce1c into swiftlang:swift/release/6.2 May 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants