LLDB mainline
lldb_private::trace_intel_pt::ParsingUtils Namespace Reference


std::optional< uint64_t > ParseUserFriendlySizeExpression (llvm::StringRef size_expression)
 Convert an integral size expression like 12KiB or 4MB into bytes.

Function Documentation

◆ ParseUserFriendlySizeExpression()

std::optional< uint64_t > lldb_private::trace_intel_pt::ParsingUtils::ParseUserFriendlySizeExpression ( llvm::StringRef  size_expression)

Convert an integral size expression like 12KiB or 4MB into bytes.

The units are taken loosely to help users input sizes into LLDB, e.g. KiB and KB are considered the same (2^20 bytes) for simplicity.

[in]size_expressionString expression which is an integral number plus a unit that can be lower or upper case. Supported units: K, KB and KiB for 2^10 bytes; M, MB and MiB for 2^20 bytes; and B for bytes. A single integral number is considered bytes.
The converted number of bytes or std::nullopt if the expression is invalid.

Definition at line 175 of file CommandObjectTraceStartIntelPT.cpp.

Referenced by lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions::SetOptionValue(), lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::CommandOptions::SetOptionValue(), and lldb_private::trace_intel_pt::TraceIntelPT::Start().