Searched defs:snprintf (Results 1 - 17 of 17) sorted by path

/openbsd-current/gnu/gcc/libssp/ssp/
H A Dstdio.h48 #undef snprintf macro
72 #define snprintf(str, len, ...) \ macro
/openbsd-current/gnu/gcc/libstdc++-v3/include/c_std/
H A Dstd_cstdio.h148 #undef snprintf macro
/openbsd-current/gnu/lib/libiberty/src/
H A Dsnprintf.c50 snprintf (char *s, size_t n, const char *format, ...) function
/openbsd-current/gnu/lib/libstdc++/libstdc++/include/c_std/
H A Dstd_cstdio.h146 #undef snprintf macro
/openbsd-current/lib/libc/stdio/
H A Dsnprintf.c41 snprintf(char *str, size_t n, const char *fmt, ...) function
68 DEF_STRONG(snprintf); variable
/openbsd-current/sys/lib/libsa/
H A Dsnprintf.c56 snprintf(char *buf, size_t len, const char *fmt, ...) function
/openbsd-current/gnu/llvm/compiler-rt/lib/profile/
H A DInstrProfilingPort.h67 #define snprintf _snprintf macro
/openbsd-current/gnu/llvm/compiler-rt/lib/sanitizer_common/tests/
H A Dsanitizer_printf_test.cpp101 # define snprintf _snprintf macro
/openbsd-current/gnu/llvm/libcxxabi/src/demangle/
H A DDemangleConfig.h19 #define snprintf _snprintf_s macro
/openbsd-current/gnu/llvm/lldb/source/Plugins/Process/gdb-remote/
H A DGDBRemoteCommunicationClient.cpp1956 assert(packet_len < (int)sizeof(packet)); UNUSED_IF_ASSERT_DISABLED(packet_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success) { if (response.IsOKResponse()) return 0; uint8_t error = response.GetError(); if (error) return error; } return -1; } int GDBRemoteCommunicationClient::SetDetachOnError(bool enable) { char packet[32]; const int packet_len = ::snprintf(packet, sizeof(packet), �, enable ? 1 : 0); assert(packet_len < (int)sizeof(packet)); UNUSED_IF_ASSERT_DISABLED(packet_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success) { if (response.IsOKResponse()) return 0; uint8_t error = response.GetError(); if (error) return error; } return -1; } bool GDBRemoteCommunicationClient::DecodeProcessInfoResponse( StringExtractorGDBRemote &response, ProcessInstanceInfo &process_info) { if (response.IsNormalResponse()) { llvm::StringRef name; llvm::StringRef value; StringExtractor extractor; uint32_t cpu = LLDB_INVALID_CPUTYPE; uint32_t sub = 0; std::string vendor; std::string os_type; while (response.GetNameColonValue(name, value)) { if (name.equals(�)) { lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; value.getAsInteger(0, pid); process_info.SetProcessID(pid); } else if (name.equals(�)) { lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; value.getAsInteger(0, pid); process_info.SetParentProcessID(pid); } else if (name.equals(�)) { uint32_t uid = UINT32_MAX; value.getAsInteger(0, uid); process_info.SetUserID(uid); } else if (name.equals(�)) { uint32_t uid = UINT32_MAX; value.getAsInteger(0, uid); process_info.SetEffectiveUserID(uid); } else if (name.equals(�)) { uint32_t gid = UINT32_MAX; value.getAsInteger(0, gid); process_info.SetGroupID(gid); } else if (name.equals(�)) { uint32_t gid = UINT32_MAX; value.getAsInteger(0, gid); process_info.SetEffectiveGroupID(gid); } else if (name.equals(�)) { StringExtractor extractor(value); std::string triple; extractor.GetHexByteString(triple); process_info.GetArchitecture().SetTriple(triple.c_str()); } else if (name.equals(�)) { StringExtractor extractor(value); std::string name; extractor.GetHexByteString(name); process_info.GetExecutableFile().SetFile(name, FileSpec::Style::native); } else if (name.equals(�)) { llvm::StringRef encoded_args(value), hex_arg; bool is_arg0 = true; while (!encoded_args.empty()) { std::tie(hex_arg, encoded_args) = encoded_args.split(�); std::string arg; StringExtractor extractor(hex_arg); if (extractor.GetHexByteString(arg) * 2 != hex_arg.size()) { process_info.GetArguments().Clear(); process_info.SetArg0(�); break; } if (is_arg0) process_info.SetArg0(arg); else process_info.GetArguments().AppendArgument(arg); is_arg0 = false; } } else if (name.equals(�)) { value.getAsInteger(0, cpu); } else if (name.equals(�)) { value.getAsInteger(0, sub); } else if (name.equals(�)) { vendor = std::string(value); } else if (name.equals(�)) { os_type = std::string(value); } } if (cpu != LLDB_INVALID_CPUTYPE && !vendor.empty() && !os_type.empty()) { if (vendor == �) { process_info.GetArchitecture().SetArchitecture(eArchTypeMachO, cpu, sub); process_info.GetArchitecture().GetTriple().setVendorName( llvm::StringRef(vendor)); process_info.GetArchitecture().GetTriple().setOSName( llvm::StringRef(os_type)); } } if (process_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) return true; } return false; } bool GDBRemoteCommunicationClient::GetProcessInfo( lldb::pid_t pid, ProcessInstanceInfo &process_info) { process_info.Clear(); if (m_supports_qProcessInfoPID) { char packet[32]; const int packet_len = ::snprintf(packet, sizeof(packet), � PRIu64, pid); assert(packet_len < (int)sizeof(packet)); UNUSED_IF_ASSERT_DISABLED(packet_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success) { return DecodeProcessInfoResponse(response, process_info); } else { m_supports_qProcessInfoPID = false; return false; } } return false; } bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) { Log *log(GetLog(GDBRLog::Process | GDBRLog::Packets)); if (allow_lazy) { if (m_qProcessInfo_is_valid == eLazyBoolYes) return true; if (m_qProcessInfo_is_valid == eLazyBoolNo) return false; } GetHostInfo(); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(�, response) == PacketResult::Success) { if (response.IsNormalResponse()) { llvm::StringRef name; llvm::StringRef value; uint32_t cpu = LLDB_INVALID_CPUTYPE; uint32_t sub = 0; std::string arch_name; std::string os_name; std::string environment; std::string vendor_name; std::string triple; std::string elf_abi; uint32_t pointer_byte_size = 0; StringExtractor extractor; ByteOrder byte_order = eByteOrderInvalid; uint32_t num_keys_decoded = 0; lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; while (response.GetNameColonValue(name, value)) { if (name.equals(�)) { if (!value.getAsInteger(16, cpu)) ++num_keys_decoded; } else if (name.equals(�)) { if (!value.getAsInteger(16, sub)) ++num_keys_decoded; } else if (name.equals(�)) { StringExtractor extractor(value); extractor.GetHexByteString(triple); ++num_keys_decoded; } else if (name.equals(�)) { ParseOSType(value, os_name, environment); ++num_keys_decoded; } else if (name.equals(�)) { vendor_name = std::string(value); ++num_keys_decoded; } else if (name.equals(�)) { byte_order = llvm::StringSwitch<lldb::ByteOrder>(value) .Case(�, eByteOrderLittle) .Case(�, eByteOrderBig) .Case(�, eByteOrderPDP) .Default(eByteOrderInvalid); if (byte_order != eByteOrderInvalid) ++num_keys_decoded; } else if (name.equals(�)) { if (!value.getAsInteger(16, pointer_byte_size)) ++num_keys_decoded; } else if (name.equals(�)) { if (!value.getAsInteger(16, pid)) ++num_keys_decoded; } else if (name.equals(�)) { elf_abi = std::string(value); ++num_keys_decoded; } else if (name.equals(�)) { m_process_standalone_uuid.SetFromStringRef(value); ++num_keys_decoded; } else if (name.equals(�)) { StringExtractor extractor(value); m_process_standalone_value = extractor.GetU64(LLDB_INVALID_ADDRESS, 16); if (m_process_standalone_value != LLDB_INVALID_ADDRESS) { m_process_standalone_value_is_offset = true; ++num_keys_decoded; } } else if (name.equals(�)) { StringExtractor extractor(value); m_process_standalone_value = extractor.GetU64(LLDB_INVALID_ADDRESS, 16); if (m_process_standalone_value != LLDB_INVALID_ADDRESS) { m_process_standalone_value_is_offset = false; ++num_keys_decoded; } } else if (name.equals(�)) { m_binary_addresses.clear(); ++num_keys_decoded; for (llvm::StringRef x : llvm::split(value, �)) { addr_t vmaddr; x.consume_front(�); if (llvm::to_integer(x, vmaddr, 16)) m_binary_addresses.push_back(vmaddr); } } } if (num_keys_decoded > 0) m_qProcessInfo_is_valid = eLazyBoolYes; if (pid != LLDB_INVALID_PROCESS_ID) { m_curr_pid_is_valid = eLazyBoolYes; m_curr_pid_run = m_curr_pid = pid; } if (!triple.empty()) { m_process_arch.SetTriple(triple.c_str()); m_process_arch.SetFlags(elf_abi); if (pointer_byte_size) { assert(pointer_byte_size == m_process_arch.GetAddressByteSize()); } } else if (cpu != LLDB_INVALID_CPUTYPE && !os_name.empty() && !vendor_name.empty()) { llvm::Triple triple(llvm::Twine(�) + vendor_name + � + os_name); if (!environment.empty()) triple.setEnvironmentName(environment); assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat); assert(triple.getObjectFormat() != llvm::Triple::Wasm); assert(triple.getObjectFormat() != llvm::Triple::XCOFF); switch (triple.getObjectFormat()) { case llvm::Triple::MachO: m_process_arch.SetArchitecture(eArchTypeMachO, cpu, sub); break; case llvm::Triple::ELF: m_process_arch.SetArchitecture(eArchTypeELF, cpu, sub); break; case llvm::Triple::COFF: m_process_arch.SetArchitecture(eArchTypeCOFF, cpu, sub); break; case llvm::Triple::GOFF: case llvm::Triple::SPIRV: case llvm::Triple::Wasm: case llvm::Triple::XCOFF: case llvm::Triple::DXContainer: LLDB_LOGF(log, �); return false; case llvm::Triple::UnknownObjectFormat: LLDB_LOGF(log, �); return false; } if (pointer_byte_size) { assert(pointer_byte_size == m_process_arch.GetAddressByteSize()); } if (byte_order != eByteOrderInvalid) { assert(byte_order == m_process_arch.GetByteOrder()); } m_process_arch.GetTriple().setVendorName(llvm::StringRef(vendor_name)); m_process_arch.GetTriple().setOSName(llvm::StringRef(os_name)); m_process_arch.GetTriple().setEnvironmentName(llvm::StringRef(environment)); } return true; } } else { m_qProcessInfo_is_valid = eLazyBoolNo; } return false; } uint32_t GDBRemoteCommunicationClient::FindProcesses( const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) { process_infos.clear(); if (m_supports_qfProcessInfo) { StreamString packet; packet.PutCString(�); if (!match_info.MatchAllProcesses()) { packet.PutChar(�); const char *name = match_info.GetProcessInfo().GetName(); bool has_name_match = false; if (name && name[0]) { has_name_match = true; NameMatch name_match_type = match_info.GetNameMatchType(); switch (name_match_type) { case NameMatch::Ignore: has_name_match = false; break; case NameMatch::Equals: packet.PutCString(�); break; case NameMatch::Contains: packet.PutCString(�); break; case NameMatch::StartsWith: packet.PutCString(�); break; case NameMatch::EndsWith: packet.PutCString(�); break; case NameMatch::RegularExpression: packet.PutCString(�); break; } if (has_name_match) { packet.PutCString(�); packet.PutBytesAsRawHex8(name, ::strlen(name)); packet.PutChar(�); } } if (match_info.GetProcessInfo().ProcessIDIsValid()) packet.Printf(� PRIu64 �, match_info.GetProcessInfo().GetProcessID()); if (match_info.GetProcessInfo().ParentProcessIDIsValid()) packet.Printf(� PRIu64 �, match_info.GetProcessInfo().GetParentProcessID()); if (match_info.GetProcessInfo().UserIDIsValid()) packet.Printf(�, match_info.GetProcessInfo().GetUserID()); if (match_info.GetProcessInfo().GroupIDIsValid()) packet.Printf(�, match_info.GetProcessInfo().GetGroupID()); if (match_info.GetProcessInfo().EffectiveUserIDIsValid()) packet.Printf(�, match_info.GetProcessInfo().GetEffectiveUserID()); if (match_info.GetProcessInfo().EffectiveGroupIDIsValid()) packet.Printf(�, match_info.GetProcessInfo().GetEffectiveGroupID()); packet.Printf(�, match_info.GetMatchAllUsers() ? 1 : 0); if (match_info.GetProcessInfo().GetArchitecture().IsValid()) { const ArchSpec &match_arch = match_info.GetProcessInfo().GetArchitecture(); const llvm::Triple &triple = match_arch.GetTriple(); packet.PutCString(�); packet.PutCString(triple.getTriple()); packet.PutChar(�); } } StringExtractorGDBRemote response; ScopedTimeout timeout(*this, minutes(1)); if (SendPacketAndWaitForResponse(packet.GetString(), response) == PacketResult::Success) { do { ProcessInstanceInfo process_info; if (!DecodeProcessInfoResponse(response, process_info)) break; process_infos.push_back(process_info); response = StringExtractorGDBRemote(); } while (SendPacketAndWaitForResponse(�, response) == PacketResult::Success); } else { m_supports_qfProcessInfo = false; return 0; } } return process_infos.size(); } bool GDBRemoteCommunicationClient::GetUserName(uint32_t uid, std::string &name) { if (m_supports_qUserName) { char packet[32]; const int packet_len = ::snprintf(packet, sizeof(packet), �, uid); assert(packet_len < (int)sizeof(packet)); UNUSED_IF_ASSERT_DISABLED(packet_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success) { if (response.IsNormalResponse()) { if (response.GetHexByteString(name) * 2 == response.GetStringRef().size()) return true; } } else { m_supports_qUserName = false; return false; } } return false; } bool GDBRemoteCommunicationClient::GetGroupName(uint32_t gid, std::string &name) { if (m_supports_qGroupName) { char packet[32]; const int packet_len = ::snprintf(packet, sizeof(packet), �, gid); assert(packet_len < (int)sizeof(packet)); UNUSED_IF_ASSERT_DISABLED(packet_len); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success) { if (response.IsNormalResponse()) { if (response.GetHexByteString(name) * 2 == response.GetStringRef().size()) return true; } } else { m_supports_qGroupName = false; return false; } } return false; } static void MakeSpeedTestPacket(StreamString &packet, uint32_t send_size, uint32_t recv_size) { packet.Clear(); packet.Printf(�, recv_size); uint32_t bytes_left = send_size; while (bytes_left > 0) { if (bytes_left >= 26) { packet.PutCString(�); bytes_left -= 26; } else { packet.Printf(�, bytes_left, bytes_left, �); bytes_left = 0; } } } duration<float> calculate_standard_deviation(const std::vector<duration<float>> &v) { if (v.size() == 0) return duration<float>::zero(); using Dur = duration<float>; Dur sum = std::accumulate(std::begin(v), std::end(v), Dur()); Dur mean = sum / v.size(); float accum = 0; for (auto d : v) { float delta = (d - mean).count(); accum += delta * delta; }; return Dur(sqrtf(accum / (v.size() - 1))); } void GDBRemoteCommunicationClient::TestPacketSpeed(const uint32_t num_packets, uint32_t max_send, uint32_t max_recv, uint64_t recv_amount, bool json, Stream &strm) { if (SendSpeedTestPacket(0, 0)) { StreamString packet; if (json) strm.Printf(� �, num_packets); else strm.Printf(�, num_packets); strm.Flush(); uint32_t result_idx = 0; uint32_t send_size; std::vector<duration<float>> packet_times; for (send_size = 0; send_size <= max_send; send_size ? send_size *= 2 : send_size = 4) { for (uint32_t recv_size = 0; recv_size <= max_recv; recv_size ? recv_size *= 2 : recv_size = 4) { MakeSpeedTestPacket(packet, send_size, recv_size); packet_times.clear(); const auto start_time = steady_clock::now(); for (uint32_t i = 0; i < num_packets; ++i) { const auto packet_start_time = steady_clock::now(); StringExtractorGDBRemote response; SendPacketAndWaitForResponse(packet.GetString(), response); const auto packet_end_time = steady_clock::now(); packet_times.push_back(packet_end_time - packet_start_time); } const auto end_time = steady_clock::now(); const auto total_time = end_time - start_time; float packets_per_second = ((float)num_packets) / duration<float>(total_time).count(); auto average_per_packet = num_packets > 0 ? total_time / num_packets : duration<float>::zero(); const duration<float> standard_deviation = calculate_standard_deviation(packet_times); if (json) { strm.Format(� � �, result_idx > 0 ? � : �, send_size, recv_size, total_time, standard_deviation); ++result_idx; } else { strm.Format(� � �, send_size, recv_size, duration<float>(total_time), packets_per_second, duration<float>(average_per_packet), standard_deviation); } strm.Flush(); } } const float k_recv_amount_mb = (float)recv_amount / (1024.0f * 1024.0f); if (json) strm.Printf(� � PRIu64 �, recv_amount); else strm.Printf(� �, k_recv_amount_mb); strm.Flush(); send_size = 0; result_idx = 0; for (uint32_t recv_size = 32; recv_size <= max_recv; recv_size *= 2) { MakeSpeedTestPacket(packet, send_size, recv_size); if (recv_size > 0) { const auto start_time = steady_clock::now(); uint32_t bytes_read = 0; uint32_t packet_count = 0; while (bytes_read < recv_amount) { StringExtractorGDBRemote response; SendPacketAndWaitForResponse(packet.GetString(), response); bytes_read += recv_size; ++packet_count; } const auto end_time = steady_clock::now(); const auto total_time = end_time - start_time; float mb_second = ((float)recv_amount) / duration<float>(total_time).count() / (1024.0 * 1024.0); float packets_per_second = ((float)packet_count) / duration<float>(total_time).count(); const auto average_per_packet = packet_count > 0 ? total_time / packet_count : duration<float>::zero(); if (json) { strm.Format(� �, result_idx > 0 ? � : �, send_size, recv_size, total_time); ++result_idx; } else { strm.Format(� � �, send_size, recv_size, packet_count, k_recv_amount_mb, duration<float>(total_time), mb_second, packets_per_second, duration<float>(average_per_packet)); } strm.Flush(); } } if (json) strm.Printf(�); else strm.EOL(); } } bool GDBRemoteCommunicationClient::SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size) { StreamString packet; packet.Printf(�, recv_size); uint32_t bytes_left = send_size; while (bytes_left > 0) { if (bytes_left >= 26) argument
[all...]
/openbsd-current/gnu/llvm/llvm/lib/Support/
H A Dregerror.c49 #define snprintf _snprintf macro
/openbsd-current/gnu/usr.bin/perl/win32/
H A Dwin32.h234 #define snprintf _snprintf macro
/openbsd-current/lib/libc/hidden/
H A Dstdio.h104 PROTO_NORMAL(snprintf); variable
/openbsd-current/lib/libz/
H A Dgzguts.h110 # define snprintf _snprintf macro
/openbsd-current/regress/lib/libz/
H A Dminigzip.c44 # define snprintf _snprintf macro
/openbsd-current/sbin/unwind/libunbound/
H A Dconfig.h1222 #define snprintf snprintf_unbound macro
/openbsd-current/sys/kern/
H A Dsubr_prf.c563 snprintf(char *buf, size_t size, const char *fmt, ...) function
[all...]

Completed in 510 milliseconds