Skip to content

[lldb] Make GetDynamicTypeAndAddress() use host address if available #9975

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

@augusto2112 augusto2112 commented Feb 7, 2025

[lldb] Make GetDynamicTypeAndAddress() use host address if available

If GetDynamicTypeAndAddress_Value cannot get back to the inferior address,
but does have a host address and buffer that fits the dynamic type,
return that.


[lldb] Make ValueObjectDynamicValue::UpdateValue() point to  a host b… (#125143)

…uffer

ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type
found by GetDynamicTypeAndAddress() would return an address in the
inferior. This commit makes it so it can deal with being passed a host
address instead.

This is needed downstream by the Swift fork.

rdar://143357274
(cherry picked from commit 0cbc4983adcdbbd85ccb38b2dfbfe5985367b1b2)

…llvm#125143)

…uffer

ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type
found by GetDynamicTypeAndAddress() would return an address in the
inferior. This commit makes it so it can deal with being passed a host
address instead.

This is needed downstream by the Swift fork.

rdar://143357274
(cherry picked from commit 0cbc498)
@augusto2112 augusto2112 requested a review from a team as a code owner February 7, 2025 03:17
@augusto2112
Copy link
Author

@adrian-prantl one commit is just a cherry-pick. The second commit is the one that needs review.

@augusto2112
Copy link
Author

@swift-ci test

DavidSpickett and others added 5 commits February 7, 2025 10:06
Fixes 0cbc498.

llvm-project/lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp(221): error C2065: 'u_int8_t': undeclared identifier

(cherry picked from commit 9d83790)
Fixes 0cbc498.

error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
   71 |                     in_value.GetLocalBufferSize()};
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Given this is test code, I think a static cast is fine here.

Tiny risk that it's actually a symptom of a bug that would
happen if you did 32-bit to 64-bit debugging. I expect you'd
find a lot more bugs than that though.

(cherry picked from commit 52db30e)
If GetDynamicTypeAndAddress_Value cannot get back to the inferior address,
but does have a host address and buffer that fits the dynamic type,
return that.
GetLocalBuffer() makes more sense as an API.
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

Windows failures are on the compiler side which shouldn't be related to these changes:

  Swift(windows-x86_64) :: Interop/Cxx/stdlib/use-std-span.swift
  Swift(windows-x86_64) :: Interop/Cxx/stdlib/use-std-string-view.swift

@augusto2112 augusto2112 merged commit f29572a into swiftlang:stable/20240723 Feb 8, 2025
2 of 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.

3 participants