Skip to content

Conversation

@augusto2112
Copy link
Contributor

If the MemoryReader can provide a symbol for the context descriptor, use that instead of building the mangle tree from metadata. This shouldn't hurt other clients, and would have a few benefits for LLDB:

  • Small but numerous memory reads can be expensive for LLDB, building the mangle tree from a string should be much faster.

  • For types with private discriminators, this allows LLDB to provide the same private discriminator that's in DWARF and in the swiftmodule (as opposed to using the memory address where the context descriptor lives at). This means that these private types would have the same mangled name in every run. LLDB persistently caches field descriptors by name, but since private discriminators aren't guaranteed to have the same mangled name over multiple runs, LLDB would often need to invalidate its entire cache and rebuild it. Using the stable UUID would solve that issue.

rdar://165950673

If the MemoryReader can provide a symbol for the context descriptor, use
that instead of building the mangle tree from metadata. This shouldn't
hurt other clients, and would have a few benefits for LLDB:

- Small but numerous memory reads can be expensive for LLDB, building
  the mangle tree from a string should be much faster.

- For types with private discriminators, this allows LLDB to provide the
  same private discriminator that's in DWARF and in the swiftmodule (as
  opposed to using the memory address where the context descriptor lives
  at). This means that these private types would have the same mangled
  name in every run. LLDB persistently caches field descriptors by name,
  but since private discriminators aren't guaranteed to have the same
  mangled name over multiple runs, LLDB would often need to invalidate
  its entire cache and rebuild it. Using the stable UUID would solve
  that issue.

rdar://165950673
@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

// Check if the Reader can provide a symbol for this descriptor, and if it
// can, use that instead.
if (auto remoteAbsolutePointer =
Reader->resolvePointerAsSymbol(descriptor.getRemoteAddress())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this requires an exact match, and won't provide a value if the address is some offset past a symbol?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this requires it to be an exact match. Are you thinking of some scenario where we'd be at an offset from the symbol?

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test linux

1 similar comment
@augusto2112
Copy link
Contributor Author

@swift-ci smoke test linux

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