[Lldb-commits] [lldb] d179ea1 - [NFC][trace] format source files
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 2 21:16:39 PDT 2022
Author: Walter Erquinigo
Date: 2022-08-02T21:16:31-07:00
New Revision: d179ea12fd3186690cb9c630be03ab98b42c5448
URL: https://github.com/llvm/llvm-project/commit/d179ea12fd3186690cb9c630be03ab98b42c5448
DIFF: https://github.com/llvm/llvm-project/commit/d179ea12fd3186690cb9c630be03ab98b42c5448.diff
LOG: [NFC][trace] format source files
Cleanup formatting diff
Added:
Modified:
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
index 234b9f917d32..16f5744cdf02 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
@@ -285,7 +285,6 @@ Error lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread(
for (size_t i = 0; i < executions.size(); i++) {
const IntelPTThreadContinousExecution &execution = executions[i];
-
auto variant = execution.thread_execution.variant;
// We report the TSCs we are sure of
switch (variant) {
diff --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
index 66f3798cd600..14bbecb5042d 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
@@ -18,10 +18,12 @@
namespace lldb_private {
namespace trace_intel_pt {
-/// This struct represents a point in the intel pt trace that the decoder can start decoding from without errors.
+/// This struct represents a point in the intel pt trace that the decoder can
+/// start decoding from without errors.
struct IntelPTThreadSubtrace {
- /// The memory offset of a PSB packet that is a synchronization point for the decoder. A decoder normally looks first
- /// for a PSB packet and then it starts decoding.
+ /// The memory offset of a PSB packet that is a synchronization point for the
+ /// decoder. A decoder normally looks first for a PSB packet and then it
+ /// starts decoding.
uint64_t psb_offset;
/// The timestamp associated with the PSB packet above.
uint64_t tsc;
@@ -79,17 +81,20 @@ llvm::Error DecodeSystemWideTraceForThread(
const llvm::DenseMap<lldb::cpu_id_t, llvm::ArrayRef<uint8_t>> &buffers,
const std::vector<IntelPTThreadContinousExecution> &executions);
-/// Given an intel pt trace, split it in chunks delimited by PSB packets. Each of these chunks
-/// is guaranteed to have been executed continuously.
+/// Given an intel pt trace, split it in chunks delimited by PSB packets. Each
+/// of these chunks is guaranteed to have been executed continuously.
///
/// \param[in] trace_intel_pt
-/// The main Trace object that contains all the information related to the trace session.
+/// The main Trace object that contains all the information related to the
+/// trace session.
///
/// \param[in] buffer
-/// The intel pt buffer that belongs to a single thread or to a single cpu core.
+/// The intel pt buffer that belongs to a single thread or to a single cpu
+/// core.
///
/// \return
-/// A list of continuous executions sorted by time, or an \a llvm::Error in case of failures.
+/// A list of continuous executions sorted by time, or an \a llvm::Error in
+/// case of failures.
llvm::Expected<std::vector<IntelPTThreadSubtrace>>
SplitTraceInContinuousExecutions(TraceIntelPT &trace_intel_pt,
llvm::ArrayRef<uint8_t> buffer);
diff --git a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
index 920992d9d636..c88daf7a7e2a 100644
--- a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
@@ -51,19 +51,18 @@ Expected<DecodedThreadSP> ThreadDecoder::Decode() {
llvm::Expected<DecodedThreadSP> ThreadDecoder::DoDecode() {
return m_trace.GetThreadTimer(m_thread_sp->GetID())
- .TimeTask(
- "Decoding instructions", [&]() -> Expected<DecodedThreadSP> {
- DecodedThreadSP decoded_thread_sp = std::make_shared<DecodedThread>(
- m_thread_sp, m_trace.GetPerfZeroTscConversion());
+ .TimeTask("Decoding instructions", [&]() -> Expected<DecodedThreadSP> {
+ DecodedThreadSP decoded_thread_sp = std::make_shared<DecodedThread>(
+ m_thread_sp, m_trace.GetPerfZeroTscConversion());
- Error err = m_trace.OnThreadBufferRead(
- m_thread_sp->GetID(), [&](llvm::ArrayRef<uint8_t> data) {
- return DecodeSingleTraceForThread(*decoded_thread_sp, m_trace,
- data);
- });
+ Error err = m_trace.OnThreadBufferRead(
+ m_thread_sp->GetID(), [&](llvm::ArrayRef<uint8_t> data) {
+ return DecodeSingleTraceForThread(*decoded_thread_sp, m_trace,
+ data);
+ });
- if (err)
- return std::move(err);
- return decoded_thread_sp;
- });
+ if (err)
+ return std::move(err);
+ return decoded_thread_sp;
+ });
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
index 18b15f25b1ab..029f1b3c70eb 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
@@ -13,9 +13,9 @@
#include "../common/ThreadPostMortemTrace.h"
#include "CommandObjectTraceStartIntelPT.h"
#include "DecodedThread.h"
-#include "TraceIntelPTConstants.h"
#include "TraceIntelPTBundleLoader.h"
#include "TraceIntelPTBundleSaver.h"
+#include "TraceIntelPTConstants.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -65,8 +65,7 @@ Expected<FileSpec> TraceIntelPT::SaveToDisk(FileSpec directory, bool compact) {
Expected<TraceSP> TraceIntelPT::CreateInstanceForTraceBundle(
const json::Value &bundle_description, StringRef bundle_dir,
Debugger &debugger) {
- return TraceIntelPTBundleLoader(debugger, bundle_description,
- bundle_dir)
+ return TraceIntelPTBundleLoader(debugger, bundle_description, bundle_dir)
.Load();
}
@@ -81,10 +80,13 @@ TraceIntelPTSP TraceIntelPT::GetSharedPtr() {
}
TraceIntelPTSP TraceIntelPT::CreateInstanceForPostmortemTrace(
- JSONTraceBundleDescription &bundle_description, ArrayRef<ProcessSP> traced_processes,
+ JSONTraceBundleDescription &bundle_description,
+ ArrayRef<ProcessSP> traced_processes,
ArrayRef<ThreadPostMortemTraceSP> traced_threads) {
- TraceIntelPTSP trace_sp(new TraceIntelPT(bundle_description, traced_processes));
- trace_sp->m_storage.tsc_conversion = bundle_description.tsc_perf_zero_conversion;
+ TraceIntelPTSP trace_sp(
+ new TraceIntelPT(bundle_description, traced_processes));
+ trace_sp->m_storage.tsc_conversion =
+ bundle_description.tsc_perf_zero_conversion;
if (bundle_description.cpus) {
std::vector<cpu_id_t> cpus;
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index b104a8a2581e..7e8f030958f1 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -11,8 +11,8 @@
#include "TaskTimer.h"
#include "ThreadDecoder.h"
-#include "TraceIntelPTMultiCpuDecoder.h"
#include "TraceIntelPTBundleLoader.h"
+#include "TraceIntelPTMultiCpuDecoder.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
@@ -52,10 +52,9 @@ class TraceIntelPT : public Trace {
///
/// \return
/// A trace instance or an error in case of failures.
- static llvm::Expected<lldb::TraceSP>
- CreateInstanceForTraceBundle(const llvm::json::Value &trace_bundle_description,
- llvm::StringRef bundle_dir,
- Debugger &debugger);
+ static llvm::Expected<lldb::TraceSP> CreateInstanceForTraceBundle(
+ const llvm::json::Value &trace_bundle_description,
+ llvm::StringRef bundle_dir, Debugger &debugger);
static llvm::Expected<lldb::TraceSP>
CreateInstanceForLiveProcess(Process &process);
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 3715e46c659c..d1d762bcc507 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -30,7 +30,7 @@ FileSpec TraceIntelPTBundleLoader::NormalizePath(const std::string &path) {
}
Error TraceIntelPTBundleLoader::ParseModule(Target &target,
- const JSONModule &module) {
+ const JSONModule &module) {
auto do_parse = [&]() -> Error {
FileSpec system_file_spec(module.system_path);
@@ -64,7 +64,7 @@ Error TraceIntelPTBundleLoader::ParseModule(Target &target,
}
Error TraceIntelPTBundleLoader::CreateJSONError(json::Path::Root &root,
- const json::Value &value) {
+ const json::Value &value) {
std::string err;
raw_string_ostream os(err);
root.printErrorContext(value, os);
@@ -75,7 +75,7 @@ Error TraceIntelPTBundleLoader::CreateJSONError(json::Path::Root &root,
ThreadPostMortemTraceSP
TraceIntelPTBundleLoader::ParseThread(Process &process,
- const JSONThread &thread) {
+ const JSONThread &thread) {
lldb::tid_t tid = static_cast<lldb::tid_t>(thread.tid);
Optional<FileSpec> trace_file;
@@ -260,8 +260,8 @@ Error TraceIntelPTBundleLoader::AugmentThreadsFromContextSwitches(
FileSpec(cpu.context_switch_trace),
[&](ArrayRef<uint8_t> data) -> Error {
Expected<std::vector<ThreadContinuousExecution>> executions =
- DecodePerfContextSwitchTrace(data, cpu.id,
- *bundle_description.tsc_perf_zero_conversion);
+ DecodePerfContextSwitchTrace(
+ data, cpu.id, *bundle_description.tsc_perf_zero_conversion);
if (!executions)
return executions.takeError();
for (const ThreadContinuousExecution &execution : *executions)
@@ -275,7 +275,8 @@ Error TraceIntelPTBundleLoader::AugmentThreadsFromContextSwitches(
}
Expected<TraceSP> TraceIntelPTBundleLoader::CreateTraceIntelPTInstance(
- JSONTraceBundleDescription &bundle_description, std::vector<ParsedProcess> &parsed_processes) {
+ JSONTraceBundleDescription &bundle_description,
+ std::vector<ParsedProcess> &parsed_processes) {
std::vector<ThreadPostMortemTraceSP> threads;
std::vector<ProcessSP> processes;
for (const ParsedProcess &parsed_process : parsed_processes) {
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.h
index b0b926e1b7d4..7fb4a6b3c9b7 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.h
@@ -29,13 +29,14 @@ class TraceIntelPTBundleLoader {
/// The debugger that will own the targets to create.
///
/// \param[in] bundle_description
- /// The JSON description of a trace bundle that follows the schema of the intel pt trace plug-in.
+ /// The JSON description of a trace bundle that follows the schema of the
+ /// intel pt trace plug-in.
///
/// \param[in] bundle_dir
/// The folder where the trace bundle is located.
TraceIntelPTBundleLoader(Debugger &debugger,
- const llvm::json::Value &bundle_description,
- llvm::StringRef bundle_dir)
+ const llvm::json::Value &bundle_description,
+ llvm::StringRef bundle_dir)
: m_debugger(debugger), m_bundle_description(bundle_description),
m_bundle_dir(bundle_dir) {}
@@ -47,8 +48,8 @@ class TraceIntelPTBundleLoader {
/// Target objects. In case of an error, no targets are created.
///
/// \return
- /// A \a lldb::TraceSP instance created according to the trace bundle information. In case of
- /// errors, return a null pointer.
+ /// A \a lldb::TraceSP instance created according to the trace bundle
+ /// information. In case of errors, return a null pointer.
llvm::Expected<lldb::TraceSP> Load();
private:
@@ -73,7 +74,8 @@ class TraceIntelPTBundleLoader {
/// The JSON process definition
llvm::Expected<ParsedProcess> ParseProcess(const JSONProcess &process);
- /// Create a module associated with the given \p target using the definition from \p module.
+ /// Create a module associated with the given \p target using the definition
+ /// from \p module.
llvm::Error ParseModule(Target &target, const JSONModule &module);
/// Create a user-friendly error message upon a JSON-parsing failure using the
@@ -102,10 +104,11 @@ class TraceIntelPTBundleLoader {
/// \return
/// An \a llvm::Error in case if failures, or \a llvm::Error::success
/// otherwise.
- llvm::Error AugmentThreadsFromContextSwitches(JSONTraceBundleDescription &bundle_description);
+ llvm::Error AugmentThreadsFromContextSwitches(
+ JSONTraceBundleDescription &bundle_description);
- /// Modifiy the bundle description by normalizing all the paths relative to the
- /// session file directory.
+ /// Modifiy the bundle description by normalizing all the paths relative to
+ /// the session file directory.
void NormalizeAllPaths(JSONTraceBundleDescription &bundle_description);
Debugger &m_debugger;
@@ -116,5 +119,4 @@ class TraceIntelPTBundleLoader {
} // namespace trace_intel_pt
} // namespace lldb_private
-
#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTBUNDLELOADER_H
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
index f35914f26ab7..f3d1c674eb80 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
@@ -359,9 +359,10 @@ Expected<FileSpec> TraceIntelPTBundleSaver::SaveToDisk(TraceIntelPT &trace_ipt,
if (!json_cpus)
return json_cpus.takeError();
- JSONTraceBundleDescription json_intel_pt_bundle_desc{"intel-pt", *cpu_info, *json_processes,
- *json_cpus,
- trace_ipt.GetPerfZeroTscConversion()};
+ JSONTraceBundleDescription json_intel_pt_bundle_desc{
+ "intel-pt", *cpu_info, *json_processes, *json_cpus,
+ trace_ipt.GetPerfZeroTscConversion()};
- return SaveTraceBundleDescription(toJSON(json_intel_pt_bundle_desc), directory);
+ return SaveTraceBundleDescription(toJSON(json_intel_pt_bundle_desc),
+ directory);
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
index ca9813652d7a..e1ed248282c3 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp
@@ -117,20 +117,24 @@ bool fromJSON(const json::Value &value, pt_cpu &cpu_info, Path path) {
}
json::Value toJSON(const JSONTraceBundleDescription &bundle_description) {
- return Object{{"type", bundle_description.type},
- {"processes", bundle_description.processes},
- // We have to do this because the compiler fails at doing it
- // automatically because pt_cpu is not in a namespace
- {"cpuInfo", toJSON(bundle_description.cpu_info)},
- {"cpus", bundle_description.cpus},
- {"tscPerfZeroConversion", bundle_description.tsc_perf_zero_conversion}};
+ return Object{
+ {"type", bundle_description.type},
+ {"processes", bundle_description.processes},
+ // We have to do this because the compiler fails at doing it
+ // automatically because pt_cpu is not in a namespace
+ {"cpuInfo", toJSON(bundle_description.cpu_info)},
+ {"cpus", bundle_description.cpus},
+ {"tscPerfZeroConversion", bundle_description.tsc_perf_zero_conversion}};
}
-bool fromJSON(const json::Value &value, JSONTraceBundleDescription &bundle_description, Path path) {
+bool fromJSON(const json::Value &value,
+ JSONTraceBundleDescription &bundle_description, Path path) {
ObjectMapper o(value, path);
if (!(o && o.map("processes", bundle_description.processes) &&
- o.map("type", bundle_description.type) && o.map("cpus", bundle_description.cpus) &&
- o.map("tscPerfZeroConversion", bundle_description.tsc_perf_zero_conversion)))
+ o.map("type", bundle_description.type) &&
+ o.map("cpus", bundle_description.cpus) &&
+ o.map("tscPerfZeroConversion",
+ bundle_description.tsc_perf_zero_conversion)))
return false;
if (bundle_description.cpus && !bundle_description.tsc_perf_zero_conversion) {
path.report(
@@ -139,8 +143,8 @@ bool fromJSON(const json::Value &value, JSONTraceBundleDescription &bundle_descr
}
// We have to do this because the compiler fails at doing it automatically
// because pt_cpu is not in a namespace
- if (!fromJSON(*value.getAsObject()->get("cpuInfo"), bundle_description.cpu_info,
- path.field("cpuInfo")))
+ if (!fromJSON(*value.getAsObject()->get("cpuInfo"),
+ bundle_description.cpu_info, path.field("cpuInfo")))
return false;
return true;
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
index 687c0a793609..d86c6ee65615 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
@@ -84,7 +84,8 @@ bool fromJSON(const llvm::json::Value &value, JSONCpu &cpu,
bool fromJSON(const llvm::json::Value &value, pt_cpu &cpu_info,
llvm::json::Path path);
-bool fromJSON(const llvm::json::Value &value, JSONTraceBundleDescription &bundle_description,
+bool fromJSON(const llvm::json::Value &value,
+ JSONTraceBundleDescription &bundle_description,
llvm::json::Path path);
} // namespace trace_intel_pt
} // namespace lldb_private
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
index 08f54b582e3f..f7cb1669ac30 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.cpp
@@ -63,8 +63,7 @@ Expected<DecodedThreadSP> TraceIntelPTMultiCpuDecoder::Decode(Thread &thread) {
TraceIntelPTSP trace_sp = GetTrace();
- return trace_sp
- ->GetThreadTimer(thread.GetID())
+ return trace_sp->GetThreadTimer(thread.GetID())
.TimeTask("Decoding instructions", [&]() -> Expected<DecodedThreadSP> {
auto it = m_decoded_threads.find(thread.GetID());
if (it != m_decoded_threads.end())
More information about the lldb-commits
mailing list