Skip to content
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

[lldb][test][FreeBSD] Account for spsr being 8 bytes in newer versions #84032

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

// clang-format off
#include <sys/param.h>
#include <sys/types.h>
#include <machine/reg.h>
#if defined(__arm__)
Expand Down Expand Up @@ -362,7 +363,15 @@ TEST(RegisterContextFreeBSDTest, arm64) {
EXPECT_GPR_ARM64(lr, lr);
EXPECT_GPR_ARM64(sp, sp);
EXPECT_GPR_ARM64(pc, elr);
#if __FreeBSD_version >= 1400084
Copy link
Member

Choose a reason for hiding this comment

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

This will be correct when the host running the debugger is the same as the target (or at least the same version) but we should handle this based on target version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Though these tests are likely only run on the machine that built them, but if lldb is loading a FreeBSD corefile it would need to know there was a difference. That at least needs checking, even if it may appear to "just work".

Making cross version core files work is more than I have time for here, so if any FreeBSD person wants to do a proper version of this fix, feel free.

(I did look for a runtime way to get __FreeBSD_version but none of the version strings I found contained the final part of the macro's value)

// LLDB assumes that cpsr is 32 bit but the kernel stores it as a 64 bit
// value.
EXPECT_THAT(GetRegParams(reg_ctx, gpr_cpsr_arm64),
::testing::Pair(offsetof(reg, spsr), 4));
#else
// Older kernels stored spsr as a 32 bit value.
EXPECT_GPR_ARM64(cpsr, spsr);
#endif

size_t base_offset = reg_ctx.GetRegisterInfo()[fpu_v0_arm64].byte_offset;

Expand Down
Loading