Skip to content

Conversation

@charles-zablit
Copy link

@charles-zablit charles-zablit commented Dec 5, 2025

This patch adds a dataformatter for FoundationEssentials.Date and NSDate on Windows.

Before

1> Date.now
$R1: FoundationEssentials.Date = {
  _time = 786641176.638381
}
2> NSDate()
$R2: Foundation.NSDate = {
  Foundation.NSObject = {}
  _base = {
    info = 10880
    pad = 0
  }
  _timeIntervalSinceReferenceDate = 786641176.638381
}

After

1> Date.now
$R1: Foundation.Date = 2025-12-05 15:26:16 UTC
2> NSDate()
$R2: NSDate = 2025-12-05 15:26:16 UTC

rdar://155901731

@charles-zablit charles-zablit requested a review from a team as a code owner December 5, 2025 15:27
@charles-zablit charles-zablit self-assigned this Dec 5, 2025
@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch from b5c7671 to 3a44d26 Compare December 5, 2025 16:38
@charles-zablit charles-zablit marked this pull request as draft December 5, 2025 16:38
@charles-zablit
Copy link
Author

@swift-ci please test

1 similar comment
@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit
Copy link
Author

@swift-ci please test linux

@charles-zablit
Copy link
Author

@swift-ci please test windows

@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch from 3a44d26 to 1950598 Compare December 9, 2025 15:31
@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit charles-zablit marked this pull request as ready for review December 9, 2025 15:32
@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch from 1950598 to 03c590b Compare December 9, 2025 15:40
@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch from 03c590b to d84204e Compare December 9, 2025 17:43
@charles-zablit
Copy link
Author

@swift-ci please test

if (!time_sp)
time_sp = valobj.GetChildAtNamePath(
{g__timeIntervalSinceReferenceDate, "_value"});
#endif

Choose a reason for hiding this comment

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

This is probably not correct. The #idef checks of a property of the platform lldb is running on, but you probably want to do something different based on the target triple. I.e., this should not trigger if you debug a macOS process over the network with lldb.exe.

Copy link
Author

Choose a reason for hiding this comment

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

I fixed this by removing the #ifdef check. The GetChildAtNamePath call will only succeed on Windows anyways.

tm_epoch.tm_sec = 0;
tm_epoch.tm_hour = 0;
tm_epoch.tm_min = 0;
tm_epoch.tm_mon = 0;

Choose a reason for hiding this comment

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

nit: is this diff relevant for the pr?

Copy link
Author

Choose a reason for hiding this comment

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

No really, I reverted it 👍

@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch 2 times, most recently from 0e4153a to 4c57eed Compare December 10, 2025 16:29
@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit charles-zablit force-pushed the charles-zablit/lldb/windows/add-date-dataformatter branch from 4c57eed to 0eb0338 Compare December 10, 2025 16:35
"Foundation.Date summary provider", ConstString("Foundation.Date"),
TypeSummaryImpl::Flags(summary_flags).SetDontShowChildren(true));
"Foundation.Date summary provider",
ConstString("Foundation(Essentials)?\\.(NS)?Date"),
Copy link
Author

Choose a reason for hiding this comment

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

This will match:

  • Foundation.Date
  • FoundationEssentials.Date
  • Foundation.NSDate

This should not clash with the other Foundation.NSDate formatter. The tests should confirm this.

@charles-zablit
Copy link
Author

@swift-ci please test

@charles-zablit
Copy link
Author

@swift-ci please test macos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants