[trace][intelpt] Support system-wide tracing [15] - Make triple optional

The process triple should only be needed when LLDB can't identify the correct
triple on its own. Examples could be universal mach-o binaries. But in any case,
at least for most of ELF files, LLDB should be able to do the job without having
the user specify the triple manually.

Differential Revision: https://reviews.llvm.org/D126990
This commit is contained in:
Walter Erquinigo 2022-06-03 12:01:45 -07:00
parent a19fcc2bec
commit ef9970759b
5 changed files with 8 additions and 10 deletions

View File

@ -36,7 +36,7 @@ struct JSONThread {
struct JSONProcess {
int64_t pid;
std::string triple;
llvm::Optional<std::string> triple;
std::vector<JSONThread> threads;
std::vector<JSONModule> modules;
};

View File

@ -88,7 +88,7 @@ Expected<TraceIntelPTSessionFileParser::ParsedProcess>
TraceIntelPTSessionFileParser::ParseProcess(const JSONProcess &process) {
TargetSP target_sp;
Status error = m_debugger.GetTargetList().CreateTarget(
m_debugger, /*user_exe_path*/ StringRef(), process.triple,
m_debugger, /*user_exe_path*/ StringRef(), process.triple.getValueOr(""),
eLoadDependentsNo,
/*platform_options*/ nullptr, target_sp);
@ -161,8 +161,8 @@ StringRef TraceIntelPTSessionFileParser::GetSchema() {
"processes": [
{
"pid": integer,
"triple": string,
// clang/llvm target triple.
"triple"?: string,
// Optional clang/llvm target triple.
"threads": [
{
"tid": integer,

View File

@ -94,9 +94,9 @@ Schema:
"stepping": integer
},'''])
# Now we test a missing field in the global session file
# Now we test a wrong cpu family field in the global session file
self.expect("trace load -v " + os.path.join(src_dir, "intelpt-trace", "trace_bad2.json"), error=True,
substrs=['error: missing value at traceSession.processes[1].triple', "Context", "Schema"])
substrs=['error: expected uint64_t at traceSession.cpuInfo.family', "Context", "Schema"])
# Now we test a missing field in the intel-pt settings
self.expect("trace load -v " + os.path.join(src_dir, "intelpt-trace", "trace_bad4.json"), error=True,

View File

@ -38,8 +38,7 @@
{
"tid": 3497497
}
],
"triple": "x86_64-unknown-linux-gnu"
]
}
],
"tscPerfZeroConversion": {

View File

@ -2,14 +2,13 @@
"type": "intel-pt",
"cpuInfo": {
"vendor": "GenuineIntel",
"family": 6,
"family": "123",
"model": 79,
"stepping": 1
},
"processes": [
{
"pid": 1234,
"triple": "x86_64-*-linux",
"threads": [
{
"tid": 5678,