This revision was automatically updated to reflect the committed changes. Closed by commit rGa9ffb4734535: Fix LLDB build on old Linux kernels (pre-4.1) (authored by DavidSpickett).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133778/new/ https://reviews.llvm.org/D133778 Files: lldb/source/Plugins/Process/Linux/Perf.cpp
Index: lldb/source/Plugins/Process/Linux/Perf.cpp =================================================================== --- lldb/source/Plugins/Process/Linux/Perf.cpp +++ lldb/source/Plugins/Process/Linux/Perf.cpp @@ -125,6 +125,10 @@ } llvm::Error PerfEvent::MmapAuxBuffer(size_t num_aux_pages) { +#ifndef PERF_ATTR_SIZE_VER5 + return createStringError(inconvertibleErrorCode(), + "Intel PT Linux perf event not supported"); +#else if (num_aux_pages == 0) return Error::success(); @@ -141,6 +145,7 @@ return Error::success(); } else return mmap_aux.takeError(); +#endif } llvm::Error PerfEvent::MmapMetadataAndBuffers(size_t num_data_pages, @@ -170,16 +175,24 @@ } ArrayRef<uint8_t> PerfEvent::GetDataBuffer() const { +#ifndef PERF_ATTR_SIZE_VER5 + llvm_unreachable("Intel PT Linux perf event not supported"); +#else perf_event_mmap_page &mmap_metadata = GetMetadataPage(); return {reinterpret_cast<uint8_t *>(m_metadata_data_base.get()) + mmap_metadata.data_offset, static_cast<size_t>(mmap_metadata.data_size)}; +#endif } ArrayRef<uint8_t> PerfEvent::GetAuxBuffer() const { +#ifndef PERF_ATTR_SIZE_VER5 + llvm_unreachable("Intel PT Linux perf event not supported"); +#else perf_event_mmap_page &mmap_metadata = GetMetadataPage(); return {reinterpret_cast<uint8_t *>(m_aux_base.get()), static_cast<size_t>(mmap_metadata.aux_size)}; +#endif } Expected<std::vector<uint8_t>> PerfEvent::GetReadOnlyDataBuffer() { @@ -188,6 +201,10 @@ // this piece of code updates some pointers. See more about data_tail // in https://man7.org/linux/man-pages/man2/perf_event_open.2.html. +#ifndef PERF_ATTR_SIZE_VER5 + return createStringError(inconvertibleErrorCode(), + "Intel PT Linux perf event not supported"); +#else bool was_enabled = m_enabled; if (Error err = DisableWithIoctl()) return std::move(err); @@ -224,6 +241,7 @@ } return output; +#endif } Expected<std::vector<uint8_t>> PerfEvent::GetReadOnlyAuxBuffer() { @@ -232,6 +250,10 @@ // this piece of code updates some pointers. See more about aux_tail // in https://man7.org/linux/man-pages/man2/perf_event_open.2.html. +#ifndef PERF_ATTR_SIZE_VER5 + return createStringError(inconvertibleErrorCode(), + "Intel PT Linux perf event not supported"); +#else bool was_enabled = m_enabled; if (Error err = DisableWithIoctl()) return std::move(err); @@ -264,6 +286,7 @@ } return output; +#endif } Error PerfEvent::DisableWithIoctl() { @@ -295,11 +318,15 @@ } size_t PerfEvent::GetEffectiveDataBufferSize() const { +#ifndef PERF_ATTR_SIZE_VER5 + llvm_unreachable("Intel PT Linux perf event not supported"); +#else perf_event_mmap_page &mmap_metadata = GetMetadataPage(); if (mmap_metadata.data_head < mmap_metadata.data_size) return mmap_metadata.data_head; else return mmap_metadata.data_size; // The buffer has wrapped. +#endif } Expected<PerfEvent>
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits