forked from OSchip/llvm-project
Revert "[intel-pt] Implement a basic test case"
This reverts commit c911cc6c49
.
This commit is contained in:
parent
c911cc6c49
commit
064c634ef3
|
@ -1,3 +0,0 @@
|
||||||
CXX_SOURCES := main.cpp
|
|
||||||
|
|
||||||
include Makefile.rules
|
|
|
@ -1,60 +0,0 @@
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os
|
|
||||||
import lldb
|
|
||||||
import time
|
|
||||||
|
|
||||||
from lldbsuite.test.decorators import *
|
|
||||||
from lldbsuite.test.lldbtest import *
|
|
||||||
from lldbsuite.test import lldbutil
|
|
||||||
|
|
||||||
|
|
||||||
class TestIntelPTSimpleBinary(TestBase):
|
|
||||||
|
|
||||||
mydir = TestBase.compute_mydir(__file__)
|
|
||||||
NO_DEBUG_INFO_TESTCASE = True
|
|
||||||
|
|
||||||
@skipIf(oslist=no_match(['linux']))
|
|
||||||
@skipIf(archs=no_match(['i386', 'x86_64']))
|
|
||||||
@skipIfRemote
|
|
||||||
def test_basic_flow(self):
|
|
||||||
"""Test collection, decoding, and dumping instructions"""
|
|
||||||
lldb_exec_dir = os.environ["LLDB_IMPLIB_DIR"]
|
|
||||||
lldb_lib_dir = os.path.join(lldb_exec_dir, os.pardir, "lib")
|
|
||||||
plugin_file = os.path.join(lldb_lib_dir, "liblldbIntelFeatures.so")
|
|
||||||
if not os.path.isfile(plugin_file):
|
|
||||||
self.skipTest("features plugin missing.")
|
|
||||||
return
|
|
||||||
|
|
||||||
self.build()
|
|
||||||
|
|
||||||
self.runCmd("plugin load " + plugin_file)
|
|
||||||
|
|
||||||
exe = self.getBuildArtifact("a.out")
|
|
||||||
lldbutil.run_to_name_breakpoint(self, "main", exe_name=exe)
|
|
||||||
# We start tracing from main
|
|
||||||
self.runCmd("processor-trace start all")
|
|
||||||
|
|
||||||
# We check the trace after the for loop
|
|
||||||
self.runCmd("b " + str(line_number('main.cpp', '// Break 1')))
|
|
||||||
self.runCmd("c")
|
|
||||||
|
|
||||||
# We wait a little bit to ensure the processor has send the PT packets to
|
|
||||||
# the memory
|
|
||||||
time.sleep(.1)
|
|
||||||
|
|
||||||
# We find the start address of the 'fun' function for a later check
|
|
||||||
target = self.dbg.GetSelectedTarget()
|
|
||||||
fun_start_adddress = target.FindFunctions("fun")[0].GetSymbol() \
|
|
||||||
.GetStartAddress().GetLoadAddress(target)
|
|
||||||
|
|
||||||
# We print the last instructions
|
|
||||||
self.expect("processor-trace show-instr-log -c 100",
|
|
||||||
patterns=[
|
|
||||||
# We expect to have seen the first instruction of 'fun'
|
|
||||||
hex(fun_start_adddress),
|
|
||||||
# We expect to see the exit condition of the for loop
|
|
||||||
"at main.cpp:" + str(line_number('main.cpp', '// Break for loop'))
|
|
||||||
])
|
|
||||||
|
|
||||||
self.runCmd("processor-trace stop")
|
|
|
@ -1,14 +0,0 @@
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int fun(int a) { return a * a + 1; }
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
int z = 0;
|
|
||||||
for (int i = 0; i < 10000; i++) { // Break for loop
|
|
||||||
z += fun(z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; // Break 1
|
|
||||||
}
|
|
|
@ -191,7 +191,6 @@ public:
|
||||||
result.SetStatus(lldb::eReturnStatusFailed);
|
result.SetStatus(lldb::eReturnStatusFailed);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +290,6 @@ public:
|
||||||
s.GetData());
|
s.GetData());
|
||||||
result.AppendMessage(res.GetOutput());
|
result.AppendMessage(res.GetOutput());
|
||||||
}
|
}
|
||||||
result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +428,6 @@ public:
|
||||||
}
|
}
|
||||||
result.AppendMessage(res.GetOutput());
|
result.AppendMessage(res.GetOutput());
|
||||||
}
|
}
|
||||||
result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +480,6 @@ public:
|
||||||
result.SetStatus(lldb::eReturnStatusFailed);
|
result.SetStatus(lldb::eReturnStatusFailed);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue